Solved

Perl parse syslog

Posted on 2009-04-01
5
753 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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.

911 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now