]> git.ipfire.org Git - thirdparty/util-linux.git/blob - misc-utils/logger.1
docs: fix two spellings in man page of logger
[thirdparty/util-linux.git] / misc-utils / logger.1
1 .\" Copyright (c) 1983, 1990, 1993
2 .\" The Regents of the University of California. All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
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.
19 .\"
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
30 .\" SUCH DAMAGE.
31 .\"
32 .\" @(#)logger.1 8.1 (Berkeley) 6/6/93
33 .\"
34 .TH LOGGER "1" "December 2014" "util-linux" "User Commands"
35 .SH NAME
36 logger \- enter messages into the system log
37 .SH SYNOPSIS
38 .B logger
39 [options]
40 .RI [ message ]
41 .SH DESCRIPTION
42 .B logger
43 makes entries in the system log. It provides a shell-command
44 interface to the
45 .BR syslog (3)
46 system log module.
47 .sp
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.
51 .SH OPTIONS
52 .TP
53 .BR \-d , " \-\-udp"
54 Use datagrams (UDP) only. By default the connection is tried to the
55 syslog port defined in /etc/services, which is often 514 .
56 .TP
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.
60 .TP
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.
66 .TP
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:
74 .IP
75 .nf
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
78 .fi
79 .IP
80 Notice that
81 .B \-\-journald
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
84 execution of
85 .B journalctl
86 will display MESSAGE field. Use
87 .B journalctl --output json-pretty
88 to see rest of the fields.
89
90 .TP
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.
97 .TP
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.
101 .TP
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
105 .IR facility . level
106 pair.
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.
110 .TP
111 .B \-\-prio-prefix
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.
117 .sp
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.
121 .sp
122 This option doesn't affect a command-line message.
123 .TP
124 .B \-\-rfc3164
125 Use the RFC 3164 BSD syslog protocol to submit messages to a remote server.
126 .TP
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
138 .BR gethostname (2)
139 information from the message header.
140 .IP
141 The RFC 5424 protocol has been the default for
142 .B logger
143 since version 2.26.
144 .TP
145 .BR \-s , " \-\-stderr"
146 Output the message to standard error as well as to the system log.
147 .TP
148 .BR \-T , " \-\-tcp"
149 Use stream (TCP) only. By default the connection is tried to the
150 .I syslog-conn
151 port defined in /etc/services, which is often
152 .IR 601 .
153 .TP
154 .BR \-t , " \-\-tag " \fItag
155 Mark every line to be logged with the specified
156 .IR tag .
157 .TP
158 .BR \-u , " \-\-socket " \fIsocket
159 Write to the specified
160 .I socket
161 instead of to the builtin syslog routines.
162 .TP
163 .B \-\-
164 End the argument list. This allows the \fImessage\fR
165 to start with a hyphen (\-).
166 .TP
167 .BR \-V , " \-\-version"
168 Display version information and exit.
169 .TP
170 .BR \-h , " \-\-help"
171 Display help text and exit.
172 .SH RETURN VALUE
173 The
174 .B logger
175 utility exits 0 on success, and >0 if an error occurs.
176 .SH FACILITIES AND LEVELS
177 Valid facility names are:
178 .IP
179 .TS
180 tab(:);
181 left l l.
182 \fBauth
183 \fBauthpriv\fR:for security information of a sensitive nature
184 \fBcron
185 \fBdaemon
186 \fBftp
187 \fBkern\fR:cannot be generated from user process
188 \fBlpr
189 \fBmail
190 \fBnews
191 \fBsyslog
192 \fBuser
193 \fBuucp
194 \fBlocal0
195 to:
196 \fBlocal7
197 \fBsecurity\fR:deprecated synonym for \fBauth
198 .TE
199 .PP
200 Valid level names are:
201 .IP
202 .TS
203 tab(:);
204 left l l.
205 \fBemerg
206 \fBalert
207 \fBcrit
208 \fBerr
209 \fBwarning
210 \fBnotice
211 \fBinfo
212 \fBdebug
213 \fBpanic\fR:deprecated synonym for \fBemerg
214 \fBerror\fR:deprecated synonym for \fBerr
215 \fBwarn\fR:deprecated synonym for \fBwarning
216 .TE
217 .PP
218 For the priority order and intended purposes of these facilities and levels, see
219 .BR syslog (3).
220 .SH EXAMPLES
221 .B logger System rebooted
222 .br
223 .B logger \-p local0.notice \-t HOSTIDM \-f /dev/idmc
224 .br
225 .B logger \-n loghost.example.com System rebooted
226 .SH SEE ALSO
227 .BR syslog (3),
228 .BR syslogd (8),
229 .BR journalctl (1),
230 .BR systemd.journal-fields (7)
231 .SH STANDARDS
232 The
233 .B logger
234 command is expected to be IEEE Std 1003.2 ("POSIX.2") compatible.
235 .SH AVAILABILITY
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/
238 Linux Kernel Archive
239 .UE .