Skip to content

Latest commit

 

History

History
101 lines (81 loc) · 4.11 KB

key_value_parser.md

File metadata and controls

101 lines (81 loc) · 4.11 KB

key_value_parser operator

The key_value_parser operator parses the string-type field selected by parse_from into key value pairs. All values are of type string.

Configuration Fields

Field Default Description
id key_value_parser A unique identifier for the operator
output Next in pipeline The connected operator(s) that will receive all outbound entries
parse_from $ A field that indicates the field to be parsed into key value pairs
parse_to $ A field that indicates the field to be parsed as into key value pairs
preserve_to Preserves the unparsed value at the specified field
on_error send The behavior of the operator if it encounters an error. See on_error
if An expression that, when set, will be evaluated to determine whether this operator should be used for the given entry. This allows you to do easy conditional parsing without branching logic with routers.
timestamp nil An optional timestamp block which will parse a timestamp field before passing the entry to the output operator
severity nil An optional severity block which will parse a severity field before passing the entry to the output operator

Example Configurations

Parse the field message into key value pairs

Configuration:

- type: key_value_parser
  parse_from: message
Input record Output record
{
  "timestamp": "",
  "record": {
    "message": "name=stanza"
  }
}
{
  "timestamp": "",
  "record": {
    "name": "stanza"
  }
}

Parse the field message as key value pairs, and parse the timestamp

Configuration:

- type: key_value_parser
  parse_from: message
  timestamp:
    parse_from: seconds_since_epoch
    layout_type: epoch
    layout: s
Input record Output record
{
  "timestamp": "",
  "record": {
    "message": "name=stanza seconds_since_epoch=1136214245"
  }
}
{
  "timestamp": "2006-01-02T15:04:05-07:00",
  "record": {
    "name": "stanza"
  }
}