Langue: en

Version: 11/30/2009 (fedora - 01/12/10)

Section: 5 (Format de fichier)


syslog-ng.conf - syslog-ng configuration file




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:

This manual page is only an abstract; for the complete documentation of syslog-ng, see The syslog-ng Administrator Guide [1].

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, parser, rewrite rule, 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 s_, destinations with d_, and so on.
*Parameters: The parameters of the object, enclosed in braces {parameters}.
*Semicolon: Object definitions end with a semicolon (;).

The syntax is summarized as follows:

The syntax of log statements is as follows:

 log {
     source(s1); source(s2); ... 
     optional_element(filter1|parser1|rewrite1); optional_element(filter2|parser2|rewrite2);... 
     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( port(1999) ); };
 destination d_tcp { tcp("" 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 [1].

Table 1. Source drivers available in syslog-ng

Name Description
internal() Messages generated internally in syslog-ng.
file() Opens the specified file and reads messages.
pipe(), fifo Opens the specified named pipe and reads messages.
program() Opens the specified application and reads messages from its standard
Opens the specified STREAMS device on Solaris
                            systems and reads incoming messages.
syslog() Listens for incoming messages using the new IETF-standard syslog
tcp(), tcp6() Listens on the specified TCP port for incoming messages using the
                            protocol over IPv4 and IPv6 networks, respectively.
udp(), udp6() Listens on the specified UDP port for incoming messages using the
                            protocol over IPv4 and IPv6 networks, respectively.
unix-dgram() Opens the specified unix socket in SOCK_DGRAM
                            mode and listens for incoming messages.
unix-stream() Opens the specified unix socket in SOCK_STREAM
                            mode and listens for incoming messages.

Table 2. Destination drivers available in syslog-ng

Name Description
file() Writes messages to the specified file.
logstore()* Writes messages to the specified binary logstore file.
                            *Available only in syslog-ng Premium
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. 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 ???.
syslog() Sends messages to the specified remote host using the IETF-syslog protocol.
                            The IETF standard supports message transport using the UDP, TCP, and TLS
                            networking protocols.
tcp() and tcp6() Sends messages to the specified TCP port of a remote host using the
                            protocol over IPv4 and IPv6, respectively.
udp() and udp6() Sends messages to the specified UDP port of a remote host using the
                            protocol over IPv4 and IPv6, respectively.
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 3. Filter functions 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) Match a regular expression to the headers and the message itself
                            (i.e., the values returned by the MSGHDR and
                                MSG macros). Note that in syslog-ng version
                            2.1 and earlier, the match() filter was applied
                            only to the text of the message, excluding the headers. This
                            functionality has been moved to the message()
                            filter. To limit the scope of the match to a specific part of the
                            message (identified with a macro), use the match(regexp
message() message(regexp) Match a regular expression to the text of the log message, excluding
                            the headers (i.e., the value returned by the MSG
                            macros). Note that in syslog-ng version 2.1 and earlier, this
                            functionality was performed by the match()
netmask() netmask(ip/mask) Select only messages sent by a host whose IP address belongs to the
                            specified IP subnet. Note that this filter checks the IP address of the
                            last-hop relay (the host that actually sent the message to syslog-ng),
                            not the contents of the HOST field of the
program() program(regexp) Match messages by using a regular expression against the program name
                            field of log messages.
source() string Select messages of a source statement. This filter can be used in
                            embedded log statements if the parent statement contains multiple source
                            groups --- only messages originating from the selected source
                            group are sent to the destination of the embedded log statement.
tags() tag Select messages labeled with the specified tag. Every message
                            automatically has the tag of its source in
                            format. This option is available only in syslog-ng 3.1 and later.






The syslog-ng Administrator Guide [1]

If you experience any problems or need help with syslog-ng, visit the syslog-ng mailing list [2]

For news and notifications about the documentation of syslog-ng, visit the BalaBit Documentation Blog[3].


This manual page was written by the BalaBit Documentation Team <>.

Copyright © 2000-2009 BalaBit IT Security Ltd. Published under the Creative Commons Attribution-Noncommercial-No Derivative Works (by-nc-nd) 3.0 license. See for details. The latest version is always available at



          The syslog-ng Administrator Guide


          syslog-ng mailing list

BalaBit Documentation Blog