diff options
author | Gerrit Pape <pape@smarden.org> | 2003-04-20 17:38:31 +0000 |
---|---|---|
committer | Gerrit Pape <pape@smarden.org> | 2003-04-20 17:38:31 +0000 |
commit | 2d38321535899875468655e4a8fa72caae812180 (patch) | |
tree | 5316783d0a3dc0b58f36767e2dae402f7e93e890 /man | |
parent | 384fbcb0a8fb3b3bb588c5ad5ba4a3309da3ed25 (diff) | |
download | runit-2d38321535899875468655e4a8fa72caae812180.tar.gz runit-2d38321535899875468655e4a8fa72caae812180.tar.xz runit-2d38321535899875468655e4a8fa72caae812180.zip |
* svlogd.c: new; runit's service logging daemon.
* fmt_ptime.h, fmt_ptime.c, pmatch.h, pmatch.c: new. * man/svlogd.8, doc/svlogd.8.html: new. * man/runsv.8, man/runsvstat.8, man/utmpset.8: minor cleanup.
Diffstat (limited to 'man')
-rw-r--r-- | man/runsv.8 | 6 | ||||
-rw-r--r-- | man/runsvstat.8 | 2 | ||||
-rw-r--r-- | man/svlogd.8 | 295 | ||||
-rw-r--r-- | man/utmpset.8 | 2 |
4 files changed, 300 insertions, 5 deletions
diff --git a/man/runsv.8 b/man/runsv.8 index ef68788..67acb93 100644 --- a/man/runsv.8 +++ b/man/runsv.8 @@ -125,13 +125,13 @@ This command is ignored if it is given to .IR service /log/supervise/control. .P For example, to send a TERM signal to /service/socklog-unix, either do - # svc -t /service/socklog-unix + # svc \-t /service/socklog-unix or - # echo -n t >/service/socklog-unix/supervise/control + # echo \-n t >/service/socklog-unix/supervise/control .P If .BR echo (1) -on your systems does not provide the -n option, leave it out, +on your systems does not provide the \-n option, leave it out, .B runsv ignores unknown characters written to the control pipe. .BR echo (1) diff --git a/man/runsvstat.8 b/man/runsvstat.8 index 8491826..cd995ef 100644 --- a/man/runsvstat.8 +++ b/man/runsvstat.8 @@ -27,7 +27,7 @@ of the corresponding .IR service . .SH OPTIONS .TP -.B -l +.B \-l log service. Check for each .I service if there exists a corresponding diff --git a/man/svlogd.8 b/man/svlogd.8 new file mode 100644 index 0000000..ffaf090 --- /dev/null +++ b/man/svlogd.8 @@ -0,0 +1,295 @@ +.TH svlogd 8 +.SH NAME +svlogd \- runit's service logging daemon +.SH SYNOPSIS +.B svlogd +[\-tv] [\-r +.I c\fR] [\-R +.I abc\fR] [\-l +.I n\fR] [\-b +.I n\fR] +.I logs +.SH DESCRIPTION +.I logs +consists of one or more arguments, each specifying a directory. +.P +.B svlogd +continuously reads log data from its standard input, optionally filters log +messages, and writes the data to one or more automatically rotated +.IR logs . +.P +Recent log files can automatically be processed by an arbitrary processor +program when they are rotated, and +.B svlogd +can be told to alert selected log messages to standard error. +.P +.B svlogd +runs until it sees end-of-file on standard input or is sent a TERM signal, +see below. + +.SS LOG DIRECTORY +A log directory +.I log +contains some number of old log files, and the current log file +.IR current . +Old log files have a file name starting with +.I @ +followed by a precise timestamp (see +.BR tai64n (8)), +indicating when +.I current +was rotated and renamed to this file. +.P +A log directory additionally contains the lock file +.IR lock , +maybe +.I state +and +.IR newstate , +and optionally the file +.IR config . +.B svlogd +creates necessary files if they don't exist. +.SS LOG FILE ROTATION +.B svlogd +appends selected log messages to the +.I current +log file. +If +.I current +has +.I size +bytes or more size (or there is a new-line withing the last +.I len +of +.I size +bytes) +.I current +is rotated: +.P +.B svlogd +closes +.IR current , +changes permission of +.I current +to 0755, renames +.I current +to +.RI @ timestamp\fR.s, +and starts with a new empty +.IR current . +If +.B svlogd +sees +.I num +or more old log files in +.IR dir , +it removes the oldest. +.SS PROCESSOR +If +.B svlogd +is told to process recent log files, it saves +.I current +to +.RI @ timestamp\fR.u, +feeds +.RI @ timestamp\fR.u +through ``sh \-c "\fIprocessor\fR"'' +and writes the output to +.RI @ timestamp\fR.t. +If the +.I processor +finishes successfully, +.RI @ timestamp\fR.u +is deleted and +.RI @ timestamp\fR.t +is renamed to +.RI @ timestamp\fR.s, +otherwise +.RI @ timestamp\fR.t +is deleted and the +.I processor +is started again. +.B svlogd +also saves any output that the +.I processor +writes to filedescriptor 5, and make that output available on +filedescriptor 4 when it runs +.I processor +on the next log file rotation. +.P +A +.I processor +is run in the background. +If +.B svlogd +sees a previously started +.I processor +still running when trying to start a new one for the same +.IR log , +it blocks until the currently running +.I processor +has finished successfully. +Only the HUP signal works in that situation. +Note that this may block any program feeding its log data to +.BR svlogd. + +.SS CONFIG +On startup, and after receiving a HUP signal, +.B svlogd +checks for each +.I log +if the configuration file +.I log/config +exists, and if so, reads the file line by line and adjusts configuration for +.I log +as follows: +.P +If the line is empty, less than two characters long, or starts with a ``#'', +it is ignored. +A line of the form +.TP +.RI s size +sets the maximum file size of +.I current +when +.B svlogd +should rotate the current log file to +.I size +bytes. +Default is 1000000. +.TP +.RI n num +sets the maximum number of old log files +.B svlogd +should maintain to +.IR num . +If +.B svlogd +sees more that +.I num +old log files in +.I log +after log file rotation, it deletes the oldest one. +Default is 10. +.TP +.RI ! processor +tells +.B svlogd +to feed each recent log file through +.I processor +(see above) on log file rotation. +By default log files are not processed. +.P +If a line starts with a +.IR \- , +.IR + , +.IR e , +or +.IR E , +.B svlogd +matches the first +.I len +characters of each log message against +.I pattern +and acts accordingly: +.TP +.RI \- pattern +the log message is deselected. +.TP +.RI + pattern +the log message is selected +.TP +.RI e pattern +log messages matching +.I pattern +are printed to standard error. +.TP +.RI E pattern +log messages not matching +.I pattern +are printed to standard error. +.P +Initially each line is selected. +Deselected log messages are discarded from +.IR log . +.SH OPTIONS +.TP +.B \-t +timestamp. +Prefix each selected line with a precise timestamp (see +.BR tai64n (8)) +when writing to +.I log +or to standard error. +.TP +.B \-r \fIc +replace. +.I c +must be a single character. +Replace non-printable characters in log messages with +.IR c . +Character are replaced before pattern matching is applied. +.TP +.B \-R \fIabc +replace characters. +Additionally to non-printable characters, replace all characters found in +.I abc +with +.I c +(default ``_''). +.TP +.B \-l \fIlen +line length. +Pattern matching applies to the first +.I len +characters of a log message only. +Default is 1000. +.TP +.B \-b \fIbuflen +buffer size. +Set the size of the buffer +.B svlogd +uses when reading from standard input and writing to +.I logs +to +.IR buflen . +Default is 1024. +.I buflen +must be greater than +.IR len . +.SH SIGNALS +If +.B svlogd +is sent a HUP signal, it closes and reopens all +.IR logs , +and updates their configuration according to +.IR log/config . +.P +If +.B svlogd +is sent a TERM signal, or if it sees end-of-file on standard input, it +closes standard input, waits for all +.I processor +subprocesses to finish if any, and exits 0 as soon as possible. +.P +If +.B svlogd +is sent an ALRM signal, it tries for all +.I logs +to rotate the current log file, if it is not empty. +.SH SEE ALSO +runsvstat(8), +runit(8), +runit-init(8), +runsv(8), +runsvstat(8), +runsvctrl(8), +runsvdir(8), +runsvchdir(8), +svwaitdown(8), +svwaitup(8) +.P +http://smarden.org/runit/ +.SH AUTHOR +Gerrit Pape <pape@smarden.org> diff --git a/man/utmpset.8 b/man/utmpset.8 index 4cd424e..f6a9d6e 100644 --- a/man/utmpset.8 +++ b/man/utmpset.8 @@ -33,7 +33,7 @@ to the run scripts, e.g.: .P #!/bin/sh - /command/utmpset -w tty5 + /command/utmpset \-w tty5 exec /sbin/getty 38400 tty5 linux .SH OPTIONS .TP |