args-client-tcp-multilines.pl revision 1.3
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; 11use Socket; 12 13my %threegrep = ( 14 get_firstlog() => 1, 15 get_secondlog() => 1, 16 get_thirdlog() => 1, 17); 18 19our %args = ( 20 client => { 21 connect => { domain => AF_INET, proto => "tcp", addr => "127.0.0.1", 22 port => 514 }, 23 func => sub { 24 my $self = shift; 25 my $msg = get_firstlog()."\n".get_secondlog()."\n".get_thirdlog(); 26 write_message($self, $msg); 27 ${$self->{syslogd}}->loggrep(get_thirdlog(), 5) 28 or die ref($self), " syslogd did not receive third log"; 29 write_shutdown($self); 30 }, 31 loggrep => {}, 32 }, 33 syslogd => { 34 options => ["-T", "127.0.0.1:514"], 35 loggrep => { 36 %threegrep, 37 qr/tcp logger .* non transparent framing, use \d+ bytes/ => 3, 38 }, 39 }, 40 server => { loggrep => \%threegrep }, 41 file => { loggrep => \%threegrep }, 42 pipe => { loggrep => \%threegrep }, 43); 44 451; 46