1# The syslogd listens on 127.0.0.1 TCP socket.
2# The client writes octet counting messages into TCP socket.
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 client, file, pipe, syslogd, server log.
7# Check that the file log contains all the messages.
8
9use strict;
10use warnings;
11use Socket;
12
13our %args = (
14    client => {
15	connect => { domain => AF_INET, proto => "tcp", addr => "127.0.0.1",
16	    port => 514 },
17	func => sub {
18	    my $self = shift;
19	    print "0 1 a2 bc3 de\n4 fg\000X3 hi 4 jk\n\n1 l0 1 m1  2  n2 o ";
20	    write_log($self);
21	},
22    },
23    syslogd => {
24	options => ["-T", "127.0.0.1:514"],
25    },
26    file => {
27	loggrep => {
28	    qr/localhost $/ => 3,
29	    qr/localhost a$/ => 1,
30	    qr/localhost bc$/ => 1,
31	    qr/localhost de$/ => 1,
32	    qr/localhost fg$/ => 1,  # NUL terminates message
33	    qr/localhost hi $/ => 1,
34	    qr/localhost jk $/ => 1,  # new line converted to space
35	    qr/localhost l$/ => 1,
36	    qr/localhost m$/ => 1,
37	    qr/localhost n$/ => 1,  # leading spaces are striped
38	    qr/localhost o $/ => 1,
39	    get_testgrep() => 1,
40	},
41    },
42);
43
441;
45