Solved

Perl parse syslog

Posted on 2009-04-01
5
766 Views
Last Modified: 2013-12-26
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.
0
Comment
Question by:intechfs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 19

Accepted Solution

by:
http:// thevpn.guru earned 250 total points
ID: 24038887
check the logwatch package..it will do that for you
0
 
LVL 4

Assisted Solution

by:dda
dda earned 50 total points
ID: 24047258
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
 
LVL 39

Assisted Solution

by:Adam314
Adam314 earned 200 total points
ID: 24051491
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
 

Author Comment

by:intechfs
ID: 24064516
Thanks for all the comments.

dda, thanks for that. Not useful for this problem but something generally useful to know!
0
 

Author Closing Comment

by:intechfs
ID: 31565290
Thanks a lot for the help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question