]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/syslogd/syslogd.8
Fix enough warnings that we can build syslogd on all targets at WARNS=6.
[FreeBSD/FreeBSD.git] / usr.sbin / syslogd / syslogd.8
1 .\" Copyright (c) 1983, 1986, 1991, 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. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)syslogd.8   8.1 (Berkeley) 6/6/93
29 .\" $FreeBSD$
30 .\"
31 .Dd November 28, 2017
32 .Dt SYSLOGD 8
33 .Os
34 .Sh NAME
35 .Nm syslogd
36 .Nd log systems messages
37 .Sh SYNOPSIS
38 .Nm
39 .Op Fl 468ACcdFHkNnosTuv
40 .Op Fl a Ar allowed_peer
41 .Op Fl b Ar bind_address
42 .Op Fl f Ar config_file
43 .Op Fl l Oo Ar mode Ns \&: Oc Ns Ar path
44 .Op Fl m Ar mark_interval
45 .Op Fl P Ar pid_file
46 .Op Fl p Ar log_socket
47 .Op Fl S Ar logpriv_socket
48 .Sh DESCRIPTION
49 The
50 .Nm
51 utility reads and logs messages to the system console,
52 log files,
53 other
54 machines and/or users as specified by its configuration file.
55 .Pp
56 The options are as follows:
57 .Bl -tag -width indent
58 .It Fl 4
59 Force
60 .Nm
61 to use IPv4 addresses only.
62 .It Fl 6
63 Force
64 .Nm
65 to use IPv6 addresses only.
66 .It Fl 8
67 Tells
68 .Nm
69 not to interfere with 8-bit data.
70 Normally
71 .Nm
72 will replace C1 control characters
73 .Pq ISO 8859 and Unicode characters
74 with their
75 .Dq M- Ns Em x
76 equivalent.
77 Note, this option does not change the way
78 .Nm
79 alters control characters
80 .Pq see Xr iscntrl 3 .
81 They will always be replaced with their
82 .Dq ^ Ns Em x
83 equivalent.
84 .It Fl A
85 Ordinarily,
86 .Nm
87 tries to send the message to only one address
88 even if the host has more than one A or AAAA record.
89 If this option is specified,
90 .Nm
91 tries to send the message to all addresses.
92 .It Fl a Ar allowed_peer
93 Allow
94 .Ar allowed_peer
95 to log to this
96 .Nm
97 using UDP datagrams.
98 Multiple
99 .Fl a
100 options may be specified.
101 .Pp
102 The
103 .Ar allowed_peer
104 option may be any of the following:
105 .Bl -tag -width "ipaddr[/prefixlen][:service]XX"
106 .It Xo
107 .Sm off
108 .Ar ipaddr
109 .Op / Ar masklen
110 .Op \&: Ar service
111 .Pp
112 .Ar ipaddr
113 .Op / Ar prefixlen
114 .Op \&: Ar service
115 .Sm on
116 .Xc
117 Accept datagrams from
118 .Ar ipaddr ,
119 .Ar ipaddr
120 can be specified as an IPv4 address or as an IPv6
121 address enclosed with
122 .Ql \&[
123 and
124 .Ql \&] .
125 If specified,
126 .Ar service
127 is the name or number of an UDP service (see
128 .Xr services 5 )
129 the source packet must belong to.
130 A
131 .Ar service
132 of
133 .Ql \&*
134 accepts UDP packets from any source port.
135 The default
136 .Ar service
137 is
138 .Ql syslog .
139 If
140 .Ar ipaddr
141 is IPv4 address, a missing
142 .Ar masklen
143 will be substituted by the historic class A or class B netmasks if
144 .Ar ipaddr
145 belongs into the address range of class A or B,
146 respectively,
147 or by 24 otherwise.
148 If
149 .Ar ipaddr
150 is IPv6 address,
151 a missing
152 .Ar masklen
153 will be substituted by 128.
154 .It Xo
155 .Sm off
156 .Ar domainname Op \&: Ar service
157 .Sm on
158 .Xc
159 Accept datagrams where the reverse address lookup yields
160 .Ar domainname
161 for the sender address.
162 The meaning of
163 .Ar service
164 is as explained above.
165 .Ar domainname
166 can contain special characters of a shell-style pattern such as
167 .Ql Li \&* .
168 .El
169 .Pp
170 The
171 .Fl a
172 options are ignored if the
173 .Fl s
174 option is also specified.
175 .It Xo
176 .Fl b
177 .Sm off
178 .Ar bind_address Op \&: Ar service
179 .Sm on
180 .Xc
181 .It Xo
182 .Fl b
183 .Sm off
184 .Li \&: Ar service
185 .Sm on
186 .Xc
187 Bind to a specific address and/or port.
188 The address can be specified as a hostname,
189 and the port as a service name.
190 If an IPv6 address is specified, it should be enclosed with
191 .Ql \&[
192 and
193 .Ql \&] .
194 The default
195 .Ar service
196 is
197 .Ql syslog .
198 This option can be specified multiple times to bind to
199 multiple addresses and/or ports.
200 .It Fl C
201 Create log files that do not exist
202 .Pq permission is set to Ql Li 0600 .
203 .It Fl c
204 Disable the compression of repeated instances of the same line
205 into a single line of the form
206 .Dq Li "last message repeated N times"
207 when the output is a pipe to another program.
208 If specified twice,
209 disable this compression in all cases.
210 .It Fl d
211 Put
212 .Nm
213 into debugging mode.
214 This is probably only of use to developers working on
215 .Nm .
216 .It Fl f Ar config_file
217 Specify the pathname of an alternate configuration file;
218 the default is
219 .Pa /etc/syslog.conf .
220 .It Fl F
221 Run
222 .Nm
223 in the foreground,
224 rather than going into daemon mode.
225 This is useful if some other process uses
226 .Xr fork 2
227 and
228 .Xr exec 3
229 to run
230 .Nm ,
231 and wants to monitor when and how it exits.
232 .It Fl H
233 When logging remote messages use hostname from the message (if supplied)
234 instead of using address from which the message was received.
235 .It Fl k
236 Disable the translation of
237 messages received with facility
238 .Dq kern
239 to facility
240 .Dq user .
241 Usually the
242 .Dq kern
243 facility is reserved for messages read directly from
244 .Pa /dev/klog .
245 .It Fl m Ar mark_interval
246 Select the number of minutes between
247 .Dq mark
248 messages;
249 the default is 20 minutes.
250 .It Fl N
251 Disable binding on UDP sockets.
252 RFC 3164 recommends that outgoing
253 .Nm
254 messages should originate from the privileged port,
255 this option
256 .Em disables
257 the recommended behavior.
258 This option inherits
259 .Fl s .
260 .It Fl n
261 Disable DNS query for every request.
262 .It Fl o
263 Prefix kernel messages with the full kernel boot file as determined by
264 .Xr getbootfile 3 .
265 Without this, the kernel message prefix is always
266 .Dq Li kernel: .
267 .It Fl p Ar log_socket
268 Specify the pathname of an alternate log socket to be used instead;
269 the default is
270 .Pa /var/run/log .
271 When a single
272 .Fl p
273 option is specified,
274 the default pathname is replaced with the specified one.
275 When two or more
276 .Fl p
277 options are specified,
278 the remaining pathnames are treated as additional log sockets.
279 .It Fl P Ar pid_file
280 Specify an alternative file in which to store the process ID.
281 The default is
282 .Pa /var/run/syslog.pid .
283 .It Fl S Ar logpriv_socket
284 Specify the pathname of an alternate log socket for privileged
285 applications to be used instead;
286 the default is
287 .Pa /var/run/logpriv .
288 When a single
289 .Fl S
290 option is specified,
291 the default pathname is replaced with the specified one.
292 When two or more
293 .Fl S
294 options are specified,
295 the remaining pathnames are treated as additional log sockets.
296 .It Fl l Oo Ar mode Ns \&: Oc Ns Ar path
297 Specify a location where
298 .Nm
299 should place an additional log socket.
300 The primary use for this is to place additional log sockets in
301 .Pa /var/run/log
302 of various chroot filespaces.
303 File permissions for socket can be specified in octal representation in
304 .Ar mode ,
305 delimited with a colon.
306 The socket location must be specified as an absolute pathname in
307 .Ar path .
308 .It Fl s
309 Operate in secure mode.
310 Do not log messages from remote machines.
311 If specified twice,
312 no network socket will be opened at all,
313 which also disables logging to remote machines.
314 .It Fl T
315 Always use the local time and date for messages received from the network,
316 instead of the timestamp field supplied in the message by the remote host.
317 This is useful if some of the originating hosts cannot keep time properly
318 or are unable to generate a correct timestamp.
319 .It Fl u
320 Unique priority logging.
321 Only log messages at the specified priority.
322 Without this option,
323 messages at the stated priority or higher are logged.
324 This option changes the default comparison from
325 .Dq =>
326 to
327 .Dq = .
328 .It Fl v
329 Verbose logging.
330 If specified once,
331 the numeric facility and priority are
332 logged with each locally-written message.
333 If specified more than once,
334 the names of the facility and priority are logged with each locally-written
335 message.
336 .El
337 .Pp
338 The
339 .Nm
340 utility reads its configuration file when it starts up and whenever it
341 receives a hangup signal.
342 For information on the format of the configuration file,
343 see
344 .Xr syslog.conf 5 .
345 .Pp
346 The
347 .Nm
348 utility reads messages from the
349 .Ux
350 domain sockets
351 .Pa /var/run/log
352 and
353 .Pa /var/run/logpriv ,
354 from an Internet domain socket specified in
355 .Pa /etc/services ,
356 and from the special device
357 .Pa /dev/klog
358 .Pq to read kernel messages .
359 .Pp
360 The
361 .Nm
362 utility creates its process ID file,
363 by default
364 .Pa /var/run/syslog.pid ,
365 and stores its process
366 ID there.
367 This can be used to kill or reconfigure
368 .Nm .
369 .Pp
370 The message sent to
371 .Nm
372 should consist of a single line.
373 The message can contain a priority code,
374 which should be a preceding
375 decimal number in angle braces,
376 for example,
377 .Sq Aq 5 .
378 This priority code should map into the priorities defined in the
379 include file
380 .In sys/syslog.h .
381 .Pp
382 For security reasons,
383 .Nm
384 will not append to log files that do not exist
385 .Po unless Fl C
386 option is specified
387 .Pc ;
388 therefore, they must be created manually before running
389 .Nm .
390 .Pp
391 The date and time are taken from the received message.
392 If the format of the timestamp field is incorrect,
393 time obtained from the local host is used instead.
394 This can be overridden by the
395 .Fl T
396 flag.
397 .Sh FILES
398 .Bl -tag -width /var/run/syslog.pid -compact
399 .It Pa /etc/syslog.conf
400 configuration file
401 .It Pa /var/run/syslog.pid
402 default process ID file
403 .It Pa /var/run/log
404 name of the
405 .Ux
406 domain datagram log socket
407 .It Pa /var/run/logpriv
408 .Ux
409 socket for privileged applications
410 .It Pa /dev/klog
411 kernel log device
412 .El
413 .Sh SEE ALSO
414 .Xr logger 1 ,
415 .Xr syslog 3 ,
416 .Xr services 5 ,
417 .Xr syslog.conf 5 ,
418 .Xr newsyslog 8
419 .Sh HISTORY
420 The
421 .Nm
422 utility appeared in
423 .Bx 4.3 .
424 .Pp
425 The
426 .Fl a ,
427 .Fl s ,
428 .Fl u ,
429 and
430 .Fl v
431 options are
432 .Fx 2.2
433 extensions.
434 .Sh BUGS
435 The ability to log messages received in UDP packets is equivalent to
436 an unauthenticated remote disk-filling service,
437 and should probably be disabled by default.
438 Some sort of
439 .No inter- Ns Nm syslogd
440 authentication mechanism ought to be worked out.
441 To prevent the worst abuse,
442 use of the
443 .Fl a
444 option is therefore highly recommended.
445 .Pp
446 The
447 .Fl a
448 matching algorithm does not pretend to be very efficient;
449 use of numeric IP addresses is faster than domain name comparison.
450 Since the allowed peer list is being walked linearly,
451 peer groups where frequent messages are being anticipated
452 from should be put early into the
453 .Fl a
454 list.
455 .Pp
456 The log socket was moved from
457 .Pa /dev
458 to ease the use of a read-only root file system.
459 This may confuse
460 some old binaries so that a symbolic link might be used for a
461 transitional period.