[Tutor] Matching on multiple log lines

Tom Tucker tktucker at gmail.com
Sun Oct 29 02:55:57 CEST 2006


I would appreciate any recommendations or assistance on how to read
and parse this log.  The log is constantly growing and has the
potential of being large.  For this reason, we are reading in line by
line.  How do I match on multiple lines, while reading a log line by
line.   Hopefully the logic example and sample log will make more
sense.
Thank you,


Logic:
------
1) Search for this string 'Writing Message to'
2) Search ahead for this string 'TRANSPORT_STREAM_ID'
3) Followed by a blank line
4) If 1,2, and 3:  increase a counter or something (counter +=1)
4) Repeat process


Example log
############
2006/10/24 20:46:05.853 Writing Message to 192.168.1.1:3211
Protocol:  2
Message Type:  PROVISION
Parameters:
Parameter type:  CHANNEL_ID    Parameter value:   0001
Parameter type:  SCG_ID    Parameter value:   0001
Parameter type:  TRANSPORT_STREAM_ID    Parameter value:   0160
Parameter type:  PROGRAM_NUMBER    Parameter value:   0001
Parameter type:  GROUP    Parameter value:   0009 0002
2006/10/24 20:46:05.957 Receiving message from 192.168.1.1:3211
2006/10/24 20:47:05.011 Writing Message to 192.168.1.2:3211
Protocol:  2
Message Type:  PROVISION
Parameters:
Parameter type:  CHANNEL_ID    Parameter value:   0001
Parameter type:  SCG_ID    Parameter value:   0001
Parameter type:  TRANSPORT_STREAM_ID    Parameter value:   0160

2006/10/24 20:47:05.057 Blah Blah..more logging


More information about the Tutor mailing list