Transforms a generic lua table into fields in the Heka message schema

The configuration allows a grammar or a function to be specified for the initial parse.

This decoder makes use of util.table_to_fields. If the resulting table after grammar/module_function is applied contains nested tables, these tables are flattened by combining the key name with parent keys. The resulting flattened table is then used as message Fields with the default headers.

1. Decoder Configuration Table

decoders_heka_table_to_fields = {
    module_name     = "cjson",
    module_function = "decode", -- or module_grammar to use a grammar
    -- max_depth = 5, -- optional, maximum depth for nested table conversion (default no limit)
    -- separator = "." -- optional, override default nested table key seperator in util.table_to_fields
}

2. Functions

2.1. decode

Decode and inject the resulting message

Arguments

  • data (string) - input data to be parsed into fields
  • default_headers (optional table) - Heka message table containing the default header values to use, if they are not populated by the decoder. If 'Fields' is specified it should be in the hashed based format see: http://mozilla-services.github.io/lua_sandbox/heka/message.html

Return

  • nil - throws an error on an invalid data type, parse error, inject_message failure etc.

source code: table_to_fields.lua

results matching ""

    No results matching ""