7abb1b9137
Also, by convention .Dt should always be in upper case. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
174 lines
5.0 KiB
Groff
174 lines
5.0 KiB
Groff
.\" -*- 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 Dec 7, 2019
|
|
.Dt LOGGER 1
|
|
.Os sysklogd v2.1
|
|
.Sh NAME
|
|
.Nm logger
|
|
.Nd Send messages to system log, or a log file
|
|
.Sh SYNOPSIS
|
|
.Nm
|
|
.Op Fl chinsv
|
|
.Op Fl d Ar SD
|
|
.Op Fl f Ar FILE
|
|
.Op Fl m Ar MSGID
|
|
.Op Fl p Ar PRIO
|
|
.Op Fl r Ar SIZE:NUM
|
|
.Op Fl t Ar TAG
|
|
.Op Fl u Ar SOCK
|
|
.Op Ar MESSAGE
|
|
.Sh DESCRIPTIOMN
|
|
.Nm
|
|
can be used to log messages to the system log daemon from a UNIX shell,
|
|
or script. Optionally a stand-alone log file can be used, in which case
|
|
the
|
|
.Xr syslogp 3
|
|
API is still used but
|
|
.Nm syslogd
|
|
is bypassed. This log file can also be automatically log rotated.
|
|
.Pp
|
|
Without a
|
|
.Ar MESSAGE
|
|
argument
|
|
.Nm
|
|
reads input from
|
|
.Ar stdin .
|
|
.Sh OPTIONS
|
|
This program follows the usual UNIX command line syntax:
|
|
.Bl -tag -width Ds
|
|
.It Fl c
|
|
Log to console
|
|
.Ql ( LOG_CONS )
|
|
if
|
|
.Fn syslog
|
|
fails to send message to
|
|
.Xr syslogd 8 .
|
|
.It Fl d Ar SD
|
|
Log this in the structured data (SD) field of an RFC5424 style log
|
|
message. See
|
|
.Fl m
|
|
for caveats. Also, please note that
|
|
.Ar sd
|
|
has to be passed as one argument and will require careful quoting when
|
|
used from the shell.
|
|
.It Fl f Ar FILE
|
|
Log file to write messages to, instead of syslog daemon.
|
|
.Nm
|
|
accepts
|
|
.Fl f-
|
|
as an alias for
|
|
.Ar stdout .
|
|
.It Fl i
|
|
Log the process id of the logger process with each line
|
|
.Ql ( LOG_PID ) .
|
|
.It Fl m Ar MSGID
|
|
The MSGID used for the message. Requires RFC5424 support in
|
|
.Xr syslogd 8
|
|
for receiving the message and also for storing it properly in a log file
|
|
or sending remote in correctly formatted RFC5424 style.
|
|
.It Fl n
|
|
Open log file immediately
|
|
.Ql ( LOG_NDELAY ) .
|
|
.It Fl p Ar PRIO
|
|
Priority, numeric or
|
|
.Ar facility.severity
|
|
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 u Ar SOCK
|
|
Log to UNIX domain socket
|
|
.Ar SOCK
|
|
instead of the default
|
|
.Pa /dev/log .
|
|
.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. If no message is
|
|
given
|
|
.Nm
|
|
will read from
|
|
.Ar stdin
|
|
until EOF. In this mode every new row (newline separated) is converted
|
|
into an independent
|
|
.Xr syslogp 3
|
|
call.
|
|
.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 /dev/log -compact
|
|
.It Ar FILE
|
|
If a custom log file is selected, using
|
|
.Fl f Ar FILE ,
|
|
then this file is opened and written to by
|
|
.Nm .
|
|
When log file rotation is enabled, using
|
|
.Fl r Ar SIZE:NUM ,
|
|
.Nm
|
|
creates
|
|
.Pa FILE.1 FILE.2 FILE.3.gz
|
|
etc.
|
|
.It Pa /dev/log
|
|
Socket used for communicating with
|
|
.Xr syslogd 8 .
|
|
When built on BSD
|
|
.Pa /var/run/log
|
|
is used.
|
|
.El
|
|
.Sh SEE ALSO
|
|
.Xr syslogp 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 from NetBSD and custom log file and log file
|
|
rotation unique to the sysklogd project.
|