log file monitoring using regex

493 Views Asked by At

below is sample log file of our application, I've to monitor this log file and get a count of code 91 (6th column) in last 5 minutes, I'm to use log file monitoring feature of sitescope monitoring tool, i need help to build regular expression to capture 6th column i tried with /91/ but it capture 9 & 1 from entire line.

     Slot[21] 0100 000000 4766430101212871 ------------- 00 673992 000000009700 425721673992301758074766430101212871 425721673992 884397 S
00:54:34 
     Slot[33] 0420 000000 4766430101206956 0000000000000 **91** 031078 000000005000 425646031078DFLT99994766430101206956 425646031078 819664 S
00:54:41 
     Slot [29] | NOT FINANCIAL TRANSACTION
00:55:11 
      Slot [2] | NOT FINANCIAL TRANSACTION
00:55:25 
      Slot[12] 0420 000000 4766430101218191 0000000000000 91 212183 000000000100 425510212183DFLT99994766430101218191 425510212183 843916 S
00:55:31 
      Slot[25] 0200 012000 4766430101027386 ------------- 00 707971 000000002000 425719707971WMAD06134766430101027386 425719707971 135632 S
00:55:41 
      Slot [0] | NOT FINANCIAL TRANSACTION
00:55:48 
      Slot [10] | NOT FINANCIAL TRANSACTION
00:56:13 
      Slot [34] | NOT FINANCIAL TRANSACTION
00:56:41 
       Slot [17] | NOT FINANCIAL TRANSACTION
00:56:43 
       Slot[41] 0100 000000 4766430101077084 ------------- 00 609169 000000001850 425719609169000001014766430101077084 425719609169 137844 'S

any expert suggestion?

TIA

3

There are 3 best solutions below

3
On BEST ANSWER

i found / 91 /s works and fulfills my requirement

0
On

if your columns are separated with one space you could try

/([^ ]+ ){5}91 /

I don't know if your tool supports {n}, that means repeat n times.

0
On

Try with this:

\s*Slot\s*\[\d+](?:\s+\S+){4}[\s*]+(91)\b

Demo