Subject: | Broken arg pass from Log-Syslog-Fast-Simple to Log-Syslog-Fast |
ISSUE
The hard-coded ARG array indexes are out of sync with what's expected by
Log::Syslog::Fast. this means the call to Log::Syslog::Fast::send has
its args slightly out of whack.
The severity code is written into the facility array slot, and the
facility code is written into the port array slot.
The bug is produced with this code:
use Log::Syslog::Fast qw(:severities :facilities);
use Log::Syslog::Fast::Simple;
$JffLogger ||= Log::Syslog::Fast::Simple->new(
hostname => '172.16.200.100',
facility => LOG_DAEMON,
severity => LOG_INFO,
sender => 'radmin:'.$PID,
name => $scriptname,
);
$JffLogger->send("Test Message",undef,2,undef);
Here's a bugged packet dump:
15:11:18.194364 IP (tos 0x0, ttl 64, id 46, offset 0, flags [DF],
proto: UDP (17), length: 89) 172.16.200.110.37056 > 172.16.200.100.514:
SYSLOG, length: 61
Facility mail (2), Severity info (6)
Msg: Oct 16 15:11:18 radmin: eval_shell.pl[1034]: Test Message
Instead of passing 2 (LOG_CRIT) in the severity field, it's passed in
the facility field.
SOLUTION
Fixing the bug produced the following commands on my system -
# cp Simple.pm Simple.pm.old
# vi Simple.pm
# diff Simple.pm.old Simple.pm
21,26c21,27
< _HOSTNAME => 0,
< _PORT => 1,
< _FACILITY => 2,
< _SEVERITY => 3,
< _SENDER => 4,
< _NAME => 5,
---
Show quoted text
> _PROTO => 0,
> _HOSTNAME => 1,
> _PORT => 2,
> _FACILITY => 3,
> _SEVERITY => 4,
> _SENDER => 5,
> _NAME => 6,
# md5sum Simple.pm
1a3a61c0e2ef8a56759a59a2849c3f79 Simple.pm
# md5sum Simple.pm.old
a3dd20246eb8b6a294672dc1757f7d86 Simple.pm.old
Here's a fixed packet dump:
15:21:09.934310 IP (tos 0x0, ttl 64, id 16905, offset 0, flags [DF],
proto: UDP (17), length: 89) 172.16.200.110.37057 > 172.16.200.100.514:
SYSLOG, length: 61
Facility daemon (3), Severity critical (2)
Msg: Oct 16 15:21:09 radmin: eval_shell.pl[1114]: Test Message
Thanks for your attention.