multiline

The multiline parser plugin parses multiline logs. This plugin is multiline version of regexp parser.

The multiline parser parses log with formatN and format_firstline parameters. format_firstline is for detecting start line of multiline log. formatN, N's range is 1..20, is the list of Regexp format for multiline log. Unlike other parser plugins, this plugin needs special code in input plugin, e.g. handle format_firstline. So currently, in_tail plugin works with `multiline` but other input plugins don't work with `multiline`.

Parameters

time_key

Specify the field for event time. Default is time.

time_format

Specify time format for time_key.

See Time#strptime for additional format information.

format_firstline

Specify regexp pattern for start line of multiple lines. Input plugin can skip the logs until format_firstline is matched. Default is nil.

If format_firstline is not specified, input plugin should store unmatched new lines in temporary buffer and try to match buffered logs with each new line.

formatN

Specify regexp patterns. For readability, you can separate regexp patterns into multiple regexpN parameters, See "Rails log" example. These patterns are joined and constructs regexp pattern with multiline mode.

keep_time_key

If you want to keep time field in the record, set true. Default is false.

Example

Rails log

With this configuration:

This incoming event is parsed as:

Java stacktrace log

With this configuration:

These incoming events are parsed as:

If this article is incorrect or outdated, or omits critical information, please let us know. Fluentd is a open source project under Cloud Native Computing Foundation (CNCF). All components are available under the Apache 2 License.

Last updated

Was this helpful?