Schema InfluxDB EncoderΒΆ

New in version 0.8.

Plugin Name: SandboxEncoder
File Name: lua_encoders/schema_influx.lua

Converts full Heka message contents to JSON for InfluxDB HTTP API. Includes all standard message fields and iterates through all of the dynamically specified fields, skipping any bytes fields or any fields explicitly omitted using the skip_fields config option.


This encoder is intended for use with InfluxDB versions prior to 0.9. If you’re working with InfluxDB v0.9 or greater, you’ll want to use the Schema InfluxDB Line Encoder instead.


  • series (string, optional, default “series”)

    String to use as the series key’s value in the generated JSON. Supports interpolation of field values from the processed message, using %{fieldname}. Any fieldname values of “Type”, “Payload”, “Hostname”, “Pid”, “Logger”, “Severity”, or “EnvVersion” will be extracted from the the base message schema, any other values will be assumed to refer to a dynamic message field. Only the first value of the first instance of a dynamic message field can be used for series name interpolation. If the dynamic field doesn’t exist, the uninterpolated value will be left in the series name. Note that it is not possible to interpolate either the “Timestamp” or the “Uuid” message fields into the series name, those values will be interpreted as referring to dynamic message fields.

  • skip_fields (string, optional, default “”)

    Space delimited set of fields that should not be included in the InfluxDB records being generated. Any fieldname values of “Type”, “Payload”, “Hostname”, “Pid”, “Logger”, “Severity”, or “EnvVersion” will be assumed to refer to the corresponding field from the base message schema. Any other values will be assumed to refer to a dynamic message field.

  • multi_series (boolean, optional, default false)

    Instead of submitting all fields to InfluxDB as attributes of a single series, submit a series for each field that sets a “value” attribute to the value of the field. This also sets the name attribute to the series value with the field name appended to it by a ”.”. This is the recommended by InfluxDB for v0.9 onwards as it is found to provide better performance when querying and aggregating across multiple series.

  • exclude_base_fields (boolean, optional, default false)

    Don’t send the base fields to InfluxDB. This saves storage space by not including base fields that are mostly redundant and unused data. If skip_fields includes base fields, this overrides it and will only be relevant for skipping dynamic fields.

Example Heka Configuration

type = "SandboxEncoder"
filename = "lua_encoders/schema_influx.lua"
    series = "heka.%{Logger}"
    skip_fields = "Pid EnvVersion"

message_matcher = "Type == 'influxdb'"
encoder = "influxdb"
type = "HttpOutput"
address = ""
username = "influx_username"
password = "influx_password"

Example Output