Perl parse syslog

I am trying to write a Perl log that will parse the syslog in Linux (/var/log/messages) and log the critical messages only.

In Windows the event viewer simply catagorises messages into information, warning or error but I can't see anything like this in /var/log/messages

Can someone please tell me what I need to filter out these messages or if there is a module that will do this. If it matters the OSes are SuSE and Ubuntu.
intechfsAsked:
Who is Participating?
 
http:// thevpn.guruConnect With a Mentor Commented:
check the logwatch package..it will do that for you
0
 
ddaConnect With a Mentor Commented:
Not related to perl, but you may also want to edit your /etc/syslog.conf and specify which messages go to /var/log/messages and which go to other location.
0
 
Adam314Connect With a Mentor Commented:
If you need to write something custom (it sounds like the logwatch will do what you need), you could use the Parse::Syslog module:
    http://search.cpan.org/~dschwei/Parse-Syslog-1.10/lib/Parse/Syslog.pm
0
 
intechfsAuthor Commented:
Thanks for all the comments.

dda, thanks for that. Not useful for this problem but something generally useful to know!
0
 
intechfsAuthor Commented:
Thanks a lot for the help.
0
All Courses

From novice to tech pro — start learning today.