.\" Copyright (c) 2013 Peter Pentchev .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .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:err : .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