Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

collect /var/log/messgages and dmesg

by janasec (Sexton)
on Jul 19, 2015 at 05:02 UTC ( [id://1135340]=perlquestion: print w/replies, xml ) Need Help??

janasec has asked for the wisdom of the Perl Monks concerning the following question:

I need help on script to collect the /var/log/messages and dmesg

The code must actively copy and these contents and also send alert when some error happened

I need to collect the logs during my test execution and it should be able to print the logs to a file during the entire test and it must also report errors

Replies are listed 'Best First'.
Re: collect /var/log/messgages and dmesg
by atcroft (Abbot) on Jul 19, 2015 at 06:08 UTC
Re: collect /var/log/messgages and dmesg
by i5513 (Pilgrim) on Jul 19, 2015 at 08:16 UTC
    In addition to Re: collect /var/log/messgages and dmesg about cpan syslog modules,
    There are programs designed for that monitoring task. See (simple code for study), for example, logcheck (written with perl and bash)
    They are others , like, zabbix, nxlog, logstash , ... but they are off topic at The Monastery
    Regards
    I would configure dmesg to be written on /var/log/dmesg
Re: collect /var/log/messgages and dmesg
by FreeBeerReekingMonk (Deacon) on Jul 19, 2015 at 14:47 UTC

    Not sure if you mean that it has to COPY the logfile (and hold it as evidence, if we find errors), or just be able to log rotate, so you can look to logs of days past.
    Just know you can send the log to another computer with Rsyslog or Syslog-ng for a centralized logging (and centralized monitoring with additional tools).
    As for the monitoring, do you mean realtime, or just check each 5 minutes or so for errors. If the latter, there is this nice perlscript you can use standalone it is called check_log3.pl (details)
    You can get the required utils.pm from the nagios-plugins tarball.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1135340]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-19 04:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found