http://qs321.pair.com?node_id=1129443

MarkusLaker has asked for the wisdom of the Perl Monks concerning the following question:

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.