Skip to content
Discussion options

You must be logged in to vote

parse_regex is the right function for one log line. The failure in the original program is parse_timestamp: %d-%b %H:%M does not supply a year. With the default drop_on_error: false, the failed remap forwards the original event, which explains the missing parsed fields.

This parses all 17 sample lines. The year and timezone are explicit because the log does not contain them; 2025 and UTC are example values to replace with the correct values for your logs.

. = parse_regex!(.message, r'^(?P<timestamp>\d{2}-[A-Za-z]{3} \d{2}:\d{2}) (?P<component>[a-zA-Z0-9._-]+) JobId (?P<jobid>\d+): (?P<msg>.*)$')
.timestamp = parse_timestamp!("2025 " + .timestamp, format: "%Y %d-%b %H:%M", timezone: "UTC")…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@Rawoosa
Comment options

@pront
Comment options

@Rawoosa
Comment options

@Rawoosa
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by pront
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
domain:parsing Anything related to parsing within Vector domain:vrl Anything related to the Vector Remap Language transform:remap Anything `remap` transform related
2 participants