2019-10-13 18:14:51 +05:30
|
|
|
.\" -*- 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
|
2019-10-25 19:22:14 +05:30
|
|
|
.Op Fl r Ar SIZE:NUM
|
2019-10-13 18:14:51 +05:30
|
|
|
.Op Fl t Ar TAG
|
2019-10-25 19:22:14 +05:30
|
|
|
.Op Ar MESSAGE
|
2019-10-13 18:14:51 +05:30
|
|
|
.Sh DESCRIPTIOMN
|
|
|
|
.Nm
|
2019-10-29 13:38:37 +05:30
|
|
|
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, which is the
|
|
|
|
automatically log rotated. Without a
|
|
|
|
.Ar MESSAGE
|
|
|
|
argument
|
|
|
|
.Nm
|
|
|
|
reads input from
|
|
|
|
.Ar stdin .
|
2019-10-13 18:14:51 +05:30
|
|
|
.Sh OPTIONS
|
|
|
|
This program follows the usual UNIX command line syntax:
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Fl f Ar FILE
|
2019-10-25 19:22:14 +05:30
|
|
|
Log file to write messages to, instead of syslog daemon.
|
2019-10-29 13:38:37 +05:30
|
|
|
.Nm
|
|
|
|
accepts
|
|
|
|
.Fl f-
|
|
|
|
as an alias for
|
|
|
|
.Ar stdout .
|
2019-10-13 18:14:51 +05:30
|
|
|
.It Fl h
|
|
|
|
Show program help.
|
|
|
|
.It Fl p Ar PRIO
|
2019-10-25 19:22:14 +05:30
|
|
|
Priority, numeric or
|
2019-10-29 13:38:37 +05:30
|
|
|
.Ar facility.severity
|
2019-10-25 19:22:14 +05:30
|
|
|
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.
|
2019-10-13 18:14:51 +05:30
|
|
|
.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.
|
2019-10-25 19:22:14 +05:30
|
|
|
.It Ar MESSAGE
|
|
|
|
Log message to write. Remember to use single/double qoutes if calling
|
|
|
|
.Nm
|
2019-10-29 13:38:37 +05:30
|
|
|
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 syslog 3
|
|
|
|
call.
|
2019-10-13 18:14:51 +05:30
|
|
|
.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
|
2019-10-25 19:22:14 +05:30
|
|
|
.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
|
2019-10-13 18:14:51 +05:30
|
|
|
.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
|
2019-10-25 19:22:14 +05:30
|
|
|
command is expected to be IEEE Std 1003.2 ("POSIX.2") compatible, with
|
|
|
|
extensions for RFC5424 and log file rotation.
|
2019-10-13 18:14:51 +05:30
|
|
|
.Sh AVAILABILITY
|