sysklogd/man/logger.1

120 lines
3.8 KiB
Groff
Raw Normal View History

.\" -*- nroff -*-
.\" Copyright (c) 2018, 2019 Joachim Nilsson <troglobit@gmail.com>
.\" 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.
.\" 3. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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 Oct 13, 2019
.Dt logger 1
.Os "sysklogd (2.0)"
.Sh NAME
.Nm logger
.Nd Send messages to system log, or a log file
.Sh SYNOPSIS
.Nm
.Op Fl hsv
.Op Fl f Ar FILE
.Op Fl p Ar PRIO
.Op Fl r Ar SIZE:NUM
.Op Fl t Ar TAG
.Op Ar MESSAGE
.Sh DESCRIPTIOMN
.Nm
can be used to send messages to the system log from a UNIX shell, or
script.
.Sh OPTIONS
This program follows the usual UNIX command line syntax:
.Bl -tag -width Ds
.It Fl f Ar FILE
Log file to write messages to, instead of syslog daemon.
.It Fl h
Show program help.
.It Fl p Ar PRIO
Priority, numeric or
.Ar facility.level
pair.
.It Fl r Ar SIZE:NUM
Controls log file rotation.
.Ar SIZE
denotes number of bytes before rotating, default: 200 kB.
.Ar NUM
denotes number of rotated files to keep when logging to a file, default:
5.
.It Fl s
Log to stderr as well as the system log.
.It Fl t Ar TAG
Log using the specified tag, default: username.
.It Fl v
Show program version.
.It Ar MESSAGE
Log message to write. Remember to use single/double qoutes if calling
.Nm
from a shell prompt due to expansion the shell does.
.El
.Sh EXAMPLES
.Bd -unfilled -offset left
logger -t dropbear -p auth.notice "Successful login for user 'admin' from 1.2.3.4"
logger -t udhcpc -f /tmp/script.log "New lease 1.2.3.200 obtained for interface eth0"
.Ed
.Sh FILES
.Bl -tag -width /var/run/log -compact
.It Ar FILE
If a log file is enabled, using
.Fl f Ar FILE ,
then this file is opened and written to by
.Nm .
With log file rotation,
.Fl r Ar SIZE:NUM ,
this means
.Nm
also creates
.Pa FILE.1 FILE.2 FILE.3.gz
etc.
.It Pa /var/run/log
Socket to connect to for communicating with
.Xr syslogd 8 .
In older implementations
.Pa /dev/log
was used. This means this version of
.Nm
is not compatible with older releases, or other (local) syslog servers.
.El
.Sh SEE ALSO
.Xr syslog 3
.Xr syslogd 8
.Sh AUTHORS
.Nm
was originally written by Joachim Nilsson to be a part of the
.Xr finit 1
system monitor (PID 1), where it is called
.Nm logit .
It is included here to complement
.Xr syslogd 8
and be extended upon in the sysklogd project.
.Sh STANDARDS
The
.Nm
command is expected to be IEEE Std 1003.2 ("POSIX.2") compatible, with
extensions for RFC5424 and log file rotation.
.Sh AVAILABILITY