Configuring AxoSyslog on client hosts

Purpose:

To configure AxoSyslog on a client host, complete the following steps.

Steps:

  1. Install the AxoSyslog application on the host. For details installing AxoSyslog on specific operating systems, see Install AxoSyslog.

  2. Configure the local sources to collect the log messages of the host. Starting with version 3.2, AxoSyslog 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 system: Collect the system-specific log messages of a platform.

    To configure AxoSyslog, edit the syslog-ng.conf file with any regular text editor application. The location of the configuration file depends on the platform you are running AxoSyslog, and how you have installed AxoSyslog it.

    • Native packages of a platform (like the ones downloaded from Linux repositories) typically place the configuration file under the /etc/syslog-ng/ directory.
    • Containers: When running AxoSyslog in a container, typically you map an external file to the /etc/syslog-ng/syslog-ng.conf file within the container. Check the mapped volumes of your container, and edit the external file.
    • Kubernetes: If you’re running AxoSyslog in Kubernetes and have installed it with helm, usually you configure AxoSyslog by editing a values.yaml file, and redeploying AxoSyslog. Often the syslog-ng.conf part is under the config.raw section in the values.yaml file. For details, see Parameters of the AxoSyslog collector Helm chart.

    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 file: Collect messages from text files.

  3. Create a network destination that points directly to the AxoSyslog 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("10.1.2.3" transport("udp")); };
    

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

        destination d_network {
            syslog("10.1.2.3" transport("tcp"));
        };
    
  4. Create a log statement connecting the local sources to the AxoSyslog 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.

  6. Create a log statement connecting the local sources to the file destination.

  7. Set filters, macros and other features and options (for example, TLS encryption) as necessary.

Example: The default configuration file of AxoSyslog

The following is the default configuration file of AxoSyslog4.5.0. It collects local log messages and the log messages of AxoSyslog and saves them in the /var/log/messages file.

    @version: 4.5.0
    @include "scl.conf"
    source s_local {
        system(); internal();
    };
    destination d_local {
        file("/var/log/messages");
    };
    log {
        source(s_local); destination(d_local);
    };

Example: 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: 4.5.0
    @include "scl.conf"
    source s_local {
        system(); internal();
    };
    destination d_syslog_tcp {
        syslog("192.168.1.1" transport("tcp") port(2010));
    };
    log {
        source(s_local);destination(d_syslog_tcp);
    };