xref: /freebsd/usr.sbin/syslogd/syslogd.8 (revision 2546665afcaf0d53dc2c7058fee96354b3680f5a)
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. 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.\"     @(#)syslogd.8	8.1 (Berkeley) 6/6/93
33.\" $FreeBSD$
34.\"
35.Dd November 24, 2001
36.Dt SYSLOGD 8
37.Os
38.Sh NAME
39.Nm syslogd
40.Nd log systems messages
41.Sh SYNOPSIS
42.Nm
43.Op Fl 46Acdknosuv
44.Op Fl a Ar allowed_peer
45.Op Fl b Ar bind_address
46.Op Fl f Ar config_file
47.Op Fl l Ar path
48.Op Fl m Ar mark_interval
49.Op Fl P Ar pid_file
50.Op Fl p Ar log_socket
51.Sh DESCRIPTION
52The
53.Nm
54utility reads and logs messages to the system console, log files, other
55machines and/or users as specified by its configuration file.
56.Pp
57The options are as follows:
58.Bl -tag -width indent
59.It Fl 4
60Force
61.Nm
62to use IPv4 addresses only.
63.It Fl 6
64Force
65.Nm
66to use IPv6 addresses only.
67.It Fl A
68Ordinarily,
69.Nm
70tries to send the message to only one address
71even if the host has more than one A or AAAA record.
72If this option is specified,
73.Nm
74tries to send the message to all addresses.
75.It Fl a Ar allowed_peer
76Allow
77.Ar allowed_peer
78to log to this
79.Nm
80using UDP datagrams.
81Multiple
82.Fl a
83options may be specified.
84.Pp
85.Ar Allowed_peer
86can be any of the following:
87.Bl -tag -width "ipaddr/masklen[:service]XX"
88.It Xo
89.Sm off
90.Ar ipaddr
91.No / Ar masklen
92.Op : Ar service
93.Sm on
94.Xc
95Accept datagrams from
96.Ar ipaddr
97(in the usual dotted quad notation) with
98.Ar masklen
99bits being taken into account when doing the address comparison.
100.Ar ipaddr
101can be also IPv6 address by enclosing the address with
102.Ql \&[
103and
104.Ql \&] .
105If specified,
106.Ar service
107is the name or number of an UDP service (see
108.Xr services 5 )
109the source packet must belong to.
110A
111.Ar service
112of
113.Ql \&*
114allows packets being sent from any UDP port.
115The default
116.Ar service
117is
118.Ql syslog .
119If
120.Ar ipaddr
121is IPv4 address, a missing
122.Ar masklen
123will be substituted by the historic class A or class B netmasks if
124.Ar ipaddr
125belongs into the address range of class A or B, respectively, or
126by 24 otherwise.
127If
128.Ar ipaddr
129is IPv6 address, a missing
130.Ar masklen
131will be substituted by 128.
132.It Xo
133.Sm off
134.Ar domainname Op : Ar service
135.Sm on
136.Xc
137Accept datagrams where the reverse address lookup yields
138.Ar domainname
139for the sender address.
140The meaning of
141.Ar service
142is as explained above.
143.It Xo
144.Sm off
145.No * Ar domainname Op : Ar service
146.Sm on
147.Xc
148Same as before, except that any source host whose name
149.Em ends
150in
151.Ar domainname
152will get permission.
153.El
154.Pp
155The
156.Fl a
157options are ignored if the
158.Fl s
159option is also specified.
160.It Fl b Ar bind_address
161Specify one specific IP address or hostname to bind to.
162If a hostname is specified,
163the IPv4 or IPv6 address which corresponds to it is used.
164.It Fl c
165Disable the compression of repeated instances of the same line
166into a single line of the form
167.Dq Li "last message repeated N times"
168when the output is a pipe to another program.
169If specified twice, disable this compression in all cases.
170.It Fl d
171Put
172.Nm
173into debugging mode.
174This is probably only of use to developers working on
175.Nm .
176.It Fl f
177Specify the pathname of an alternate configuration file;
178the default is
179.Pa /etc/syslog.conf .
180.It Fl k
181Disable the translation of
182messages received with facility
183.Dq kern
184to facility
185.Dq user .
186Usually the
187.Dq kern
188facility is reserved for messages read directly from
189.Pa /dev/klog .
190.It Fl m
191Select the number of minutes between
192.Dq mark
193messages; the default is 20 minutes.
194.It Fl n
195Disable dns query for every request.
196.It Fl o
197Prefix kernel messages with the full kernel boot file as determined by
198.Xr getbootfile 3 .
199Without this, the kernel message prefix is always
200.Dq Li kernel: .
201.It Fl p
202Specify the pathname of an alternate log socket to be used instead;
203the default is
204.Pa /var/run/log .
205.It Fl P
206Specify an alternative file in which to store the process ID.
207The default is
208.Pa /var/run/syslog.pid .
209.It Fl l
210Specify a location where
211.Nm
212should place an additional log socket.
213Up to 19 additional logging sockets can be specified.
214The primary use for this is to place additional log sockets in
215.Pa /var/run/log
216of various chroot filespaces.
217.It Fl s
218Operate in secure mode.
219Do not log messages from remote machines.
220If
221specified twice, no network socket will be opened at all, which also
222disables logging to remote machines.
223.It Fl u
224Unique priority logging.
225Only log messages at the specified priority.
226Without this option, messages at the stated priority or higher are logged.
227This option changes the default comparison from
228.Dq =>
229to
230.Dq = .
231.It Fl v
232Verbose logging.
233If specified once, the numeric facility and priority are
234logged with each locally-written message.
235If specified more than once,
236the names of the facility and priority are logged with each locally-written
237message.
238.El
239.Pp
240The
241.Nm
242utility reads its configuration file when it starts up and whenever it
243receives a hangup signal.
244For information on the format of the configuration file,
245see
246.Xr syslog.conf 5 .
247.Pp
248The
249.Nm
250utility reads messages from the
251.Ux
252domain socket
253.Pa /var/run/log ,
254from an Internet domain socket specified in
255.Pa /etc/services ,
256and from the special device
257.Pa /dev/klog
258(to read kernel messages).
259.Pp
260The
261.Nm
262utility creates its process ID file,
263by default
264.Pa /var/run/syslog.pid ,
265and stores its process
266ID there.
267This can be used to kill or reconfigure
268.Nm .
269.Pp
270The message sent to
271.Nm
272should consist of a single line.
273The message can contain a priority code, which should be a preceding
274decimal number in angle braces, for example,
275.Sq Aq 5 .
276This priority code should map into the priorities defined in the
277include file
278.In sys/syslog.h .
279.Pp
280For security reasons,
281.Nm
282will not append to log files that do not exist;
283therefore, they must be created manually before running
284.Nm .
285.Sh FILES
286.Bl -tag -width /var/run/syslog.pid -compact
287.It Pa /etc/syslog.conf
288configuration file
289.It Pa /var/run/syslog.pid
290default process ID file
291.It Pa /var/run/log
292name of the
293.Ux
294domain datagram log socket
295.It Pa /dev/klog
296kernel log device
297.El
298.Sh SEE ALSO
299.Xr logger 1 ,
300.Xr syslog 3 ,
301.Xr services 5 ,
302.Xr syslog.conf 5
303.Sh HISTORY
304The
305.Nm
306utility appeared in
307.Bx 4.3 .
308.Pp
309The
310.Fl a ,
311.Fl s ,
312.Fl u ,
313and
314.Fl v
315options are
316.Fx 2.2
317extensions.
318.Sh BUGS
319The ability to log messages received in UDP packets is equivalent to
320an unauthenticated remote disk-filling service, and should probably be
321disabled by default.
322Some sort of
323.No inter- Ns Nm syslogd
324authentication mechanism ought to be worked out.
325To prevent the worst
326abuse, use of the
327.Fl a
328option is therefore highly recommended.
329.Pp
330The
331.Fl a
332matching algorithm doesn't pretend to be very efficient; use of numeric
333IP addresses is faster than domain name comparison.
334Since the allowed
335peer list is being walked linearly, peer groups where frequent messages
336are being anticipated from should be put early into the
337.Fl a
338list.
339.Pp
340The log socket was moved from
341.Pa /dev
342to ease the use of a read-only root file system.
343This may confuse
344some old binaries so that a symbolic link might be used for a
345transitional period.
346