1.\" Copyright (c) 1990, 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.\" @(#)syslog.conf.5 8.1 (Berkeley) 6/9/93 33.\" $FreeBSD$ 34.\" 35.Dd June 9, 1993 36.Dt SYSLOG.CONF 5 37.Os 38.Sh NAME 39.Nm syslog.conf 40.Nd 41.Xr syslogd 8 42configuration file 43.Sh DESCRIPTION 44The 45.Nm 46file is the configuration file for the 47.Xr syslogd 8 48program. 49It consists of 50blocks of lines separated by 51.Em program 52specifications, 53with each line containing two fields: the 54.Em selector 55field which specifies the types of messages and priorities to which the 56line applies, and an 57.Em action 58field which specifies the action to be taken if a message 59.Xr syslogd 60receives matches the selection criteria. 61The 62.Em selector 63field is separated from the 64.Em action 65field by one or more tab characters or spaces. 66.Pp 67Note that if you use spaces as separators, your 68.Em syslog.conf 69might be incompatible with other Unices or Unix-like systems. 70This functionality was added for the ease of configuration 71(e.g. it is possible to cut-and-paste into 72.Em syslog.conf 73), 74and to avoid possible mistakes. This change however preserves 75backwards compatibility with the old style of the 76.Em syslog.conf 77(i.e. tab characters only). 78.Pp 79The 80.Em Selectors 81function 82are encoded as a 83.Em facility , 84a period 85.Pq Dq \&. , 86an optional set of comparison flags 87.Pq Bq <=> , 88and a 89.Em level , 90with no intervening white-space. 91Both the 92.Em facility 93and the 94.Em level 95are case insensitive. 96.Pp 97The 98.Em facility 99describes the part of the system generating the message, and is one of 100the following keywords: auth, authpriv, cron, daemon, ftp, kern, lpr, mail, 101mark, news, ntp, syslog, user, uucp, security and local0 through local7. 102These keywords (with the exception of mark) correspond to the 103similar 104.Dq Dv LOG_ 105values specified to the 106.Xr openlog 3 107and 108.Xr syslog 3 109library routines. 110.Pp 111The 112.Em comparison flags 113may be used to specify exactly what is logged. 114The default set of comparison flags are 115.Dq => 116(or, if you prefer, 117.Do >= 118.Dc ), 119which means that messages from the specified 120.Em facility 121list of a priority 122level equal or greater than 123.Em level 124will be logged. 125.Pp 126The 127.Em level 128describes the severity of the message, and is a keyword from the 129following ordered list (higher to lower): emerg, alert, crit, err, 130warning, notice, info and debug. 131These keywords correspond to the 132similar 133.Dq Dv LOG_ 134values specified to the 135.Xr syslog 136library routine. 137.Pp 138Each block of lines is separated from the previous block by a tag. The tag 139is a line beginning with 140.Em #!prog 141or 142.Em !prog 143(the former is for compatibility with the previous syslogd, if one is sharing 144syslog.conf files, for example) 145and each block will be associated with calls to syslog from that specific 146program. A tag for ``foo'' will also match any message logged by the kernel 147with the prefix ``foo: ''. 148.Pp 149See 150.Xr syslog 3 151for a further descriptions of both the 152.Em facility 153and 154.Em level 155keywords and their significance. It's preferred that selections be made on 156.Em facility 157rather than 158.Em program , 159since the latter can easily vary in a networked environment. In some cases, 160though, an appropriate 161.Em facility 162simply doesn't exist. 163.Pp 164If a received message matches the specified 165.Em facility 166and is of the specified 167.Em level 168.Em (or a higher level) , 169and the first word in the message after the date matches the 170.Em program , 171the action specified in the 172.Em action 173field will be taken. 174.Pp 175Multiple 176.Em selectors 177may be specified for a single 178.Em action 179by separating them with semicolon 180.Pq Dq \&; 181characters. 182It is important to note, however, that each 183.Em selector 184can modify the ones preceding it. 185.Pp 186Multiple 187.Em facilities 188may be specified for a single 189.Em level 190by separating them with comma 191.Pq Dq \&, 192characters. 193.Pp 194An asterisk 195.Pq Dq * 196can be used to specify all 197.Em facilities 198all 199.Em levels 200or all 201.Em programs . 202.Pp 203The special 204.Em facility 205.Dq mark 206receives a message at priority 207.Dq info 208every 20 minutes 209(see 210.Xr syslogd 8 ) . 211This is not enabled by a 212.Em facility 213field containing an asterisk. 214.Pp 215The special 216.Em level 217.Dq none 218disables a particular 219.Em facility . 220.Pp 221The 222.Em action 223field of each line specifies the action to be taken when the 224.Em selector 225field selects a message. 226There are five forms: 227.Bl -bullet 228.It 229A pathname (beginning with a leading slash). 230Selected messages are appended to the file. 231.It 232A hostname (preceded by an at 233.Pq Dq @ 234sign). 235Selected messages are forwarded to the 236.Xr syslogd 237program on the named host. 238.It 239A comma separated list of users. 240Selected messages are written to those users 241if they are logged in. 242.It 243An asterisk. 244Selected messages are written to all logged-in users. 245.It 246A vertical bar 247.Pq Dq \&| , 248followed by a command to pipe the selected 249messages to. The command is passed to a 250.Pa /bin/sh 251for evaluation, so usual shell metacharacters or input/output 252redirection can occur. (Note however that redirecting 253.Xr stdio 3 254buffered output from the invoked command can cause additional delays, 255or even lost output data in case a logging subprocess exited with a 256signal.) The command itself runs with 257.Em stdout 258and 259.Em stderr 260redirected to 261.Pa /dev/null . 262Upon receipt of a 263.Dv SIGHUP , 264.Nm 265will close the pipe to the process. If the process didn't exit 266voluntarily, it will be sent a 267.Dv SIGTERM 268signal after a grace period of up to 60 seconds. 269.Pp 270The command will only be started once data arrives that should be piped 271to it. If it exited later, it will be restarted as necessary. So if it 272is desired that the subprocess should get exactly one line of input only 273(which can be very resource-consuming if there are a lot of messages 274flowing quickly), this can be achieved by exiting after just one line of 275input. If necessary, a script wrapper can be written to this effect. 276.Pp 277Unless the command is a full pipeline, it's probably useful to 278start the command with 279.Em exec 280so that the invoking shell process does not wait for the command to 281complete. Warning: the process is started under the UID invoking 282.Xr syslogd 8 , 283normally the superuser. 284.El 285.Pp 286Blank lines and lines whose first non-blank character is a hash 287.Pq Dq # 288character are ignored. 289.Sh EXAMPLES 290.Pp 291A configuration file might appear as follows: 292.Bd -literal 293# Log all kernel messages, authentication messages of 294# level notice or higher and anything of level err or 295# higher to the console. 296# Don't log private authentication messages! 297*.err;kern.*;auth.notice;authpriv.none /dev/console 298 299# Log anything (except mail) of level info or higher. 300# Don't log private authentication messages! 301*.info;mail.none;authpriv.none /var/log/messages 302 303# Log daemon messages at debug level only 304daemon.=debug /var/log/daemon.debug 305 306# The authpriv file has restricted access. 307authpriv.* /var/log/secure 308 309# Log all the mail messages in one place. 310mail.* /var/log/maillog 311 312# Everybody gets emergency messages, plus log them on another 313# machine. 314*.emerg * 315*.emerg @arpa.berkeley.edu 316 317# Root and Eric get alert and higher messages. 318*.alert root,eric 319 320# Save mail and news errors of level err and higher in a 321# special file. 322uucp,news.crit /var/log/spoolerr 323 324# Pipe all authentication messages to a filter. 325auth.* |exec /usr/local/sbin/authfilter 326 327# Save ftpd transactions along with mail and news 328!ftpd 329*.* /var/log/spoolerr 330 331# Log all security messages to a separate file. 332security.* /var/log/security 333.Ed 334.Sh FILES 335.Bl -tag -width /etc/syslog.conf -compact 336.It Pa /etc/syslog.conf 337.Xr syslogd 8 338configuration file 339.El 340.Sh BUGS 341The effects of multiple selectors are sometimes not intuitive. 342For example 343.Dq mail.crit,*.err 344will select 345.Dq mail 346facility messages at the level of 347.Dq err 348or higher, not at the level of 349.Dq crit 350or higher. 351.Pp 352In networked environments, note that not all operating systems 353implement the same set of facilities. The facilities 354authpriv, cron, ftp, and ntp that are known to this implementation 355might be absent on the target system. Even worse, DEC UNIX uses 356facility number 10 (which is authpriv in this implementation) to 357log events for their AdvFS file system. 358.Sh SEE ALSO 359.Xr syslog 3 , 360.Xr syslogd 8 361