.\" 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 .\" .TH LOGGER "1" "March 2015" "util-linux" "User Commands" .SH NAME logger \- enter messages into the system log .SH SYNOPSIS .B logger [options] .RI [ message ] .SH DESCRIPTION .B logger makes entries in the system log. .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. .SH OPTIONS .TP .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 . .TP .BR \-e , " \-\-skip-empty" When processing files, empty lines will be ignored. An empty line is defined to be a line without any characters. Thus a line consisting only of whitespace is NOT considered empty. Note that when the \fR\-\-prio\-prefix\fR option is specified, the priority is not part of the line. Thus an empty line in this mode is a line that does not have any characters after the priority (e.g. "<13>"). .TP .BR \-f , " \-\-file " \fIfile Log the contents of the specified \fIfile\fR. This option cannot be combined with a command-line message. .TP .B \-i Log the PID of the logger process with each line. .TP .BR "\-\-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 (PPID) is recommended in scripts that send several messages. .TP .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 logger --journald <\fR. .sp If the prefix contains no facility, the facility defaults to what is specified by the \fB\-p\fR option. Similarly, if no prefix is provided, the line is logged using the \fIpriority\fR given with \fB\-p\fR. .sp This option doesn't affect a command-line message. .TP .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 synchronized 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. .IP The RFC 5424 protocol has been the default for .B logger since version 2.26. .TP .B \-\-octet\-count Use the RFC 6587 octet counting framing method for sending messages. When this option is not used, the default is no framing on UDP, and RFC6587 non-transparent-framing (also known as octet stuffing) on TCP. .TP .BR \-s , " \-\-stderr" Output the message to standard error as well as to the system log. .TP .BR \-T , " \-\-tcp" 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 .BR \-t , " \-\-tag " \fItag Mark every line to be logged with the specified .IR tag . .TP .BR \-u , " \-\-socket " \fIsocket Write to the specified .I socket instead of to the system log socket. .TP .BR \-\-socket\-errors [ =\fImode ] Print errors about Unix socket connections. The \fImode\fR can be a value of \fBoff\fR, \fBon\fR, or \fBauto\fR. When the mode is auto logger will detect if the init process is systemd, and if so assumption is made /dev/log can be used early at boot. Other init systems lack of /dev/log will not cause errors that is identical with messaging using .BR openlog (3) system call. The .BR logger (1) before version 2.26 used openlog, and hence was inable to detected loss of messages sent to Unix sockets. .IP The default mode is \fBauto\fR. When errors are not enabled lost messages are not communicated and will result to successful return value of .BR logger (1) invocation. .TP .B \-\- End the argument list. This allows the \fImessage\fR to start with a hyphen (\-). .TP .BR \-V , " \-\-version" Display version information and exit. .TP .BR \-h , " \-\-help" Display help text and exit. .SH RETURN VALUE The .B logger utility exits 0 on success, and >0 if an error occurs. .SH FACILITIES AND LEVELS Valid facility names are: .IP .TS tab(:); left l l. \fBauth \fBauthpriv\fR:for security information of a sensitive nature \fBcron \fBdaemon \fBftp \fBkern\fR:cannot be generated from userspace process, automatically converted to \fBuser \fBlpr \fBmail \fBnews \fBsyslog \fBuser \fBuucp \fBlocal0 to: \fBlocal7 \fBsecurity\fR:deprecated synonym for \fBauth .TE .PP Valid level names are: .IP .TS tab(:); left l l. \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 .TE .PP For the priority order and intended purposes of these facilities and levels, see .BR syslog (3). .SH EXAMPLES .B logger System rebooted .br .B logger \-p local0.notice \-t HOSTIDM \-f /dev/idmc .br .B logger \-n loghost.example.com System rebooted .SH SEE ALSO .BR syslog (3), .BR journalctl (1), .BR systemd.journal-fields (7) .SH STANDARDS The .B logger command is expected to be IEEE Std 1003.2 ("POSIX.2") compatible. .SH AVAILABILITY The logger command is part of the util-linux package and is available from .UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/ Linux Kernel Archive .UE .