Hi, Just wanted to give everyone a heads up that a breaking change to the Lua sandbox will be landing on the dev branch of Heka soon.
Summary: 1) inject_message is no longer overloaded. Only this signature is valid: https://hekad.readthedocs.org/en/latest/sandbox/index.html#inject-message-message-table 2) output has been renamed to add_to_payload and table is no longer a supported argument type. Table data must be converted to a string first (cjson.encode has exposed for this purpose). 3) inject_payload has been introduced. Details: **add_to_payload(arg1, arg2, ...argN)** Appends the arguments to the payload buffer for incremental construction of the final payload output (inject_payload finalizes the buffer and sends the message to Heka). This function is simply a rename of the generic sandbox *output* function to improve the readability of the plugin code. *Arguments* - arg (number, string, bool, nil, circular_buffer) *Return* none **inject_payload(payload_type, payload_name, payload_arg1, ..., payload_argN)** Creates a new Heka message using the contents of the payload buffer (pre-populated with *add_to_payload*) combined with any additional payload_args passed to this function. The output buffer is cleared after the injection. The payload_type and payload_name arguments are two pieces of optional metadata. If specified, they will be included as fields in the injected message e.g., Fields[payload_type] == 'csv', Fields[payload_name] == 'Android Usage Statistics'. *Arguments* - payload_type (**optional, default "txt"** string) Describes the content type of the injected payload data. - payload_name (**optional, default ""** string) Names the content to aid in downstream filtering. - payload_arg1 (**optional) Same type restrictions as add_to_payload. ... - payload_argN *Return* none Examples: -- THIS output("Hello World!") inject_message() -- TO inject_payload("txt", "example", "Hello World!") -- THIS output(message_variable, "\tWeight\n") for k, v in pairs(items) do if v > min_output_weight then output(string.format("%s\t%d\n", k, v)) end end inject_message("tsv", string.format("Weighting by %s", message_variable)) -- TO add_to_payload(message_variable, "\tWeight\n") for k, v in pairs(items) do if v > min_output_weight then add_to_payload(string.format("%s\t%d\n", k, v)) end end inject_payload("tsv", string.format("Weighting by %s", message_variable)) Thanks, Trink _______________________________________________ Heka mailing list Heka@mozilla.org https://mail.mozilla.org/listinfo/heka