0

My log sample is something like this:

2017-01-03 03:38:18 +0000 field1: 123 field2: 321
field3: 1133 field4: 0901
2017-01-03 03:38:19 +0000 field1: 523 field2: 521
field3: 533 field4: 509

Im very new to this. How should I write the regex?

Mitch
  • 21,223
  • 6
  • 63
  • 86
Shawn Sim
  • 545
  • 1
  • 5
  • 17

1 Answers1

1

With the file{} input, you should use the multiline codec (rather than the multiline{} filter), e.g.:

input {
  file {
    path => "..."
    codec => multiline {
      negate => "true"
      pattern => "^%{YEAR}"
      what => "previous"
    }
  }
}

Which you would read as, "if the line doesn't start with a year, keep it with the previous line".

Alain Collins
  • 16,268
  • 2
  • 32
  • 55