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.1. Procedure – Configuring syslog-ng on client hosts


To configure syslog-ng on a client 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. Configure the local sources to collect the log messages of the host. 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.

    Add sources to collect the messages from your log files. File sources look like this:

    source s_myfilesource {
            file("/var/log/myapplication.log" follow-freq(1)); };

    Name every source uniquely. For details on configuring file sources, see Section 6.3, file: Collecting messages from text files.


    Many applications send log messages to logfiles by default (for example, the Roundcube webmail client, or the ProFTPD FTP server), but can be configured to send them to syslog instead. If possible, it is recommended to reconfigure the application that way.


    The default configuration file of syslog-ng PE collects platform-specific log messages and the internal log messages of syslog-ng PE.

    source s_local {
  3. Create a network destination that points directly to the syslog-ng server, or to a local relay. The network destination greatly depends on the protocol that your log server or relay accepts messages. Many systems still use the legacy BSD-syslog protocol (RFC3162) over the unreliable UDP transport:

    destination d_network { network("" transport("udp")); };

    However, if possible, use the much more reliable IETF-syslog protocol over TCP transport:

    destination d_network { syslog("" transport("tcp")); };

    Make sure to use a destination that matches the source you configure on your syslog-ng server or relay. For details, see Section 2.13, Things to consider when forwarding messages between syslog-ng PE hosts.

  4. Create a log statement connecting the local sources to the syslog-ng server or relay. For example:

    log {
            source(s_local); destination(d_network); };
  5. If the logs will also be stored locally on the host, create local file 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"); };
  6. Create a log statement connecting the local sources to the file destination.


    The default configuration of syslog-ng PE has only one log statement:

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

    Example 4.1. The default configuration file of syslog-ng PE

    The following is the default configuration file of syslog-ng PE 7.0.8. It collects local log messages and the log messages of syslog-ng PE and saves them in the /var/log/messages file.

    @version: 7.0.8
    @include "scl.conf"
    source s_local { system(); internal(); };
    destination d_local {
                file("/var/log/messages"); };
    log { source(s_local); destination(d_local); };
    Example 4.2. A simple configuration for clients

    The following is a simple configuration file that collects local log messages and forwards them to a logserver using the IETF-syslog protocol.

    @version: 7.0.8
    @include "scl.conf"
    source s_local { system(); internal(); };
    destination d_syslog_tcp {
                 syslog("" transport("tcp") port(2010)); };
    log { source(s_local);destination(d_syslog_tcp); };

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