2006-12-06 17:25:32 -06:00
|
|
|
.\" Copyright (c) 1983, 1990, 1993
|
|
|
|
.\" The Regents of the University of California. 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. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the University of
|
|
|
|
.\" California, Berkeley and its contributors.
|
|
|
|
.\" 4. 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.
|
|
|
|
.\"
|
|
|
|
.\" @(#)logger.1 8.1 (Berkeley) 6/6/93
|
|
|
|
.\"
|
2007-07-18 00:32:03 -05:00
|
|
|
.\" Section on valid facility and level strings added by
|
2006-12-06 17:25:41 -06:00
|
|
|
.\" and1000@debian.org, 26 Oct 1997.
|
2014-06-28 09:37:39 -05:00
|
|
|
.TH LOGGER "1" "June 2014" "util-linux" "User Commands"
|
2011-09-17 15:09:37 -05:00
|
|
|
.SH NAME
|
|
|
|
logger \- a shell command interface to the syslog(3) system log module
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.B logger
|
2013-10-13 05:54:58 -05:00
|
|
|
.RI [ options "] [" message ]
|
2011-09-17 15:09:37 -05:00
|
|
|
.SH DESCRIPTION
|
|
|
|
.B logger
|
|
|
|
makes entries in the system log. It provides a shell command
|
|
|
|
interface to the
|
|
|
|
.BR syslog (3)
|
2006-12-06 17:25:32 -06:00
|
|
|
system log module.
|
2011-09-17 15:09:37 -05:00
|
|
|
.SH OPTIONS
|
|
|
|
.TP
|
2013-10-13 14:01:07 -05:00
|
|
|
\fB\-d\fR, \fB\-\-udp\fR
|
|
|
|
Use datagram (UDP) only. By default the connection is tried to the
|
|
|
|
.I syslog
|
|
|
|
port defined in /etc/services, which is often
|
|
|
|
.IR 514 .
|
|
|
|
.TP
|
|
|
|
\fB\-h\fR, \fB\-\-help\fR
|
2013-10-14 14:34:39 -05:00
|
|
|
Display help text and exit.
|
2013-10-13 14:01:07 -05:00
|
|
|
.TP
|
|
|
|
\fB\-i\fR, \fB\-\-id\fR
|
|
|
|
Log the process ID of the logger process with each line.
|
|
|
|
.TP
|
|
|
|
.TP
|
2013-04-05 15:17:24 -05:00
|
|
|
\fB\-n\fR, \fB\-\-server\fR \fIserver\fR
|
|
|
|
Write to the specified remote syslog
|
|
|
|
.I server
|
|
|
|
instead of to the builtin syslog routines. Unless
|
|
|
|
.B \-\-udp
|
|
|
|
or
|
|
|
|
.B \-\-tcp
|
2013-10-13 05:54:58 -05:00
|
|
|
is specified, \fBlogger\fR will first try to use UDP,
|
|
|
|
but if thist fails a TCP connection is attempted.
|
2013-04-05 15:17:24 -05:00
|
|
|
.TP
|
|
|
|
\fB\-P\fR, \fB\-\-port\fR \fIport\fR
|
|
|
|
Use the specified
|
|
|
|
.IR port .
|
2014-07-16 14:07:04 -05:00
|
|
|
.TP
|
2011-09-17 15:09:37 -05:00
|
|
|
\fB\-f\fR, \fB\-\-file\fR \fIfile\fR
|
|
|
|
Log the contents of the specified
|
|
|
|
.IR file .
|
|
|
|
This option cannot be combined with a command-line message.
|
|
|
|
.TP
|
|
|
|
\fB\-p\fR, \fB\-\-priority\fR \fIpriority\fR
|
2011-08-15 07:25:44 -05:00
|
|
|
Enter the message into the log with the specified
|
2011-09-17 15:09:37 -05:00
|
|
|
.IR priority .
|
|
|
|
The priority may be specified numerically or as a
|
|
|
|
.I facility.level
|
2006-12-06 17:25:32 -06:00
|
|
|
pair.
|
2011-09-17 15:09:37 -05:00
|
|
|
For example,
|
|
|
|
.B -p
|
|
|
|
.I local3.info
|
|
|
|
logs the message as informational in the local3 facility.
|
|
|
|
The default is
|
|
|
|
.IR user.notice .
|
|
|
|
.TP
|
2013-05-22 06:12:08 -05:00
|
|
|
\fB\-\-prio\-prefix\fR
|
2013-10-13 05:54:58 -05:00
|
|
|
Look for a syslog prefix on every line read from standard input.
|
|
|
|
This prefix is a number within angle brackets that contains both the facility
|
|
|
|
and the level. This decimal prefix is constructed by multiplying the
|
|
|
|
facility by 8 and then adding the level. Thus, for example, \fIlocal0.info\fR,
|
2013-05-22 06:12:08 -05:00
|
|
|
facility=16 and level=6, becomes \fI<134>\fR.
|
|
|
|
|
|
|
|
If the prefix contains no facility, the facility defaults to what is
|
2013-10-13 05:54:58 -05:00
|
|
|
specified by the \fB\-p\fR option. Similarly, if no prefix is provided,
|
|
|
|
the line is logged using the \fB\-p\fR \fIpriority\fR.
|
2013-05-22 06:12:08 -05:00
|
|
|
|
|
|
|
This option doesn't affect a command-line message.
|
2014-06-28 09:37:39 -05:00
|
|
|
|
|
|
|
.TP
|
|
|
|
\fB\-\-rfc3164\fR
|
|
|
|
Use RFC 3164 BSD syslog protocol to submit messages to remote server.
|
|
|
|
.TP
|
|
|
|
\fB\-\-rfc5424\fR [\fInotime\fR,\fInotq\fR,\fInohost\fR]
|
|
|
|
Use RFC 5424 syslog protocol to submit messages to remote server.
|
|
|
|
Optional argument
|
|
|
|
.I notime
|
|
|
|
will supress submission of sender time stamp that is in ISO-8601 format,
|
|
|
|
including microseconds and timezone. When
|
|
|
|
.I notime
|
|
|
|
is specified the time quality structured data, that can be suppressed
|
|
|
|
separately with
|
|
|
|
.IR notq ,
|
|
|
|
is excluded from output. The time quality information tells if local
|
|
|
|
clock was syncronized, and maximum number of microseconds the time stamp
|
|
|
|
could be off. Option argument
|
|
|
|
.I nohost
|
|
|
|
will suppress
|
|
|
|
.IR gethostname (2)
|
|
|
|
information from message header.
|
|
|
|
.IP
|
|
|
|
The rfc5424 protocol has been default for
|
|
|
|
.B logger
|
|
|
|
since version 2.26.
|
2013-05-22 06:12:08 -05:00
|
|
|
.TP
|
2013-10-13 14:01:07 -05:00
|
|
|
\fB\-s\fR, \fB\-\-stderr\fR
|
|
|
|
Output the message to standard error as well as to the system log.
|
|
|
|
.TP
|
|
|
|
\fB\-T\fR, \fB\-\-tcp\fR
|
|
|
|
Use stream (TCP) only. By default the connection is tried to the
|
|
|
|
.I syslog-conn
|
|
|
|
port defined in /etc/services, which is often
|
|
|
|
.IR 601 .
|
|
|
|
.TP
|
|
|
|
\fB\-t\fR, \fB\-\-tag\fR \fItag\fR
|
|
|
|
Mark every line to be logged with the specified
|
|
|
|
.IR tag .
|
|
|
|
.TP
|
|
|
|
\fB\-u\fR, \fB\-\-socket\fR \fIsocket\fR
|
|
|
|
Write to the specified
|
|
|
|
.I socket
|
|
|
|
instead of to the builtin syslog routines.
|
|
|
|
.TP
|
2014-02-21 13:25:30 -06:00
|
|
|
\fB\-\-journald\fR [\fIfile\fR]
|
|
|
|
Write systemd journal entry. The entry is read from
|
|
|
|
.I stdin
|
|
|
|
or input
|
|
|
|
.IR file .
|
|
|
|
Each new line must begin with a field that is accepted by journald, see
|
|
|
|
.IR systemd.journal-fields (7)
|
|
|
|
for details. Use of MESSAGE_ID field is generally good idea, as they
|
|
|
|
make finding entries easy.
|
|
|
|
.IP
|
|
|
|
.nf
|
|
|
|
$ printf "%s\\n%s\\n%s\\n" MESSAGE_ID=86184c3b1aa444f58ebe7b30fec1438b DOGS=bark "CARAVAN=goes on" | logger --journald
|
|
|
|
$ logger --journald=entry.txt
|
|
|
|
.fi
|
|
|
|
.IP
|
|
|
|
Notice that
|
|
|
|
.B \-\-journald
|
|
|
|
will ignore values of other options, such as priority. If priority is
|
|
|
|
needed it must be within input, and use PRIORITY field. The simple
|
|
|
|
execution of
|
|
|
|
.B journalctl
|
|
|
|
will display MESSAGE field. Use
|
|
|
|
.B journalctl --output json-pretty
|
|
|
|
to see rest of the fields.
|
|
|
|
.TP
|
2011-09-17 15:09:37 -05:00
|
|
|
\fB\-V\fR, \fB\-\-version\fR
|
2011-08-15 07:25:44 -05:00
|
|
|
Display version information and exit.
|
2011-09-17 15:09:37 -05:00
|
|
|
.TP
|
|
|
|
\fB\-\-\fR
|
|
|
|
End the argument list. This is to allow the
|
|
|
|
.I message
|
2006-12-06 17:25:44 -06:00
|
|
|
to start with a hyphen (\-).
|
2011-09-17 15:09:37 -05:00
|
|
|
.TP
|
|
|
|
.I message
|
2013-10-13 05:54:58 -05:00
|
|
|
Write this \fImessage\fR to the log; if not specified, and the
|
|
|
|
.B \-f
|
2011-09-17 15:09:37 -05:00
|
|
|
flag is not provided, standard input is logged.
|
2014-06-23 15:26:02 -05:00
|
|
|
.SH RETURN VALUE
|
2006-12-06 17:25:32 -06:00
|
|
|
The
|
2011-09-17 15:09:37 -05:00
|
|
|
.B logger
|
2006-12-06 17:25:32 -06:00
|
|
|
utility exits 0 on success, and >0 if an error occurs.
|
2014-06-23 15:26:02 -05:00
|
|
|
.SH FACILITIES AND LEVELS
|
2011-09-17 15:09:37 -05:00
|
|
|
Valid facility names are:
|
2014-06-23 15:26:02 -05:00
|
|
|
.IP
|
|
|
|
.TS
|
|
|
|
tab(:);
|
|
|
|
left l l.
|
|
|
|
\fIauth\fR
|
|
|
|
\fIauthpriv\fR:for security information of a sensitive nature
|
|
|
|
\fIcron\fR
|
|
|
|
\fIdaemon\fR
|
|
|
|
\fIftp\fR
|
|
|
|
\fIkern\fR:cannot be generated from user process
|
|
|
|
\fIlpr\fR
|
|
|
|
\fImail\fR
|
|
|
|
\fInews\fR
|
|
|
|
\fIsyslog\fR
|
|
|
|
\fIuser\fR
|
|
|
|
\fIuucp\fR
|
|
|
|
\fIlocal0\fR
|
|
|
|
to:
|
|
|
|
\fIlocal7\fR
|
|
|
|
\fIsecurity\fR:deprecated synonym for \fIauth\fR
|
|
|
|
.TE
|
2011-09-17 15:09:37 -05:00
|
|
|
.PP
|
2011-08-15 07:25:44 -05:00
|
|
|
Valid level names are:
|
2014-06-23 15:26:02 -05:00
|
|
|
.IP
|
|
|
|
.TS
|
|
|
|
tab(:);
|
|
|
|
left l l.
|
|
|
|
\fIemerg\fR
|
|
|
|
\fIalert\fR
|
|
|
|
\fIcrit\fR
|
|
|
|
\fIerr\fR
|
|
|
|
\fIwarning\fR
|
|
|
|
\fInotice\fR
|
|
|
|
\fIinfo\fR
|
|
|
|
\fIdebug\fR
|
|
|
|
\fIpanic\fR:deprecated synonym for \fIemerg\fR
|
|
|
|
\fIerror\fR:deprecated synonym for \fIerr\fR
|
|
|
|
\fIwarn\fR:deprecated synonym for \fIwarning\fR
|
|
|
|
.TE
|
|
|
|
.PP
|
|
|
|
For the priority order and intended purposes of these facilities and levels, see
|
2011-09-17 15:09:37 -05:00
|
|
|
.BR syslog (3).
|
|
|
|
.SH EXAMPLES
|
2006-12-06 17:25:32 -06:00
|
|
|
logger System rebooted
|
2011-09-17 15:09:37 -05:00
|
|
|
.br
|
2006-12-06 17:25:32 -06:00
|
|
|
logger \-p local0.notice \-t HOSTIDM \-f /dev/idmc
|
2011-09-17 15:09:37 -05:00
|
|
|
.br
|
2011-01-28 07:15:20 -06:00
|
|
|
logger \-n loghost.example.com System rebooted
|
2011-09-17 15:09:37 -05:00
|
|
|
.SH SEE ALSO
|
|
|
|
.BR syslog (3),
|
2014-02-21 13:25:30 -06:00
|
|
|
.BR syslogd (8),
|
|
|
|
.BR journalctl (1),
|
|
|
|
.BR systemd.journal-fields (7)
|
2011-09-17 15:09:37 -05:00
|
|
|
.SH STANDARDS
|
2006-12-06 17:25:32 -06:00
|
|
|
The
|
2011-09-17 15:09:37 -05:00
|
|
|
.B logger
|
|
|
|
command is expected to be IEEE Std 1003.2 ("POSIX.2") compatible.
|
|
|
|
.SH AVAILABILITY
|
2010-11-30 04:41:59 -06:00
|
|
|
The logger command is part of the util-linux package and is available from
|
2011-09-17 15:09:37 -05:00
|
|
|
.UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
|
|
|
|
Linux Kernel Archive
|
|
|
|
.UE .
|