I'm trying to write a program that logs events on a remote machine. I'm running on Debian Jessie and, for now, logging to my local rsyslogd. The first event always gets lost, but the second is logged normally.
A colleague running the same program against other targets says that Splunk discards the first event and a Windows-based syslog watcher reports the first event as having no usable strings.
I've narrowed it down to this test code:
#!/usr/bin/perl
use warnings;
use strict;
use v5.10;
use Sys::Syslog qw/:DEFAULT setlogsock/;
setlogsock({
type => 'tcp',
host => 'localhost',
port => 514
})
or die "Can't set syslog socket\n";
openlog 'wombat', 'ndelay', 'local0'
or die "Can't open the event log\n";
syslog 'INFO', 'First wombat event';
syslog 'INFO', 'Second wombat event';
closelog or die $!;
Am I using Sys::Syslog wrongly, or does it have a bug that causes the first event to get lost?
(I know that the man page asks us -- twice -- not to run setlogsock, but there's no other clean way to log events on a remote machine, which is part of the specification of the program I'm writing.)
Many thanks.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.