write to trigger connection close, allow errors EPIPE or ECONNRESET.
client => {
func => sub {
my $self = shift;
- ${$self->{syslogd}}->loggrep("loghost .* connection close", 2)
- or die "connection close in syslogd.log";
+ ${$self->{syslogd}}->loggrep("loghost .* connection close", 5)
+ or die "no connection close in syslogd.log";
write_log($self, @_);
},
},
},
server => {
listen => { domain => AF_INET, proto => "tcp", addr => "127.0.0.1" },
- func => sub {},
+ func => sub {
+ my $self = shift;
+ shutdown(\*STDOUT, 1)
+ or die "shutdown write failed: $!";
+ ${$self->{syslogd}}->loggrep("loghost .* connection close", 5)
+ or die "no connection close in syslogd.log";
+ },
loggrep => {},
},
file => {
use strict;
use warnings;
use Socket;
+use Errno ':POSIX';
+
+my @errors = (EPIPE,ECONNRESET);
+my $errors = "(". join("|", map { $! = $_ } @errors). ")";
our %args = (
client => {
func => sub {
my $self = shift;
- ${$self->{syslogd}}->loggrep("loghost .* connection error", 2)
- or die "connection error in syslogd.log";
+ ${$self->{syslogd}}->loggrep("loghost .* connection error", 5)
+ or die "no connection error in syslogd.log";
write_log($self, @_);
},
},
},
file => {
loggrep => {
- qr/syslogd: loghost .* connection error: Connection reset by peer/
+ qr/syslogd: loghost .* connection error: $errors/
=> 1,
},
},
client => {
func => sub {
my $self = shift;
- ${$self->{syslogd}}->loggrep("loghost .* did send .* back", 2)
+ ${$self->{syslogd}}->loggrep("loghost .* did send .* back", 5)
or die "no send back in syslogd.log";
write_log($self, @_);
},
read_between2logs($self, sub {
${$self->{syslogd}}->kill_syslogd('TERM');
my $pattern = "syslogd: exiting on signal 15";
- ${$self->{syslogd}}->loggrep("syslogd: exiting on signal 15",
- 5) or die ref($self),
+ ${$self->{syslogd}}->loggrep("syslogd: exiting on signal 15", 5)
+ or die ref($self),
" no 'syslogd: exiting on signal 15' between logs";
print STDERR "Signal\n";
});