# Configuring AxoSyslog on server hosts

## Purpose:

To configure AxoSyslog on a server 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](../../docs/axosyslog-core/install/index.md).

  2. 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](../../docs/axosyslog-core/chapter-sources/source-system/index.md).

  3. 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](../../docs/axosyslog-core/install/docker/index.md#customize-the-configuration) 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 Helm chart](../../docs/axosyslog-core/install/helm/helm-chart-parameters/index.md).

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(10.1.2.3) transport("udp"));
        };
    
```

However, if possible, use the much more reliable TCP transport:
```
 source s_network {
            syslog(ip(10.1.2.3) transport("tcp"));
        };
    
```

For other options, see [syslog: Collect messages using the IETF-syslog protocol](../../docs/axosyslog-core/chapter-sources/source-syslog/index.md) and [tcp, tcp6, udp, udp6: OBSOLETE - Collect messages from remote hosts using the BSD syslog protocol](../../docs/axosyslog-core/chapter-sources/configuring-sources-tcpudp/index.md).

Note Starting with AxoSyslog 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 AxoSyslog 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 [template and rewrite: Format, modify, and manipulate log messages](../../docs/axosyslog-core/chapter-manipulating-messages/index.md).

  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.

Note

By default, the AxoSyslog server treats 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 AxoSyslog server, use the `keep-hostname(yes)` option both on the AxoSyslog relay and the AxoSyslog 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: A simple configuration for servers

The following is a simple configuration file for AxoSyslog that collects incoming log messages and stores them in a text file.
```
 @version: 4.24
             @include "scl.conf"
             options {
                 time-reap(30);
                 mark-freq(10);
                 keep-hostname(yes);
             };
             source s_local {
                 system(); internal();
             };
             source s_network {
                 syslog(transport(tcp));
             };
             destination d_logs {
                 file(
                     "/var/log/syslog-ng/logs.txt"
                     owner("root")
                     group("root")
                     perm(0777)
                     );
                 };
             log {
                 source(s_local); source(s_network); destination(d_logs);
             };
         
```




Last modified October 16, 2025: [Fix @version config numbers in examples (89688d8)](<https://github.com/axoflow/axosyslog-core-docs/commit/89688d8719a35ac2c048319e8fa82c11c6cad085>)