Skip to content

Extract multiple regex patterns from a log #1161

Answered by jszwedko
jrosado48 asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for sharing the additional examples! When I use your remap I do see multiple events being emitted.

Configuration:

sources:
  source0:
    type: stdin
    decoding:
      codec: json
transforms:
  transform0:
    type: remap
    inputs:
    - source0
    source: |
      str = string(.message) ?? ""
      .value = parse_regex_all(str, r'(?P<value>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{6}.*\|\|\s*)|(?P<value2>Number_PRSDUP:\s*\d+\s+Avg_QTime:\s*\d+\.\d{3}\s+Max_Parallel:\s*\d+\s+Parallel_Idle_time:\s*\d+\.\d{3}\s+Delete_Alert:\s*\d+(?:\s+Delete_Alert_failures:\s*\d+)?)') ?? {}

      newval = []
      for_each(.value) -> |_, item| {
        if item.value != null {
          newval = …

Replies: 1 comment 4 replies

Comment options

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

@jrosado48
Comment options

@jszwedko
Comment options

Answer selected by jrosado48
@jrosado48
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
vrl: stdlib Changes to the standard library
2 participants