]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/syslogd/syslogd.8
mountd: Remove unneeded cast
[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 March 3, 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 468ACcdFkNnosTuv
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 k
233 Disable the translation of
234 messages received with facility
235 .Dq kern
236 to facility
237 .Dq user .
238 Usually the
239 .Dq kern
240 facility is reserved for messages read directly from
241 .Pa /dev/klog .
242 .It Fl m Ar mark_interval
243 Select the number of minutes between
244 .Dq mark
245 messages;
246 the default is 20 minutes.
247 .It Fl N
248 Disable binding on UDP sockets.
249 RFC 3164 recommends that outgoing
250 .Nm
251 messages should originate from the privileged port,
252 this option
253 .Em disables
254 the recommended behavior.
255 This option inherits
256 .Fl s .
257 .It Fl n
258 Disable DNS query for every request.
259 .It Fl o
260 Prefix kernel messages with the full kernel boot file as determined by
261 .Xr getbootfile 3 .
262 Without this, the kernel message prefix is always
263 .Dq Li kernel: .
264 .It Fl p Ar log_socket
265 Specify the pathname of an alternate log socket to be used instead;
266 the default is
267 .Pa /var/run/log .
268 When a single
269 .Fl p
270 option is specified,
271 the default pathname is replaced with the specified one.
272 When two or more
273 .Fl p
274 options are specified,
275 the remaining pathnames are treated as additional log sockets.
276 .It Fl P Ar pid_file
277 Specify an alternative file in which to store the process ID.
278 The default is
279 .Pa /var/run/syslog.pid .
280 .It Fl S Ar logpriv_socket
281 Specify the pathname of an alternate log socket for privileged
282 applications to be used instead;
283 the default is
284 .Pa /var/run/logpriv .
285 When a single
286 .Fl S
287 option is specified,
288 the default pathname is replaced with the specified one.
289 When two or more
290 .Fl S
291 options are specified,
292 the remaining pathnames are treated as additional log sockets.
293 .It Fl l Oo Ar mode Ns \&: Oc Ns Ar path
294 Specify a location where
295 .Nm
296 should place an additional log socket.
297 The primary use for this is to place additional log sockets in
298 .Pa /var/run/log
299 of various chroot filespaces.
300 File permissions for socket can be specified in octal representation in
301 .Ar mode ,
302 delimited with a colon.
303 The socket location must be specified as an absolute pathname in
304 .Ar path .
305 .It Fl s
306 Operate in secure mode.
307 Do not log messages from remote machines.
308 If specified twice,
309 no network socket will be opened at all,
310 which also disables logging to remote machines.
311 .It Fl T
312 Always use the local time and date for messages received from the network,
313 instead of the timestamp field supplied in the message by the remote host.
314 This is useful if some of the originating hosts cannot keep time properly
315 or are unable to generate a correct timestamp.
316 .It Fl u
317 Unique priority logging.
318 Only log messages at the specified priority.
319 Without this option,
320 messages at the stated priority or higher are logged.
321 This option changes the default comparison from
322 .Dq =>
323 to
324 .Dq = .
325 .It Fl v
326 Verbose logging.
327 If specified once,
328 the numeric facility and priority are
329 logged with each locally-written message.
330 If specified more than once,
331 the names of the facility and priority are logged with each locally-written
332 message.
333 .El
334 .Pp
335 The
336 .Nm
337 utility reads its configuration file when it starts up and whenever it
338 receives a hangup signal.
339 For information on the format of the configuration file,
340 see
341 .Xr syslog.conf 5 .
342 .Pp
343 The
344 .Nm
345 utility reads messages from the
346 .Ux
347 domain sockets
348 .Pa /var/run/log
349 and
350 .Pa /var/run/logpriv ,
351 from an Internet domain socket specified in
352 .Pa /etc/services ,
353 and from the special device
354 .Pa /dev/klog
355 .Pq to read kernel messages .
356 .Pp
357 The
358 .Nm
359 utility creates its process ID file,
360 by default
361 .Pa /var/run/syslog.pid ,
362 and stores its process
363 ID there.
364 This can be used to kill or reconfigure
365 .Nm .
366 .Pp
367 The message sent to
368 .Nm
369 should consist of a single line.
370 The message can contain a priority code,
371 which should be a preceding
372 decimal number in angle braces,
373 for example,
374 .Sq Aq 5 .
375 This priority code should map into the priorities defined in the
376 include file
377 .In sys/syslog.h .
378 .Pp
379 For security reasons,
380 .Nm
381 will not append to log files that do not exist
382 .Po unless Fl C
383 option is specified
384 .Pc ;
385 therefore, they must be created manually before running
386 .Nm .
387 .Pp
388 The date and time are taken from the received message.
389 If the format of the timestamp field is incorrect,
390 time obtained from the local host is used instead.
391 This can be overridden by the
392 .Fl T
393 flag.
394 .Sh FILES
395 .Bl -tag -width /var/run/syslog.pid -compact
396 .It Pa /etc/syslog.conf
397 configuration file
398 .It Pa /var/run/syslog.pid
399 default process ID file
400 .It Pa /var/run/log
401 name of the
402 .Ux
403 domain datagram log socket
404 .It Pa /var/run/logpriv
405 .Ux
406 socket for privileged applications
407 .It Pa /dev/klog
408 kernel log device
409 .El
410 .Sh SEE ALSO
411 .Xr logger 1 ,
412 .Xr syslog 3 ,
413 .Xr services 5 ,
414 .Xr syslog.conf 5 ,
415 .Xr newsyslog 8
416 .Sh HISTORY
417 The
418 .Nm
419 utility appeared in
420 .Bx 4.3 .
421 .Pp
422 The
423 .Fl a ,
424 .Fl s ,
425 .Fl u ,
426 and
427 .Fl v
428 options are
429 .Fx 2.2
430 extensions.
431 .Sh BUGS
432 The ability to log messages received in UDP packets is equivalent to
433 an unauthenticated remote disk-filling service,
434 and should probably be disabled by default.
435 Some sort of
436 .No inter- Ns Nm syslogd
437 authentication mechanism ought to be worked out.
438 To prevent the worst abuse,
439 use of the
440 .Fl a
441 option is therefore highly recommended.
442 .Pp
443 The
444 .Fl a
445 matching algorithm does not pretend to be very efficient;
446 use of numeric IP addresses is faster than domain name comparison.
447 Since the allowed peer list is being walked linearly,
448 peer groups where frequent messages are being anticipated
449 from should be put early into the
450 .Fl a
451 list.
452 .Pp
453 The log socket was moved from
454 .Pa /dev
455 to ease the use of a read-only root file system.
456 This may confuse
457 some old binaries so that a symbolic link might be used for a
458 transitional period.