]> git.ipfire.org Git - thirdparty/util-linux.git/blob - misc-utils/logger.1
docs: make logger.1 facilities and levels easier to read
[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 .\" Section on valid facility and level strings added by
35 .\" and1000@debian.org, 26 Oct 1997.
36 .TH LOGGER "1" "April 2013" "util-linux" "User Commands"
37 .SH NAME
38 logger \- a shell command interface to the syslog(3) system log module
39 .SH SYNOPSIS
40 .B logger
41 .RI [ options "] [" message ]
42 .SH DESCRIPTION
43 .B logger
44 makes entries in the system log. It provides a shell command
45 interface to the
46 .BR syslog (3)
47 system log module.
48 .SH OPTIONS
49 .TP
50 \fB\-d\fR, \fB\-\-udp\fR
51 Use datagram (UDP) only. By default the connection is tried to the
52 .I syslog
53 port defined in /etc/services, which is often
54 .IR 514 .
55 .TP
56 \fB\-h\fR, \fB\-\-help\fR
57 Display help text and exit.
58 .TP
59 \fB\-i\fR, \fB\-\-id\fR
60 Log the process ID of the logger process with each line.
61 .TP
62 .TP
63 \fB\-n\fR, \fB\-\-server\fR \fIserver\fR
64 Write to the specified remote syslog
65 .I server
66 instead of to the builtin syslog routines. Unless
67 .B \-\-udp
68 or
69 .B \-\-tcp
70 is specified, \fBlogger\fR will first try to use UDP,
71 but if thist fails a TCP connection is attempted.
72 .TP
73 \fB\-P\fR, \fB\-\-port\fR \fIport\fR
74 Use the specified
75 .IR port .
76 .TP
77 \fB\-f\fR, \fB\-\-file\fR \fIfile\fR
78 Log the contents of the specified
79 .IR file .
80 This option cannot be combined with a command-line message.
81 .TP
82 \fB\-p\fR, \fB\-\-priority\fR \fIpriority\fR
83 Enter the message into the log with the specified
84 .IR priority .
85 The priority may be specified numerically or as a
86 .I facility.level
87 pair.
88 For example,
89 .B -p
90 .I local3.info
91 logs the message as informational in the local3 facility.
92 The default is
93 .IR user.notice .
94 .TP
95 \fB\-\-prio\-prefix\fR
96 Look for a syslog prefix on every line read from standard input.
97 This prefix is a number within angle brackets that contains both the facility
98 and the level. This decimal prefix is constructed by multiplying the
99 facility by 8 and then adding the level. Thus, for example, \fIlocal0.info\fR,
100 facility=16 and level=6, becomes \fI<134>\fR.
101
102 If the prefix contains no facility, the facility defaults to what is
103 specified by the \fB\-p\fR option. Similarly, if no prefix is provided,
104 the line is logged using the \fB\-p\fR \fIpriority\fR.
105
106 This option doesn't affect a command-line message.
107 .TP
108 \fB\-s\fR, \fB\-\-stderr\fR
109 Output the message to standard error as well as to the system log.
110 .TP
111 \fB\-T\fR, \fB\-\-tcp\fR
112 Use stream (TCP) only. By default the connection is tried to the
113 .I syslog-conn
114 port defined in /etc/services, which is often
115 .IR 601 .
116 .TP
117 \fB\-t\fR, \fB\-\-tag\fR \fItag\fR
118 Mark every line to be logged with the specified
119 .IR tag .
120 .TP
121 \fB\-u\fR, \fB\-\-socket\fR \fIsocket\fR
122 Write to the specified
123 .I socket
124 instead of to the builtin syslog routines.
125 .TP
126 \fB\-\-journald\fR [\fIfile\fR]
127 Write systemd journal entry. The entry is read from
128 .I stdin
129 or input
130 .IR file .
131 Each new line must begin with a field that is accepted by journald, see
132 .IR systemd.journal-fields (7)
133 for details. Use of MESSAGE_ID field is generally good idea, as they
134 make finding entries easy.
135 .IP
136 .nf
137 $ printf "%s\\n%s\\n%s\\n" MESSAGE_ID=86184c3b1aa444f58ebe7b30fec1438b DOGS=bark "CARAVAN=goes on" | logger --journald
138 $ logger --journald=entry.txt
139 .fi
140 .IP
141 Notice that
142 .B \-\-journald
143 will ignore values of other options, such as priority. If priority is
144 needed it must be within input, and use PRIORITY field. The simple
145 execution of
146 .B journalctl
147 will display MESSAGE field. Use
148 .B journalctl --output json-pretty
149 to see rest of the fields.
150 .TP
151 \fB\-V\fR, \fB\-\-version\fR
152 Display version information and exit.
153 .TP
154 \fB\-\-\fR
155 End the argument list. This is to allow the
156 .I message
157 to start with a hyphen (\-).
158 .TP
159 .I message
160 Write this \fImessage\fR to the log; if not specified, and the
161 .B \-f
162 flag is not provided, standard input is logged.
163 .SH RETURN VALUE
164 The
165 .B logger
166 utility exits 0 on success, and >0 if an error occurs.
167 .SH FACILITIES AND LEVELS
168 Valid facility names are:
169 .IP
170 .TS
171 tab(:);
172 left l l.
173 \fIauth\fR
174 \fIauthpriv\fR:for security information of a sensitive nature
175 \fIcron\fR
176 \fIdaemon\fR
177 \fIftp\fR
178 \fIkern\fR:cannot be generated from user process
179 \fIlpr\fR
180 \fImail\fR
181 \fInews\fR
182 \fIsyslog\fR
183 \fIuser\fR
184 \fIuucp\fR
185 \fIlocal0\fR
186 to:
187 \fIlocal7\fR
188 \fIsecurity\fR:deprecated synonym for \fIauth\fR
189 .TE
190 .PP
191 Valid level names are:
192 .IP
193 .TS
194 tab(:);
195 left l l.
196 \fIemerg\fR
197 \fIalert\fR
198 \fIcrit\fR
199 \fIerr\fR
200 \fIwarning\fR
201 \fInotice\fR
202 \fIinfo\fR
203 \fIdebug\fR
204 \fIpanic\fR:deprecated synonym for \fIemerg\fR
205 \fIerror\fR:deprecated synonym for \fIerr\fR
206 \fIwarn\fR:deprecated synonym for \fIwarning\fR
207 .TE
208 .PP
209 For the priority order and intended purposes of these facilities and levels, see
210 .BR syslog (3).
211 .SH EXAMPLES
212 logger System rebooted
213 .br
214 logger \-p local0.notice \-t HOSTIDM \-f /dev/idmc
215 .br
216 logger \-n loghost.example.com System rebooted
217 .SH SEE ALSO
218 .BR syslog (3),
219 .BR syslogd (8),
220 .BR journalctl (1),
221 .BR systemd.journal-fields (7)
222 .SH STANDARDS
223 The
224 .B logger
225 command is expected to be IEEE Std 1003.2 ("POSIX.2") compatible.
226 .SH AVAILABILITY
227 The logger command is part of the util-linux package and is available from
228 .UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
229 Linux Kernel Archive
230 .UE .