1# The client writes a message to Sys::Syslog native method. 2# The syslogd writes it into a file and through a pipe. 3# The syslogd passes it via UDP to the loghost. 4# The server receives the message on its UDP socket. 5# Find the message in client, file, pipe, syslogd, server log. 6# Check that a modified config file restarts syslogd child. 7 8use strict; 9use warnings; 10 11our %args = ( 12 client => { 13 func => sub { write_between2logs(shift, sub { 14 my $self = shift; 15 ${$self->{server}}->loggrep("Signal", 8) 16 or die ref($self), " no 'Signal' between logs"; 17 })}, 18 loggrep => { get_between2loggrep() }, 19 }, 20 syslogd => { 21 ktrace => { 22 qr/syslogd PSIG SIGHUP caught handler/ => 1, 23 qr/syslogd RET execve JUSTRETURN/ => 4, 24 }, 25 loggrep => { 26 qr/config file modified: restarting/ => 1, 27 qr/config file changed: dying/ => 1, 28 qr/syslogd: restarted/ => 0, 29 get_between2loggrep(), 30 }, 31 }, 32 server => { 33 func => sub { read_between2logs(shift, sub { 34 my $self = shift; 35 my $conffile = ${$self->{syslogd}}->{conffile}; 36 open(my $fh, '>>', $conffile) 37 or die ref($self), " append conf file $conffile failed: $!"; 38 print $fh "# modified\n"; 39 close($fh); 40 ${$self->{syslogd}}->kill_syslogd('HUP'); 41 ${$self->{syslogd}}->loggrep("syslogd: started", 5, 2) 42 or die ref($self), " no 'syslogd: started' between logs"; 43 print STDERR "Signal\n"; 44 })}, 45 loggrep => { get_between2loggrep() }, 46 }, 47 file => { 48 loggrep => { 49 qr/syslogd\[\d+\]: start/ => 2, 50 qr/syslogd\[\d+\]: restart/ => 0, 51 qr/syslogd\[\d+\]: exiting/ => 1, 52 }, 53 }, 54); 55 561; 57