syslog-ng.conf — syslog-ng configuration file
syslog-ng.conf
NOTE: This manual page covers both editions of syslog-ng: syslog-ng Open Source Edition
and the commercial syslog-ng Premium Edition. Features that are only included in the Premium
Edition are marked with an asterisk (*). For details, see the
official syslog-ng website: http://www.balabit.com/network-security/syslog-ng/.
This manual page is only an abstract; for the complete documentation of syslog-ng, see The syslog-ng Administrator Guide .
The syslog-ng application is a flexible and highly scalable system logging application. Typically, syslog-ng is used to manage log messages and implement centralized logging, where the aim is to collect the log messages of several devices on a single, central log server. The different devices - called syslog-ng clients - all run syslog-ng, and collect the log messages from the various applications, files, and other sources. The clients send all important log messages to the remote syslog-ng server, where the server sorts and stores them.
The syslog-ng application reads incoming messages and forwards them to the selected destinations. The syslog-ng application can receive messages from files, remote hosts, and other sources.
Log messages enter syslog-ng in one of the defined sources, and are sent to one or more destinations.
Sources and destinations are independent objects; log paths define what syslog-ng does with a message, connecting the sources to the destinations. A log path consists of one or more sources and one or more destinations; messages arriving to a source are sent to every destination listed in the log path. A log path defined in syslog-ng is called a log statement.
Optionally, log paths can include filters. Filters are rules that select only certain messages, for example, selecting only messages sent by a specific application. If a log path includes filters, syslog-ng sends only the messages satisfying the filter rules to the destinations set in the log path.
Global objects (e.g., sources, destinations, log paths, or filters) are defined in the syslog-ng configuration file. Object definitions consist of the following elements:
Type of the object: One of source,
destination, log,
filter, or template.
Identifier of the object: A unique name identifying the object. When using a reserved word as an identifier, enclose the identifier in quotation marks.
![]() |
Tip |
|---|---|
Use identifiers that refer to the type of the object they identify. For
example, prefix source objects with |
Parameters: The parameters of the object, enclosed in
braces {parameters}.
Semicolon: Object definitions end with a semicolon
(;).
The syntax is summarized as follows:
type identifier { parameters };
The syntax of log statements is as follows:
log {
source(s1); source(s2); ...
filter(f1); filter(f2); ...
destination(d1); destination(d2); ...
flags(flag1[, flag2...]);
};
The following log statement sends all messages arriving to the localhost to a remote server.
source s_localhost { tcp(ip(127.0.0.1) port(1999) ); };
destination d_tcp { tcp("10.1.2.3" port(1999); localport(999)); };
log { source(s_localhost); destination(d_tcp); };
The syslog-ng application has a number of global options governing DNS usage, the timestamp format used, and other general points. Each option may have parameters, similarly to driver specifications. To set global options, add an option statement to the syslog-ng configuration file using the following syntax:
options { option1(params); option2(params); ... };
The sources, destinations, and filters available in syslog-ng are listed below. For details, see The syslog-ng Administrator Guide .
| Name | Description |
|---|---|
| internal() | Messages generated internally in syslog-ng. |
| unix-stream() | Opens the specified unix socket in SOCK_STREAM
mode and listens for incoming messages. |
| unix-dgram() | Opens the specified unix socket in SOCK_DGRAM
mode and listens for incoming messages. |
| file() | Opens the specified file and reads messages. |
| pipe(), fifo | Opens the specified named pipe and reads messages. |
| tcp() | Listens on the specified TCP port for incoming messages. |
| udp() | Listens on the specified UDP port for incoming messages. |
| tcp6() | Listens on the specified TCP port for incoming messages over IPv6. |
| udp6() | Listens on the specified UDP port for incoming messages over IPv6. |
| sun-stream(), sun-streams() | Opens the specified STREAMS device on Solaris
systems and reads incoming messages. |
Table 1.1. Source drivers available in syslog-ng
| Name | Description |
|---|---|
| file() | Writes messages to the specified file. |
| fifo(), pipe() | Writes messages to the specified named pipe. |
| program() | Forks and launches the specified program, and sends messages to its standard input. |
sql()*
|
Sends messages into an SQL database.
*Available only in syslog-ng Premium Edition. In
addition to the standard syslog-ng packages, the
sql() destination requires database-specific
packages to be installed. Refer to the section appropriate for your
platform in Chapter 4, Installing syslog-ng. |
| tcp() | Sends messages to the specified TCP port of a remote host. |
| tcp6() | Sends messages to the specified TCP port of a remote host using IPv6. |
| udp() | Sends messages to the specified UDP port of a remote host. |
| udp6() | Sends messages to the specified UDP port of a remote host using IPv6. |
| unix-dgram() | Sends messages to the specified unix socket in
SOCK_DGRAM style (BSD). |
| unix-stream() | Sends messages to the specified unix socket in
SOCK_STREAM style (Linux). |
| usertty() | Sends messages to the terminal of the specified user, if the user is logged in. |
Table 1.2. Destination drivers available in syslog-ng
| Name | Synopsis | Description |
|---|---|---|
| facility | facility(facility[,facility]) | Match messages having one of the listed facility code. An alternate syntax permits the use an arbitrary facility codes. |
| facility | facility(<numeric facility code>) | An alternate syntax for facility permitting
the use of an arbitrary facility code. Facility codes 0-23 are
predefined and can be referenced by their usual name. Facility codes
above 24 are not defined but can be used by this alternate syntax.
|
| filter() | filter(filtername) | Call another filter rule and evaluate its value. |
| host() | host(regexp) | Match messages by using a regular expression against the hostname field of log messages. |
| level() or priority() | level(pri[,pri1..pri2[,pri3]]) | Match messages based on priority. |
| match() | match(regexp) | Tries to match a regular expression to the message itself. |
| netmask() | netmask(ip/mask) | Check the sender's IP address whether it is in the specified IP subnet. |
| program() | program(regexp) | Match messages by using a regular expression against the program name field of log messages. |
Table 1.3. Filter functions in syslog-ng
Copyright © 2007 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/products/zorp/docs/legal_notice.bbq
© 2007-2008 BalaBit IT Security
Please send your comments or documentation bugs to: documentation@balabit.com