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
Solved

Perl parse syslog

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert grep lines to perl 6 58
How to get all the API from website? 11 104
haveThree challenge 22 121
Vb script to unzip a files and rename the files 5 95
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…
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.

828 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