balabit/syslog-ng-incubator — pull request #6 by talien (2014-01-05 16:26:07+00:00)
Title: lua: Added simple version of lua destination.

Usage:

destination d_lua {
lua( script("test.lua") init("test_init") queue("test_queue") template("$MESSAGE") );
};

Parameters:
* script: the name of the Lua file which contains the functions for the destination.
* init: the name of the Lua function which is called during
initialization of the destination.
* queue: each message reaching this destination is formatted using the template parameter,
and passed to this function as a Lua string.
* template: can be omitted, it's default value is "$MESSAGE"

Each lua destination has it's own state, so init and queue functions can
have side effects, and global variables are keeped between init and
queue calls.

Example lua file:

--BEGIN
function test_init()
print "Init called!"
counter = 0
end

function test_queue
counter = counter + 1
print(msg .. " " .. tostring(counter))
end
--END