No commit activity in last 3 years
No release in over 3 years
Fluent output filter plugin for parsing key/value fields in records. Automatically determines type of the value as integer, float or string
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

>= 0

Runtime

 Project Readme

fluent-plugin-fields-autotype

Fluent output filter plugin for parsing key/value fields in records based on configurable patterns. This plugin is a fork of tomas-zemres/fluent-plugin-fields-parser. We extend that plugin to automatically determine the data type of the value (string, integer or float).

Installation

Use RubyGems:

td-agent-gem install fluent-plugin-fields-autotype

Configuration

<match pattern>
    type                fields_autotype

    remove_tag_prefix   raw
    add_tag_prefix      parsed
    pattern             (\S+)=(\S+)
</match>

If following record is passed:

{"message": "Audit log username=Johny action=add-user result=success" }

then you will get a new record:

{
    "message": "Audit log username=Johny action=add-user result=success",
    "username": "Johny",
    "action": "add-user",
    "result": "success"
}

Parameter parse_key

For configuration

<match pattern>
    type        fields_autotype

    parse_key   log_message
</match>

it parses key "log_message" instead of default key message.

Parameter fields_key

Configuration

<match pattern>
    type        fields_autotype

    parse_key   log_message
    fields_key  fields
</match>

For input like:

{
    "log_message": "Audit log username=Johny action=add-user result=success",
}

it adds parsed fields into defined key.

{
    "log_message": "Audit log username=Johny action='add-user' result=success",
    "fields": {"user": "Johny", "action": "add-user", "result": "success"}
}

(It adds new keys into top-level record by default.)

Parameter pattern

You can define custom pattern (regexp) for seaching keys/values. Data type like float and int are automatically determined.

Configuration

<match pattern>
    type        fields_autotype

    pattern     (\w+):(\S+)
</match>

For input like:

{ "message": "black:54 white:55 red:10.1"}

it returns:

{ "message": "black:54 white=55 red=10.1",
  "black": 54, "white": 55, "red": 10.1
}

Tag prefix

You cat add and/or remove tag prefix using Configuration parameters

<match pattern>
    type                fields_autotype

    remove_tag_prefix   raw
    add_tag_prefix      parsed
</match>

If it matched tag "raw.some.record", then it emits tag "parsed.some.record".