How to make Logstash multiline filter merge lines based on some dynamic field value? -
i new logstash , desparate setup elk 1 of usecase. have found question relevent mine why won't logstash multiline merge lines based on grok'd field? if multiline filter not merge lines on grok fields how merge line 2 , 10 below log sample? please help.
using grok patterns have created field 'id' holds value 715.
line1 - 5/08/06 00:10:35.348 [baseasyncapi] [qtp19303632-51]: info: [714] cmdc flowcxt=[55c2a5fbe4b0201c2be31e35] method=contentdetail uri=http://10.126.44.161:5600/cmdc/content/programid%3a%2f%2f317977349~programid%3a%2f%2f9?lang=eng&catalogueid=30®ion=3000~3001&pset=pset_pps header={} line2 - 2015/08/06 00:10:35.348 [baseasyncapi] [qtp19303632-53]: info: [715] cmdc flowcxt=[55c2a5fbe4b0201c2be31e36] method=contentdetail uri=http://10.126.44.161:5600/cmdc/content/programid%3a%2f%2f1640233758~programid%3a%2f%2f1073741829?lang=eng&catalogueid=30®ion=3000~3001&pset=pset_pps header={} line3 - 2015/08/06 00:10:35.349 [twcasyncprocessor] [twc-pool-3-thread-2]: info: [714:426] twc request=mercurysortrequest line4 - 2015/08/06 00:10:35.349 [twcasyncprocessor] [twc-pool-3-thread-1]: info: [715:427] twc request=mercurysortrequest line5 - 2015/08/06 00:10:35.352 [baseasyncapi] [qtp19303632-54]: info: [716] cmdc flowcxt=[55c2a5fbe4b0201c2be31e37] method=contentdetail uri=http://10.126.44.161:5600/cmdc/content/programid%3a%2f%2f2144942810~programid%3a%2f%2f1953281601?lang=eng&catalogueid=30®ion=3000~3001&pset=pset_pps header={} line6 - 2015/08/06 00:10:35.354 [twcasyncprocessor] [twc-pool-3-thread-1]: info: [716:428] twc request=mercurysortrequest line7 - 2015/08/06 00:10:35.359 [baseasyncapi] [qtp19303632-49]: info: [717] cmdc flowcxt=[55c2a5fbe4b0201c2be31e38] method=contentdetail uri=http://10.126.44.161:5600/cmdc/content/programid%3a%2f%2f2144942448~programid%3a%2f%2f2147355770?lang=eng&catalogueid=30®ion=3000~3001&pset=pset_pps header={} line8 - 2015/08/06 00:10:35.360 [twcasyncprocessor] [twc-pool-3-thread-2]: info: [717:429] twc request=mercurysortrequest line9 - 2015/08/06 00:10:35.366 [twcasyncprocessor$twcasyncprocessorcallback$receivecallback] [cmdc-pool-2-thread-41]: info: [715:427] twc response status=200 hits=1 time=17 internal=10.42 line10 - 2015/08/06 00:10:35.367 [baseasyncapi] [cmdc-pool-2-thread-41]: info: [715] cmdc response status=200 cmdc=19ms twc=17ms #twc=1
you need use multiline
filter stream_identity
set. documentation here isn't clear on it's used for, basic strategy this:
if (!"multiline" in [tags]) { grok { // parse out identity field } multiline { stream_identity => "%{id}" pattern => "." // match because we're gathering id field => "previous" periodic_flush => true max_age => 5 // many seconds takes of lines add_tags => ["multiline" ] } } else { // process multiline event that's been flushed }
i haven't tried since 1.5 came out, docs should work (in 1.4.2 , prior, flushing mechanism didn't work, lose events).
Comments
Post a Comment