1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
.\" SPDX-FileCopyrightText: Peter Pentchev
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.Dd February 8, 2013
.Dt STDSYSLOG 1
.Os
.Sh NAME
.Nm stdsyslog
.Nd log a program's output to the system log
.Sh SYNOPSIS
.Nm
.Op Fl d Ar fd:level
.Op Fl f Ar facility
.Op Fl p Ar pidfile
.Ar cmd
.Op Ar args...
.Nm
.Fl f Ar list
.Nm
.Fl l
.Nm
.Fl V | Fl h
.Sh DESCRIPTION
The
.Nm
utility executes a program, reads everything that it outputs to a set
of file descriptors (by default the standard output and standard error
streams) and logs it to the system log.
.Pp
The
.Nm
utility may be passed the following options:
.Pp
.Bl -tag -width indent
.It Fl d
Specify the level for messages on a file descriptor; may (and probably
should) be used more than once.
If no
.Fl d
options are specified,
.Nm
will assume
.Dq -d 1:info -d 2:err ,
i.e. log the program's standard output using the
.Dq info
level and the errors using the
.Dq err
one.
.It Fl f
Specify the syslog facility to use, or
.Dq list
for a list of the available values.
If not specified,
.Nm
will use the
.Dq daemon
facility.
.It Fl h
Display program usage information and exit.
.It Fl l
List the available syslog levels.
.It Fl p
Specify the file to write the child process ID to.
.It Fl V
Display program version information and exit.
.El
.Sh EXAMPLES
The following examples are shown as given to the shell.
.Pp
Log the string
.Dq information
to the
.Dq daemon:info
syslog facility:
.Pp
.Dl stdsyslog echo information
.Pp
Log the string
.Dq error
to the
.Dq local4:err
facility:
.Pp
.Dl stdsyslog -f local4 sh -c 'echo error 1>&2'
.Pp
Run the
.Dq sprog
program with two arguments,
.Dq some
and
.Dq args ,
store its process ID into the
.Pa sprog.pid
file and log the messages appearing on its standard output to
.Dq daemon:info
and the ones on its standard error stream to
.Dq daemon:crit :
.Pp
.Dl stdsyslog -p sprog.pid -d 1:info -d 2:crit sprog some args
.Sh SEE ALSO
.Xr logger 1 ,
.Xr syslog 3
.Sh TODO
Planned or at least possible enhancements:
.Pp
.Bl -tag -width *
.It *
Command-line flags to specify
.Xr openlog 3
options.
.It *
Command-line flags to specify patterns for text appearing on some
file descriptors for possibly logging with another priority, e.g.
lines appearing on the standard error stream starting with
.Dq DBG:
should be logged with the debug priority.
.El
|