syslog-ng documentation

Your main source of knowledge

The syslog-ng product family has an extensive documentation, covering everything from how to install a product to the most complex configuration and settings descriptions. If you cannot find an answer to your question, try the mailing list - our community is always eager to help.

syslog-ng Premium Edition


4.2. Procedure – Configuring syslog-ng on server hosts


To configure syslog-ng on a server host, complete the following steps.


  1. Install the syslog-ng application on the host. For details installing syslog-ng on specific operating systems, see Chapter 3, Installing syslog-ng.

  2. Starting with version 3.2, syslog-ng PE automatically collects the log messages that use the native system logging method of the platform, for example, messages from /dev/log on Linux, or /dev/klog on FreeBSD. For a complete list of messages that are collected automatically, see Section 6.12, system: Collecting the system-specific log messages of a platform.

  3. Configure the network sources that collect the log messages sent by the clients and relays. How the network sources should be configured depends also on the capabilities of your client hosts: many older networking devices support only the legacy BSD-syslog protocol (RFC3164) using UDP transport:

    source s_network { syslog(ip( transport("udp")); };

    However, if possible, use the much more reliable TCP transport:

    source s_network { syslog(ip( transport("tcp")); };

    For other options, see Section 6.11, syslog: Collecting messages using the IETF syslog protocol (syslog() driver) and Section 6.15, tcp, tcp6, udp, udp6: Collecting messages from remote hosts using the BSD syslog protocol.


    Starting with syslog-ng PE version 3.2, the syslog() source driver can handle both BSD-syslog (RFC 3164) and IETF-syslog (RFC 5424-26) messages.

  4. Create local destinations that will store the log messages, for example file- or program destinations. The default configuration of syslog-ng PE places the collected messages into the /var/log/messages file:

    destination d_local {
        file("/var/log/messages"); };

    If you want to create separate logfiles for every client host, use the ${HOST} macro when specifying the filename, for example:

    destination d_local {
        file("/var/log/messages_${HOST}"); };

    For details on further macros and how to use them, see Chapter 11, Manipulating messages.

  5. Create a log statement connecting the sources to the local destinations.

    log {
            source(s_local); source(s_network); destination(d_local); };
  6. Set filters, options (for example TLS encryption) and other advanced features as necessary.


    By default, the syslog-ng server will treat the relayed messages as if they were created by the relay host, not the host that originally sent them to the relay. In order to use the original hostname on the syslog-ng server, use the keep-hostname(yes) option both on the syslog-ng relay and the syslog-ng server. This option can be set individually for every source if needed.

    If you are relaying log messages and want to resolve IP addresses to hostnames, configure the first relay to do the name resolution.

    Example 4.3. A simple configuration for servers

    The following is a simple configuration file for syslog-ng Premium Edition that collects incoming log messages and stores them in a text file.

    @version: 7.0.8
    @include "scl.conf"
        options {
        source s_local { system(); internal(); };
        source s_network {
        destination d_logs {
                ); };
        log { source(s_local); source(s_network); destination(d_logs); };

    If you experience difficulties, see Chapter 18, Troubleshooting syslog-ng for tips on solving common problems.