[mrtg] Regexp statement for parsing the logfile?..

Richard Whittaker RWHITTAKER at nwtel.ca
Fri Dec 12 20:05:07 MET 2003


Greetings:

I'm trying to parse the .log files from MRTG in a PERL script using regexp, and I'm having some difficulty.. I'd like to parse the file, and put the datestamp, first, and second values into variables for further processing..

This is the regexp statement I'm using, and I'm not getting the results I expected.. 

if ($_=~/(.*)\s{1,}(.*)\s{1,}(.*)\s{1,}(.*)\s{1,}(.*)/)

For instance:

shaggy:~ # cat /usr/local/apache/htdocs/nettrace/prddbs/dbquery-tbsprd.log | ./test.pl | more
 
1071255300 48 8 2933 495
 
2003121212105500   8    2933
1071255000 2927 494 2933 495
 
2003121212105000   494    2933
1071254700 2712 492 4131 495
 
2003121212104500   492    4131
1071254400 4109 494 4131 495
 
2003121212104000   494    4131
1071254100 3072 491 3075 500
 
2003121212103500   491    3075
1071253800 2929 500 2944 501
 
2003121212103000   500    2944
1071253500 1871 501 2070 533
 
2003121212102500   501    2070
1071253200 2071 537 2158 860
 
2003121212102000   537    2158
1071252900 2148 852 2158 860
 
2003121212101500   852    2158
1071252600 1715 489 3059 490
 
2003121212101000   489    3059
1071252300 3097 488 4697 490


Regards,
Richard.


Richard Whittaker, CISSP
System Manager
NorthwesTel Inc.
Whitehorse, YK
(867) 393-7756


--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list