[SERVICE]
Parsers_File /path/to/parsers.conf
[INPUT]
Name dummy
Tag dummy.data
Dummy {"data":"100 0.5 true This is example"}
[FILTER]
Name parser
Match dummy.*
Key_Name data
Parser dummy_test
[OUTPUT]
Name stdout
Match *
The output when running the corresponding configuration is as follows:
You can see the records {"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.
If you enable Reserve_Data, all other fields are preserved. First the contents of the corresponding parsers file,
depending on the choice for YAML or classic configurations, would be as follows:
[PARSER]
Name dummy_test
Format regex
Regex ^(?<INT>[^ ]+) (?<FLOAT>[^ ]+) (?<BOOL>[^ ]+) (?<STRING>.+)$
Now add Reserve_Data to the filter section of the corresponding configuration file as follows:
service:
parsers_file: /path/to/parsers.yaml
pipeline:
inputs:
- name: dummy
tag: dummy.data
dummy: '{"data":"100 0.5 true This is example", "key1":"value1", "key2":"value2"}'
filters:
- name: parser
match: 'dummy.*'
key_name: data
parser: dummy_test
reserve_data: on
outputs:
- name: stdout
match: '*'
[SERVICE]
Parsers_File /path/to/parsers.conf
[INPUT]
Name dummy
Tag dummy.data
Dummy {"data":"100 0.5 true This is example", "key1":"value1", "key2":"value2"}
[FILTER]
Name parser
Match dummy.*
Key_Name data
Parser dummy_test
Reserve_Data On
[OUTPUT]
Name stdout
Match *
The output when running the corresponding configuration is as follows:
If you enable Reserve_Data and Preserve_Key, the original key field will also be preserved. First the contents of
the corresponding parsers file, depending on the choice for YAML or classic configurations, would be as follows:
[PARSER]
Name dummy_test
Format regex
Regex ^(?<INT>[^ ]+) (?<FLOAT>[^ ]+) (?<BOOL>[^ ]+) (?<STRING>.+)$
Now add Reserve_Data and Preserve_Keyto the filter section of the corresponding configuration file as follows:
service:
parsers_file: /path/to/parsers.yaml
pipeline:
inputs:
- name: dummy
tag: dummy.data
dummy: '{"data":"100 0.5 true This is example", "key1":"value1", "key2":"value2"}'
filters:
- name: parser
match: 'dummy.*'
key_name: data
parser: dummy_test
reserve_data: on
preserve_key: on
outputs:
- name: stdout
match: '*'
[SERVICE]
Parsers_File /path/to/parsers.conf
[INPUT]
Name dummy
Tag dummy.data
Dummy {"data":"100 0.5 true This is example", "key1":"value1", "key2":"value2"}
[FILTER]
Name parser
Match dummy.*
Key_Name data
Parser dummy_test
Reserve_Data On
Preserve_Key On
[OUTPUT]
Name stdout
Match *
The output when running the corresponding configuration is as follows: