aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2017-02-10 16:52:16 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2017-02-10 17:10:58 +0200
commit8a916702efcd22685b02d7dd2760de8e55a2868b (patch)
tree3a6c172468f16096a236483f78df0221922bd40e
parentb90b1590c9f1575b2f8ca2da8e993661ea16abb3 (diff)
downloadsyslogck-8a916702efcd22685b02d7dd2760de8e55a2868b.tar.gz
syslogck-8a916702efcd22685b02d7dd2760de8e55a2868b.tar.bz2
Add documentation
-rw-r--r--syslogck124
1 files changed, 120 insertions, 4 deletions
diff --git a/syslogck b/syslogck
index 9a68544..808dadd 100644
--- a/syslogck
+++ b/syslogck
@@ -7,8 +7,6 @@ use Pod::Usage;
7use Pod::Man; 7use Pod::Man;
8use Getopt::Long qw(:config gnu_getopt no_ignore_case); 8use Getopt::Long qw(:config gnu_getopt no_ignore_case);
9 9
10use Data::Dumper;
11
12use constant { 10use constant {
13 EX_OK => 0, 11 EX_OK => 0,
14 EX_USAGE => 64, 12 EX_USAGE => 64,
@@ -19,8 +17,126 @@ use constant {
19 EX_NOPERM => 77 17 EX_NOPERM => 77
20}; 18};
21 19
20=head1 NAME
21
22syslogck - check if syslog properly delivers messages
23
24=head1 SYNOPSIS
25
26B<syslogck> [OPTIONS] [FILE...]
27
28=head1 DESCRIPTION
29
30Sends a test message via syslog and checks if it appears in the destination
31log file. By default, the message is sent via the B<user.notice> syslog
32facility. The log file is determined by analyzing the syslog configuration
33file. If several logs are configured to receive messages in the current
34priority, the first of them that is readable to the current user will be
35examined.
36
37By default, syslog configuration is read from file F</etc/syslog.conf>. This
38can be changed by supplying the name of the file in the command line. Multiple
39arguments are allowed.
40
41The configuration parser is very permissive. It selects only lines that
42can reliably be parsed as traditional syslog selector lines. This allows to
43use B<syslogck> with any flavor of syslog that allows for traditional
44configuration (e.g. B<rsyslogd>).
45
46On success (test message appeared in the log), B<syslogck> silently exits with
47code B<0>. If the message did not appear in the log within the time out period,
48the program prints a descriptive diagnostics on the standard error and exits
49with code 74 if the log file remained unmodified, or with code 65 if some
50messages did appear in it, but the test message didn't. Code 74 most often
51means that B<syslogd> is not running at all, whereas 65 indicates that it is
52misconfigured. See B<EXIT CODES> for the exhaustive list of exit codes.
53
54=head1 OPTIONS
55
56=over 4
57
58=item B<-h>
59
60Display a short option summary.
61
62=item B<--help>
63
64Display detailed manual.
65
66=item B<--usage>
67
68Display terse command line syntax summary.
69
70=item B<-d>, B<--debug>
71
72Print additional debugging information.
73
74=item B<-p>, B<--priority=>I<FACILITY>[B<.>I<PRIORITY>]
75
76Select the syslog facility and, optionally, priority to use. Default
77is B<user.notice>.
78
79=item B<-n>, B<--dry-run>
80
81Verbosely list what is being done (see B<-d>), but don't actually
82send the test message.
83
84=item B<-t>, B<--tag=>I<TAG>
85
86Set syslog tag.
87
88=item B<-T>, B<--timeout=>I<N>
89
90Wait I<N> seconds for the message to appear in the log file. Default is
9110.
92
93=back
94
95=head1 EXIT CODES
96
97=over 4
98
99=item 0
100
101Success. Syslog works properly.
102
103=item 64
104
105Command line usage error.
106
107=item 65
108
109Test message did not appear in the log file, but other messages did.
110This means that syslog is probably working, but misconfigured.
111
112=item 66
113
114Can't open the selected log file.
115
116=item 72
117
118No sutable log files found. Try another priority.
119
120=item 74
121
122Timed out while waiting for the message to appear in the log file. Most
123probably, syslog is not running.
124
125=item 77
126
127None of the selected log files is readable for the current user. Either
128select another priority (see B<-p>), or run B<syslogck> via B<sudo>.
129
130=back
131
132=head1 AUTHOR
133
134Sergey Poznyakoff, <gray@gnu.org>
135
136=cut
137
22my $progname = basename($0); 138my $progname = basename($0);
23my $progdescr = 'FIXME'; 139my $progdescr = 'check if syslog properly delivers messages';
24my $tag = $progname; 140my $tag = $progname;
25my $timeout = 10; 141my $timeout = 10;
26 142
@@ -203,7 +319,7 @@ if (@act) {
203 319
204exit EX_OK if $dry_run; 320exit EX_OK if $dry_run;
205 321
206abend(EX_OSFILE, "no files") unless @act; 322abend(EX_OSFILE, "no sutable files found (try another priority)") unless @act;
207 323
208my $file; 324my $file;
209while ($file = shift @act) { 325while ($file = shift @act) {

Return to:

Send suggestions and report system problems to the System administrator.