2006-12-07 00:25:32 +01: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
|
|
|
|
.\"
|
2014-12-14 20:45:30 +01:00
|
|
|
.TH LOGGER "1" "December 2014" "util-linux" "User Commands"
|
2011-09-17 22:09:37 +02:00
|
|
|
.SH NAME
|
2014-12-14 20:45:30 +01:00
|
|
|
logger \- enter messages into the system log
|
2011-09-17 22:09:37 +02:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.B logger
|
2014-12-14 20:45:29 +01:00
|
|
|
[options]
|
|
|
|
.RI [ message ]
|
2011-09-17 22:09:37 +02:00
|
|
|
.SH DESCRIPTION
|
|
|
|
.B logger
|
2014-12-14 20:45:30 +01:00
|
|
|
makes entries in the system log. It provides a shell-command
|
2011-09-17 22:09:37 +02:00
|
|
|
interface to the
|
|
|
|
.BR syslog (3)
|
2006-12-07 00:25:32 +01:00
|
|
|
system log module.
|
2014-12-14 20:45:30 +01:00
|
|
|
.sp
|
|
|
|
When the optional \fImessage\fR argument is present, it is written
|
|
|
|
to the log. If it is not present, and the \fB\-f\fR option is not
|
|
|
|
given either, then standard input is logged.
|
2011-09-17 22:09:37 +02:00
|
|
|
.SH OPTIONS
|
|
|
|
.TP
|
2014-12-14 20:45:30 +01:00
|
|
|
.BR \-d , " \-\-udp"
|
|
|
|
Use datagrams (UDP) only. By default the connection is tried to the
|
|
|
|
syslog port defined in /etc/services, which is often 514 .
|
2013-10-13 21:01:07 +02:00
|
|
|
.TP
|
2014-12-14 20:45:30 +01:00
|
|
|
.BR \-f , " \-\-file " \fIfile
|
|
|
|
Log the contents of the specified \fIfile\fR.
|
|
|
|
This option cannot be combined with a command-line message.
|
2013-10-13 21:01:07 +02:00
|
|
|
.TP
|
2014-12-14 20:45:30 +01:00
|
|
|
.BR \-i , " \-\-id" [ = \fIid ]
|
|
|
|
Log the PID of the logger process with each line. When the optional
|
|
|
|
argument \fIid\fR is specified, then it is used instead of the logger
|
|
|
|
command's PID. The use of \fB\-\-id=$$\fR
|
2014-08-20 12:24:40 +02:00
|
|
|
(PPID) is recommended in scripts that send several messages.
|
2013-10-13 21:01:07 +02:00
|
|
|
.TP
|
2014-12-14 20:45:30 +01:00
|
|
|
.BR \-\-journald [ =\fIfile ]
|
|
|
|
Write a systemd journal entry. The entry is read from the given \fIfile\fR,
|
|
|
|
when specified, otherwise from standard input.
|
|
|
|
Each line must begin with a field that is accepted by journald; see
|
|
|
|
.BR systemd.journal-fields (7)
|
|
|
|
for details. The use of a MESSAGE_ID field is generally a good idea, as it
|
|
|
|
makes finding entries easy. Examples:
|
|
|
|
.IP
|
|
|
|
.nf
|
|
|
|
\fB printf \(dq%s\\n%s\\n%s\\n\(dq MESSAGE_ID=42 DOGS=bark \(dqCARAVAN=goes on\(dq | logger --journald
|
|
|
|
\fB 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
|
|
|
|
.BR \-n , " \-\-server " \fIserver
|
|
|
|
Write to the specified remote syslog \fIserver\fR
|
2013-04-05 21:17:24 +01:00
|
|
|
instead of to the builtin syslog routines. Unless
|
2014-12-14 20:45:30 +01:00
|
|
|
\fB\-\-udp\fR or \fB\-\-tcp\fR
|
2013-10-13 12:54:58 +02:00
|
|
|
is specified, \fBlogger\fR will first try to use UDP,
|
|
|
|
but if thist fails a TCP connection is attempted.
|
2013-04-05 21:17:24 +01:00
|
|
|
.TP
|
2014-12-14 20:45:30 +01:00
|
|
|
.BR \-P , " \-\-port " \fIport
|
|
|
|
Use the specified \fIport\fR. When this option is not specified, the
|
|
|
|
port defaults to syslog for udp and to syslog-conn for tcp connections.
|
2011-09-17 22:09:37 +02:00
|
|
|
.TP
|
2014-12-14 20:45:30 +01:00
|
|
|
.BR \-p , " \-\-priority " \fIpriority
|
|
|
|
Enter the message into the log with the specified \fIpriority\fR.
|
2011-09-17 22:09:37 +02:00
|
|
|
The priority may be specified numerically or as a
|
2014-12-14 20:45:30 +01:00
|
|
|
.IR facility . level
|
2006-12-07 00:25:32 +01:00
|
|
|
pair.
|
2014-12-14 20:45:30 +01:00
|
|
|
For example, \fB\-p local3.info\fR
|
2011-09-17 22:09:37 +02:00
|
|
|
logs the message as informational in the local3 facility.
|
2014-12-14 20:45:30 +01:00
|
|
|
The default is \fBuser.notice\fR.
|
2011-09-17 22:09:37 +02:00
|
|
|
.TP
|
2014-12-14 20:45:30 +01:00
|
|
|
.B \-\-prio-prefix
|
2013-10-13 12:54:58 +02:00
|
|
|
Look for a syslog prefix on every line read from standard input.
|
2014-12-14 20:45:30 +01:00
|
|
|
This prefix is a decimal number within angle brackets that encodes both
|
|
|
|
the facility and the level. The number is constructed by multiplying the
|
|
|
|
facility by 8 and then adding the level. For example, \fBlocal0.info\fR,
|
|
|
|
meaning facility=16 and level=6, becomes \fB<134>\fR.
|
|
|
|
.sp
|
2013-05-22 13:12:08 +02:00
|
|
|
If the prefix contains no facility, the facility defaults to what is
|
2013-10-13 12:54:58 +02:00
|
|
|
specified by the \fB\-p\fR option. Similarly, if no prefix is provided,
|
2014-12-14 20:45:30 +01:00
|
|
|
the line is logged using the \fIpriority\fR given with \fB\-p\fR.
|
|
|
|
.sp
|
2013-05-22 13:12:08 +02:00
|
|
|
This option doesn't affect a command-line message.
|
2014-06-28 15:37:39 +01:00
|
|
|
.TP
|
2014-12-14 20:45:30 +01:00
|
|
|
.B \-\-rfc3164
|
|
|
|
Use the RFC 3164 BSD syslog protocol to submit messages to a remote server.
|
|
|
|
.TP
|
|
|
|
.BR \-\-rfc5424 [ =\fIwithout ]
|
|
|
|
Use the RFC 5424 syslog protocol to submit messages to a remote server.
|
|
|
|
The optional \fIwithout\fR argument can be a comma-separated list of
|
|
|
|
the following values: \fBnotq\fR, \fBnotime\fR, \fBnohost\fR.
|
|
|
|
The \fBnotq\fR value suppresses the time-quality structured data
|
|
|
|
from the submitted message. (The time-quality information shows whether
|
|
|
|
the local clock was syncronized plus the maximum number of microseconds
|
|
|
|
the timestamp might be off.) The \fBnotime\fR value (which implies
|
|
|
|
\fBnotq\fR) suppresses the complete sender timestamp that is in
|
|
|
|
ISO-8601 format, including microseconds and timezone.
|
|
|
|
The \fBnohost\fR value suppresses
|
|
|
|
.BR gethostname (2)
|
|
|
|
information from the message header.
|
2014-06-28 15:37:39 +01:00
|
|
|
.IP
|
|
|
|
The rfc5424 protocol has been default for
|
|
|
|
.B logger
|
|
|
|
since version 2.26.
|
2013-05-22 13:12:08 +02:00
|
|
|
.TP
|
2014-12-14 20:45:30 +01:00
|
|
|
.BR \-s , " \-\-stderr"
|
2013-10-13 21:01:07 +02:00
|
|
|
Output the message to standard error as well as to the system log.
|
|
|
|
.TP
|
2014-12-14 20:45:30 +01:00
|
|
|
.BR \-T , " \-\-tcp"
|
2013-10-13 21:01:07 +02:00
|
|
|
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
|
2014-12-14 20:45:30 +01:00
|
|
|
.BR \-t , " \-\-tag " \fItag
|
2013-10-13 21:01:07 +02:00
|
|
|
Mark every line to be logged with the specified
|
|
|
|
.IR tag .
|
|
|
|
.TP
|
2014-12-14 20:45:30 +01:00
|
|
|
.BR \-u , " \-\-socket " \fIsocket
|
2013-10-13 21:01:07 +02:00
|
|
|
Write to the specified
|
|
|
|
.I socket
|
|
|
|
instead of to the builtin syslog routines.
|
|
|
|
.TP
|
2014-12-14 20:45:30 +01:00
|
|
|
.B \-\-
|
|
|
|
End the argument list. This allows the \fImessage\fR
|
|
|
|
to start with a hyphen (\-).
|
2014-02-21 19:25:30 +00:00
|
|
|
.TP
|
2014-12-14 20:45:30 +01:00
|
|
|
.BR \-V , " \-\-version"
|
2011-08-15 14:25:44 +02:00
|
|
|
Display version information and exit.
|
2011-09-17 22:09:37 +02:00
|
|
|
.TP
|
2014-12-14 20:45:30 +01:00
|
|
|
.BR \-h , " \-\-help"
|
|
|
|
Display help text and exit.
|
2014-06-23 21:26:02 +01:00
|
|
|
.SH RETURN VALUE
|
2006-12-07 00:25:32 +01:00
|
|
|
The
|
2011-09-17 22:09:37 +02:00
|
|
|
.B logger
|
2006-12-07 00:25:32 +01:00
|
|
|
utility exits 0 on success, and >0 if an error occurs.
|
2014-06-23 21:26:02 +01:00
|
|
|
.SH FACILITIES AND LEVELS
|
2011-09-17 22:09:37 +02:00
|
|
|
Valid facility names are:
|
2014-06-23 21:26:02 +01:00
|
|
|
.IP
|
|
|
|
.TS
|
|
|
|
tab(:);
|
|
|
|
left l l.
|
2014-12-14 20:45:30 +01:00
|
|
|
\fBauth
|
|
|
|
\fBauthpriv\fR:for security information of a sensitive nature
|
|
|
|
\fBcron
|
|
|
|
\fBdaemon
|
|
|
|
\fBftp
|
|
|
|
\fBkern\fR:cannot be generated from user process
|
|
|
|
\fBlpr
|
|
|
|
\fBmail
|
|
|
|
\fBnews
|
|
|
|
\fBsyslog
|
|
|
|
\fBuser
|
|
|
|
\fBuucp
|
|
|
|
\fBlocal0
|
2014-06-23 21:26:02 +01:00
|
|
|
to:
|
2014-12-14 20:45:30 +01:00
|
|
|
\fBlocal7
|
|
|
|
\fBsecurity\fR:deprecated synonym for \fBauth
|
2014-06-23 21:26:02 +01:00
|
|
|
.TE
|
2011-09-17 22:09:37 +02:00
|
|
|
.PP
|
2011-08-15 14:25:44 +02:00
|
|
|
Valid level names are:
|
2014-06-23 21:26:02 +01:00
|
|
|
.IP
|
|
|
|
.TS
|
|
|
|
tab(:);
|
|
|
|
left l l.
|
2014-12-14 20:45:30 +01:00
|
|
|
\fBemerg
|
|
|
|
\fBalert
|
|
|
|
\fBcrit
|
|
|
|
\fBerr
|
|
|
|
\fBwarning
|
|
|
|
\fBnotice
|
|
|
|
\fBinfo
|
|
|
|
\fBdebug
|
|
|
|
\fBpanic\fR:deprecated synonym for \fBemerg
|
|
|
|
\fBerror\fR:deprecated synonym for \fBerr
|
|
|
|
\fBwarn\fR:deprecated synonym for \fBwarning
|
2014-06-23 21:26:02 +01:00
|
|
|
.TE
|
|
|
|
.PP
|
|
|
|
For the priority order and intended purposes of these facilities and levels, see
|
2011-09-17 22:09:37 +02:00
|
|
|
.BR syslog (3).
|
|
|
|
.SH EXAMPLES
|
2014-12-14 20:45:30 +01:00
|
|
|
.B logger System rebooted
|
2011-09-17 22:09:37 +02:00
|
|
|
.br
|
2014-12-14 20:45:30 +01:00
|
|
|
.B logger \-p local0.notice \-t HOSTIDM \-f /dev/idmc
|
2011-09-17 22:09:37 +02:00
|
|
|
.br
|
2014-12-14 20:45:30 +01:00
|
|
|
.B logger \-n loghost.example.com System rebooted
|
2011-09-17 22:09:37 +02:00
|
|
|
.SH SEE ALSO
|
|
|
|
.BR syslog (3),
|
2014-02-21 19:25:30 +00:00
|
|
|
.BR syslogd (8),
|
|
|
|
.BR journalctl (1),
|
|
|
|
.BR systemd.journal-fields (7)
|
2011-09-17 22:09:37 +02:00
|
|
|
.SH STANDARDS
|
2006-12-07 00:25:32 +01:00
|
|
|
The
|
2011-09-17 22:09:37 +02:00
|
|
|
.B logger
|
|
|
|
command is expected to be IEEE Std 1003.2 ("POSIX.2") compatible.
|
|
|
|
.SH AVAILABILITY
|
2010-11-30 11:41:59 +01:00
|
|
|
The logger command is part of the util-linux package and is available from
|
2011-09-17 22:09:37 +02:00
|
|
|
.UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
|
|
|
|
Linux Kernel Archive
|
|
|
|
.UE .
|