Clever/lua_sandbox

Name: lua_sandbox

Owner: Clever

Description: Generic Lua sandbox for dynamic data analysis

Created: 2016-02-01 20:17:19.0

Updated: 2016-02-01 20:17:20.0

Pushed: 2016-04-01 00:06:54.0

Homepage:

Size: 874

Language: Lua

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Lua Sandbox Library
Overview

Sandboxes provide a dynamic and isolated execution environment for data parsing, transformation, and analysis. They allow access to data without jeopardizing the integrity or performance of the processing infrastructure. This broadens the audience that the data can be exposed to and facilitates new uses of the data (i.e. debugging, monitoring, dynamic provisioning, SLA analysis, intrusion detection, ad-hoc reporting, etc.)

The Lua sandbox is library allowing customized control over the Lua execution environment including functionality like global data preservation/restoration on shutdown/startup, output collection in textual, binary or Heka protobuf format and an array of parsers for various data types (Nginx, Apache, Syslog, MySQL and many RFC grammars)

Features
Installation
Prerequisites
Optional (used for documentation)
CMake Build Instructions
git clone https://github.com/mozilla-services/lua_sandbox.git
cd lua_sandbox
mkdir release
cd release

# UNIX
cmake -DCMAKE_BUILD_TYPE=release ..
make

# Windows Visual Studio 2013
cmake -DCMAKE_BUILD_TYPE=release -G "NMake Makefiles" ..
nmake

# Windows MinGW
cmake -DCMAKE_BUILD_TYPE=release -G "MinGW Makefiles" ..
mingw32-make

ctest
Sandbox API
Lua functions exposed to C by the core sandbox

There are no functions exposed by default, see lsb_pcall_setup() and lsb_pcall_teardown() when defining an API.

Functions exposed to Lua by the core sandbox

require(libraryName)

By default only the base library is loaded additional libraries must be loaded with require().

Arguments

Return


output(arg0, arg1, …argN)

lsb_appends data to the output buffer, which cannot exceed the output_limit
configuration parameter. See lsb_get_output() to connect the output to the
host application.

Arguments

Return

Note: To extend the function set exposed to Lua see lsb_add_function()

How to interact with the sandbox (creating an API)

The best place to start is with some examples:

Unit Test API

Unit Test Source Code

Lua Functions Exposed to C C Functions Exposed to Lua
Heka Sandbox API

Heka Sandbox


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.