Skip to content

log_parser

Axel Schwab edited this page Mar 11, 2024 · 2 revisions

Log parsers are specified in the Pipeline-Definiton. Multiple parsers can be configured at once. The type specifies the parser kind and parameters.

Regex to CSV

The formatter provides the following variables

Variable Description
$TIMESTAMP The UNIX timestamp (milliseconds) of the log entry
$SOURCE The source of the log (e.g. STANDARD_IO, MANAGEMENT_EVENT)
$ERROR Whether the message originates from an error stream (e.g. 1 for stderr)
$0 The whole matcher
$1/$2/$3..$n The matcher group

In addition, all environment variables of the executed stage can also be specified.

Basic

...
  logParsers:
  - matcher: "([\\d]+) %"
    destination: "blubb.csv"
    formatter: "$TIMESTAMP;$1;$0;$SOURCE;$ERROR;!;$WINSLOW_PIPELINE_ID"
    type: "regex-matcher/csv"

Important

Backslashes have to be escaped: \\, or use single quotes - they will be automatically escaped on the next load.

Multiline (4 lines)

...
  logParsers:
  - matcher: "([\\d]+) %\n([\\d]+) %\n([\\d]+) %\n([\\d]+) %"
    destination: "blubb_$bernd.csv"
    formatter: "$TIMESTAMP;$1;$2;$3;$4;$SOURCE;$ERROR;!;$WINSLOW_PIPELINE_ID"
    type: "regex-matcher/csv:lines=4"

Clone this wiki locally