Solved

Perl parse syslog

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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…
Six Sigma Control Plans

636 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