]> git.ipfire.org Git - thirdparty/util-linux.git/blob - misc-utils/logger.1
ea1e97dad87118e5a2637646564b81a1f9802ac8
[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 .PP
164 The
165 .B logger
166 utility exits 0 on success, and >0 if an error occurs.
167 .PP
168 Valid facility names are:
169 .IR auth , \ authpriv
170 (for security information of a sensitive nature),
171 .IR cron , \ daemon , \ ftp , \ kern
172 (can't be generated from user process),
173 .IR lpr , \ mail , \ news , \ security
174 (deprecated synonym for
175 .IR auth ), \ syslog , \ user , \ uucp ,
176 and
177 .IR local0 \ to \ local7 ,
178 inclusive.
179 .PP
180 Valid level names are:
181 .IR alert , \ crit , \ debug , \ emerg , \ err , \ error
182 (deprecated synonym for
183 .IR err ), \ info , \ notice , \ panic
184 (deprecated synonym for
185 .IR emerg ), \ warning , \ warn
186 (deprecated synonym for
187 .IR warning ).
188 For the priority order and intended purposes of these levels, see
189 .BR syslog (3).
190 .SH EXAMPLES
191 logger System rebooted
192 .br
193 logger \-p local0.notice \-t HOSTIDM \-f /dev/idmc
194 .br
195 logger \-n loghost.example.com System rebooted
196 .SH SEE ALSO
197 .BR syslog (3),
198 .BR syslogd (8),
199 .BR journalctl (1),
200 .BR systemd.journal-fields (7)
201 .SH STANDARDS
202 The
203 .B logger
204 command is expected to be IEEE Std 1003.2 ("POSIX.2") compatible.
205 .SH AVAILABILITY
206 The logger command is part of the util-linux package and is available from
207 .UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
208 Linux Kernel Archive
209 .UE .