Parser

    The plugin supports the following configuration parameters:

    Getting Started

    This is an example to parser a record {"data":"100 0.5 true This is example"}.

    The plugin needs parser file which defines how to parse field.

    1. [SERVICE]
    2. Parsers_File /path/to/parsers.conf
    3. [INPUT]
    4. Name dummy
    5. Tag dummy.data
    6. Dummy {"data":"100 0.5 true This is example"}
    7. Name parser
    8. Match dummy.*
    9. Parser dummy_test
    10. [OUTPUT]
    11. Name stdout
    12. Match *

    The output is

    You can see the record {"data":"100 0.5 true This is example"} are parsed.

    Preserve original fields

    By default, the parser plugin only keeps the parsed fields in its output.

    1. [PARSER]
    2. Name dummy_test
    3. Preserve_Key On
    4. Format regex

    This will produce the output:

    If you enable , all other fields are preserved:

    1. [PARSER]
    2. Name dummy_test
    3. Reserve_Data On
    4. Format regex
    5. Regex ^(?<INT>[^ ]+) (?<FLOAT>[^ ]+) (?<BOOL>[^ ]+) (?<STRING>.+)$

    This will produce the output:

    1. $ fluent-bit -c dummy.conf
    2. Fluent-Bit v0.12.0
    3. Copyright (C) Treasure Data
    4. [2017/07/06 22:33:12] [ info] [engine] started
    5. [0] dummy.data: [1499347993.001371317, {"INT"=>"100", "FLOAT"=>"0.5", "BOOL"=>"true", "STRING"=>"This is example"}, "key1":"value1", "key2":"value2"]
    6. [1] dummy.data: [1499347994.001303118, {"INT"=>"100", "FLOAT"=>"0.5", "BOOL"=>"true", "STRING"=>"This is example"}, "key1":"value1", "key2":"value2"]
    7. [3] dummy.data: [1499347996.001320284, {"INT"=>"100", "FLOAT"=>"0.5", "BOOL"=>"true", "STRING"=>"This is example"}, "key1":"value1", "key2":"value2"]