args-client-tcp-multilines.pl revision 1.1
1# The syslogd listens on 127.0.0.1 TCP socket. 2# The client writes three lines into a 127.0.0.1 TCP socket in a single chunk. 3# The syslogd writes it into a file and through a pipe. 4# The syslogd passes it via UDP to the loghost. 5# The server receives the message on its UDP socket. 6# Find the message in file, pipe, syslogd, server log. 7# Check that the file log contains all messages. 8 9use strict; 10use warnings; 11 12my %threegrep = ( 13 get_firstlog() => 1, 14 get_secondlog() => 1, 15 get_thirdlog() => 1, 16); 17 18our %args = ( 19 client => { 20 connect => { domain => AF_INET, proto => "tcp", addr => "127.0.0.1", 21 port => 514 }, 22 func => sub { 23 my $self = shift; 24 my $msg = get_firstlog()."\n".get_secondlog()."\n".get_thirdlog(); 25 write_message($self, $msg); 26 ${$self->{syslogd}}->loggrep(get_thirdlog(), 5) 27 or die ref($self), " syslogd did not receive third log"; 28 write_shutdown($self); 29 }, 30 loggrep => {}, 31 }, 32 syslogd => { 33 options => ["-T", "127.0.0.1:514"], 34 loggrep => { 35 %threegrep, 36 qr/tcp logger .* complete line/ => 3, 37 }, 38 }, 39 server => { loggrep => \%threegrep }, 40 file => { loggrep => \%threegrep }, 41 pipe => { loggrep => \%threegrep }, 42); 43 441; 45