tedatadcu
asked on
Must Restart syslog-ng to send email
Dear friends
I'm using Syslog-ng v 3 installed in RHEL 5
I have a small problem with my syslog-ng configuration, I'm trying to filter logs from a log file and forwerd it to perl script to send it by email,
This part of configuration like the following:
========================== ========== ========== =======
source sme {file (/var/log/syslog-ng/server s/172.31.2 50.68/loca l7.log); };
destination maillog { program ("/usr/local/bin/syslog-ma il-perl" );
};
log {source(sme); destination(maillog); };
========================== ========== ========== =======
And the perl script like the following:
++++++++++++++++++++++++++ +++++++++=
#!/usr/bin/perl -n
# thanks to Brian Dowling for an example with security in mind.
$TO = 'root';
$FROM = $TO;
s/^//;
open(MAIL, "|/usr/sbin/sendmail -t");
print MAIL "EOT";
To: $TO
From: $FROM
Subject: SME Log Alert: $_
$_
EOT
close(MAIL);
++++++++++++++++++++++++++ ++++++++++ +++
I found that I must restart syslog every time to send the mails , In another word it buffer the emails tell I restart syslog-ng then It forwerd it to send mail and can see it in the mail log.
Do you have any idea for that ?
Thanks
I'm using Syslog-ng v 3 installed in RHEL 5
I have a small problem with my syslog-ng configuration, I'm trying to filter logs from a log file and forwerd it to perl script to send it by email,
This part of configuration like the following:
==========================
source sme {file (/var/log/syslog-ng/server
destination maillog { program ("/usr/local/bin/syslog-ma
};
log {source(sme); destination(maillog); };
==========================
And the perl script like the following:
++++++++++++++++++++++++++
#!/usr/bin/perl -n
# thanks to Brian Dowling for an example with security in mind.
$TO = 'root';
$FROM = $TO;
s/^//;
open(MAIL, "|/usr/sbin/sendmail -t");
print MAIL "EOT";
To: $TO
From: $FROM
Subject: SME Log Alert: $_
$_
EOT
close(MAIL);
++++++++++++++++++++++++++
I found that I must restart syslog every time to send the mails , In another word it buffer the emails tell I restart syslog-ng then It forwerd it to send mail and can see it in the mail log.
Do you have any idea for that ?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER