Heka JSON Message Decoder Module with Mutate capabilities

https://wiki.mozilla.org/Firefox/Services/Logging

1. Decoder Configuration Table

decoders_heka_json_mutate = {
  -- Preserve the default_headers passed to decode by storing the json message
  -- in Fields, after flattening the json message with a delimiter.
  preserve_metadata = false, -- default

  -- Use the Timestamp from json when preserve_metadata is true.
  preserve_metadata_use_timestamp = false, -- default

  -- Delimiter to use when flattening the Fields object of the json message.
  -- Used only when preserve_metadata is true.
  flatten_delimiter = ".", -- default

  -- Remove these fields from the json message
  scrub_fields = {}, -- default

  -- For key, value in user_agent_transforms
  -- transform Fields[key] into Fields[value.."browser"], Fields[value.."version"], Fields[value.."os"].
  user_agent_transforms = {agent = "user_agent_"}, -- default {}

  -- Always preserve the original fields if user_agent_transforms occur.
  user_agent_keep = false, -- default

  -- Only preserve the original fields if user_agent_transforms occur and fail.
  user_agent_conditional = false, -- default
}

2. Functions

2.1. decode

Decode and inject the resulting message

Arguments

  • data (string) - JSON message with a Heka schema
  • 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, JSON parse error, inject_message failure etc.

source code: json_mutate.lua

results matching ""

    No results matching ""