xref: /openbsd-src/regress/usr.sbin/syslogd/args-bufsize-native.pl (revision c346733c9369b9d8a9e3bcd29c4f3716b99753f3)
1# The client writes a long message to Sys::Syslog native method.
2# The syslogd writes it into a file and through a pipe.
3# The syslogd passes it via TCP to the loghost.
4# The server receives the message on its TCP socket.
5# Find the message in client, file, syslogd, server log.
6# Check that 8192 bytes messages can be processed.
7
8use strict;
9use warnings;
10use Socket;
11use Sys::Hostname;
12use constant MAXLINE => 8192;
13
14(my $host = hostname()) =~ s/\..*//;
15my $time = "... .. ..:..:..";  # Oct 30 19:10:11
16# file entry is without <70> but with space, timestamp and hostname
17my $filelen = MAXLINE - 4 + length($time) + 1 + length($host) + 1;
18
19our %args = (
20    client => {
21	logsock => { type => "native" },
22	func => sub {
23	    my $self = shift;
24	    write_chars($self, MAXLINE);
25	    write_shutdown($self);
26	},
27	loggrep => { get_charlog() => 1 },
28    },
29    syslogd => {
30	loghost => '@tcp://localhost:$connectport',
31	loggrep => {
32	    qr/[gs]etsockopt bufsize/ => 0,
33	    get_charlog() => 1,
34	},
35    },
36    server => {
37	listen => { domain => AF_UNSPEC, proto => "tcp", addr => "localhost" },
38	# syslog over TCP appends a \n
39	loggrep => { qr/^>>> 8209 <70>$time .{8188}\n/ => 1 },
40    },
41    file => {
42	loggrep => { qr/^.{$filelen}\n/ => 1 },
43    },
44    pipe => { nocheck => 1 },
45    tty => { nocheck => 1 },
46);
47
481;
49