Elasticsearch Common Encoder Utility Functions

1. Encoder Configuration Table

encoders_elasticsearch_common = {
    -- Boolean flag, if true then any time interpolation (often used to generate the
    -- ElasticSeach index) will use the timestamp from the processed message rather
    -- than the system time.
    es_index_from_timestamp = false -- optional, default shown

    -- String to use as the `_index` key's value in the  generated JSON.
    -- Supports field interpolation as described below.
    index = "heka-%{%Y.%m.%d}" -- optional, default shown

    -- String to use as the `_type` key's value in the generated JSON.
    -- Supports field interpolation as described below.
    type_name = "message" -- optional, default shown

    -- String to use as the `_id` key's value in the generated JSON.
    -- Supports field interpolation as described below.
    id = nil -- optional, default shown
}

2. Functions

2.1. bulkapi_index_json

Returns a simple JSON 'index' structure satisfying the ElasticSearch BulkAPI

Arguments

  • index (string or nil) - Used as the _index key's value in the generated JSON or nil to omit the key. Supports field interpolation as described below.
  • type_name (string or nil) - Used as the _type key's value in the generated JSON or nil to omit the key. Supports field interpolation as described below.
  • id (string or nil) - Used as the _id key's value in the generated JSON or nil to omit the key. Supports field interpolation as described below.
  • ns (number or nil) - Nanosecond timestamp to use for any strftime field interpolation into the above fields. Current system time will be used if nil.

Return

  • JSON - String suitable for use as ElasticSearch BulkAPI index directive.

See Field Interpolation

2.2. load_encoder_cfg

Loads and validates the common Elastic Search encoder configuration options.

Arguments

  • none

Return

  • cfg (table)

source code: common.lua

results matching ""

    No results matching ""