1

I a trying to make an alert e-mail system using Perl Script, when a kernel error occurs in a server. How can I fetch serious error logs from the kernel? Logs can be seen in /var/log/kern.log The requirement is to detect it, when a log is being written with a serious error message in kern.log. How to sense such an error? Or is there any other possible better method? Kindly help it.

5
  • The logging is done using rsyslog, I think. You can modify or add to the rsyslog configuration to match log level (critical, I think), and source to do things, including sending mails.
    – muru
    Jun 16, 2015 at 7:18
  • @muru : I am so sorry muru... I cant understand fully. Kindly explain.
    – kiran bbnl
    Jun 16, 2015 at 8:00
  • The logs are processed using a program called rsyslog, which sends it to appropriate files like kern.log, auth.log, syslog, etc. You can modify it's configuration to send mails as well. The logged messages are classified into priority levels, so you can do so only for certain priorities, and only for messages from certain sources (the kernel, but not others). I'll write a more compete answer if I get the time, but this should be enough of a starting point for you or someone else to figure out what needs to be done.
    – muru
    Jun 16, 2015 at 8:15
  • @muru : thanks... but kindly get into some more details. if possible...
    – kiran bbnl
    Jun 16, 2015 at 13:37
  • 1
    @kiranbbnl he's given plenty of details. as he said, use rsyslog
    – Tim
    Jun 30, 2015 at 11:57

2 Answers 2

2

Answered in comments by Muru:

The logs are processed using a program called rsyslog, which sends it to appropriate files like kern.log, auth.log, syslog, etc. You can modify it's configuration to send mails as well. The logged messages are classified into priority levels, so you can do so only for certain priorities, and only for messages from certain sources (the kernel, but not others). I'll write a more compete answer if I get the time, but this should be enough of a starting point for you or someone else to figure out what needs to be done.

0

Use kerneloops ?

kerneloops is a daemon used to submit kernel oops to kerneloops.org automatically.

You can change the submit-url line in /etc/kerneloops.conf to your liking. However, you will need some server to be able to catch the file sent by kerneloops daemon.

And somehow parse the file send by kerneloops too. I don't know the format of the file. May be look at https://github.com/oops-kernel-org/web/tree/master/php/parser

Not the answer you're looking for? Browse other questions tagged .