1 .\" Copyright (c) 1983, 1990, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)logger.1 8.1 (Berkeley) 6/6/93
34 .TH LOGGER "1" "December 2014" "util-linux" "User Commands"
36 logger \- enter messages into the system log
43 makes entries in the system log. It provides a shell-command
48 When the optional \fImessage\fR argument is present, it is written
49 to the log. If it is not present, and the \fB\-f\fR option is not
50 given either, then standard input is logged.
54 Use datagrams (UDP) only. By default the connection is tried to the
55 syslog port defined in /etc/services, which is often 514 .
57 .BR \-f , " \-\-file " \fIfile
58 Log the contents of the specified \fIfile\fR.
59 This option cannot be combined with a command-line message.
61 .BR \-i , " \-\-id" [ = \fIid ]
62 Log the PID of the logger process with each line. When the optional
63 argument \fIid\fR is specified, then it is used instead of the logger
64 command's PID. The use of \fB\-\-id=$$\fR
65 (PPID) is recommended in scripts that send several messages.
67 .BR \-\-journald [ =\fIfile ]
68 Write a systemd journal entry. The entry is read from the given \fIfile\fR,
69 when specified, otherwise from standard input.
70 Each line must begin with a field that is accepted by journald; see
71 .BR systemd.journal-fields (7)
72 for details. The use of a MESSAGE_ID field is generally a good idea, as it
73 makes finding entries easy. Examples:
76 \fB printf \(dq%s\\n%s\\n%s\\n\(dq MESSAGE_ID=42 DOGS=bark \(dqCARAVAN=goes on\(dq | logger --journald
77 \fB logger --journald=entry.txt
82 will ignore values of other options, such as priority. If priority is
83 needed it must be within input, and use PRIORITY field. The simple
86 will display MESSAGE field. Use
87 .B journalctl --output json-pretty
88 to see rest of the fields.
91 .BR \-n , " \-\-server " \fIserver
92 Write to the specified remote syslog \fIserver\fR
93 instead of to the builtin syslog routines. Unless
94 \fB\-\-udp\fR or \fB\-\-tcp\fR
95 is specified, \fBlogger\fR will first try to use UDP,
96 but if thist fails a TCP connection is attempted.
98 .BR \-P , " \-\-port " \fIport
99 Use the specified \fIport\fR. When this option is not specified, the
100 port defaults to syslog for udp and to syslog-conn for tcp connections.
102 .BR \-p , " \-\-priority " \fIpriority
103 Enter the message into the log with the specified \fIpriority\fR.
104 The priority may be specified numerically or as a
107 For example, \fB\-p local3.info\fR
108 logs the message as informational in the local3 facility.
109 The default is \fBuser.notice\fR.
112 Look for a syslog prefix on every line read from standard input.
113 This prefix is a decimal number within angle brackets that encodes both
114 the facility and the level. The number is constructed by multiplying the
115 facility by 8 and then adding the level. For example, \fBlocal0.info\fR,
116 meaning facility=16 and level=6, becomes \fB<134>\fR.
118 If the prefix contains no facility, the facility defaults to what is
119 specified by the \fB\-p\fR option. Similarly, if no prefix is provided,
120 the line is logged using the \fIpriority\fR given with \fB\-p\fR.
122 This option doesn't affect a command-line message.
125 Use the RFC 3164 BSD syslog protocol to submit messages to a remote server.
127 .BR \-\-rfc5424 [ =\fIwithout ]
128 Use the RFC 5424 syslog protocol to submit messages to a remote server.
129 The optional \fIwithout\fR argument can be a comma-separated list of
130 the following values: \fBnotq\fR, \fBnotime\fR, \fBnohost\fR.
131 The \fBnotq\fR value suppresses the time-quality structured data
132 from the submitted message. (The time-quality information shows whether
133 the local clock was synchronized plus the maximum number of microseconds
134 the timestamp might be off.) The \fBnotime\fR value (which implies
135 \fBnotq\fR) suppresses the complete sender timestamp that is in
136 ISO-8601 format, including microseconds and timezone.
137 The \fBnohost\fR value suppresses
139 information from the message header.
141 The RFC 5424 protocol has been the default for
145 .BR \-s , " \-\-stderr"
146 Output the message to standard error as well as to the system log.
149 Use stream (TCP) only. By default the connection is tried to the
151 port defined in /etc/services, which is often
154 .BR \-t , " \-\-tag " \fItag
155 Mark every line to be logged with the specified
158 .BR \-u , " \-\-socket " \fIsocket
159 Write to the specified
161 instead of to the builtin syslog routines.
164 End the argument list. This allows the \fImessage\fR
165 to start with a hyphen (\-).
167 .BR \-V , " \-\-version"
168 Display version information and exit.
170 .BR \-h , " \-\-help"
171 Display help text and exit.
175 utility exits 0 on success, and >0 if an error occurs.
176 .SH FACILITIES AND LEVELS
177 Valid facility names are:
183 \fBauthpriv\fR:for security information of a sensitive nature
187 \fBkern\fR:cannot be generated from user process
197 \fBsecurity\fR:deprecated synonym for \fBauth
200 Valid level names are:
213 \fBpanic\fR:deprecated synonym for \fBemerg
214 \fBerror\fR:deprecated synonym for \fBerr
215 \fBwarn\fR:deprecated synonym for \fBwarning
218 For the priority order and intended purposes of these facilities and levels, see
221 .B logger System rebooted
223 .B logger \-p local0.notice \-t HOSTIDM \-f /dev/idmc
225 .B logger \-n loghost.example.com System rebooted
230 .BR systemd.journal-fields (7)
234 command is expected to be IEEE Std 1003.2 ("POSIX.2") compatible.
236 The logger command is part of the util-linux package and is available from
237 .UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/