[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Who wanted program, which react on syslogd messages in realtime?



Hello,

Once upon a time I was necessary to execute some actions in response to one program errors, which wrote their own messages in syslog. I has written simplest script, which read syslogd's reporting from named pipe.

However, soon I has wanted to script reacted and on other messages in syslog. I has writed a program so as new handlers of messages possible was add as possible easier.

Program is written on Perl. To add its handler, you needed simply write Perl-script like this:

# begin
use Syslog2;

register_handler(name=>'myhandler',sub=>\&test_handler,eq=>'eq',"kernel");

sub test_handler{
  my ($time,$host,$service,$message) = @_;

  if($message=~/^eth\d: Promiscuous mode enabled/){
	# your action		
}
}
# end

And copy this script in dir 'handlers', restart Syslog2.

Project on Sourceforge: http://sourceforge.net/projects/syslog2/.

Can whomever from you it will be useful.....

P.S.: Sorry for my english ;-).

--
# Alex S. Yemelyanov




Reply to: