---
title: "system: Collect the system-specific log messages of a platform"
url: "https://axoflow.com/docs/axosyslog-core/4.28/chapter-sources/source-system/"
last_modified: "2026-09-30T14:50:17+02:00"
---

> For the complete documentation index, see [llms.txt](https://axoflow.com/docs/axosyslog-core/4.28/llms.txt).

# system: Collect the system-specific log messages of a platform

Starting with version 3.2, AxoSyslog can automatically collect the system-specific log messages of the host on a number of platforms using the `system()` driver. If the `system()` driver is included in the AxoSyslog configuration file, AxoSyslog automatically adds the following sources to the AxoSyslog configuration.

> **Note:**
> AxoSyslog versions 3.2-3.3 used an external script to generate the `system()` source, but this was problematic in certain situations, for example, when the host used a strict AppArmor profile. Therefore, the `system()` source is now generated internally in AxoSyslog.

The `system()` driver is also used in the default configuration file of AxoSyslog. For details on the default configuration file, see [Example: The default configuration file of AxoSyslog](https://axoflow.com/docs/axosyslog-core/4.28/quickstart/configure-clients/index.md). Starting with AxoSyslog version 3.6, you can use the `system-expand` command-line utility (which is a shell script, located in the `modules/system-source/` directory) to display the configuration that the `system()` source will use.

> **Warning:**
> If AxoSyslog does not recognize the platform it is installed on, it does not add any sources.

Starting with version 3.6, AxoSyslog parses messages complying with the [Splunk Common Information Model (CIM)](http://docs.splunk.com/Documentation/CIM/latest/User/Overview) and marked with `@cim` as JSON messages (for example, the `ulogd` from the `netfilter` project can emit such messages). That way, you can forward such messages without losing any information to CIM-aware applications (for example, Splunk).

Sources automatically added by AxoSyslog

| Platform | Message source |
| --- | --- |
| AIX | `unix-dgram("/dev/log");` |
| FreeBSD | `unix-dgram("/var/run/log");` `unix-dgram("/var/run/logpriv" perm(0600));` `file("/dev/klog" follow-freq(0) program-override("kernel") flags(no-parse));` For FreeBSD versions earlier than 9.1, `follow-freq(1)` is used. |
| GNU/kFreeBSD | `unix-dgram("/var/run/log");` `file("/dev/klog" follow-freq(0) program-override("kernel"));` |
| HP-UX | `pipe("/dev/log" pad-size(2048));` |
| Linux | Note that on Linux, the `so-rcvbuf()` option of the `system()` source is automatically set to 8192.  If the host is running under systemd, AxoSyslog reads both syslog and kernel messages directly from the systemd journal file using the `systemd-journal()` source. In this case, AxoSyslog doesn't read from `/dev/log` nor `/proc/kmsg`.  If the kernel of the host is version 3.5 or newer, and `/dev/kmsg` is seekable, AxoSyslog will use that instead of `/proc/kmsg`, using the `multi-line-mode(indented)`, `keep-timestamp(no)`, and the `format(linux-kmsg)` options.  If AxoSyslog is running in a jail or a Linux Container (LXC), it will not read from the `/dev/kmsg` or `/proc/kmsg` files.   - With systemd: `systemd-journal();` - Without systemd, on kernel 3.5 or newer: `unix-dgram("/dev/log");   file("/dev/kmsg" program-override("kernel") flags(kernel) format("linux-kmsg") keep-timestamp(no));` - Without systemd, on kernels older than 3.5: `unix-dgram("/dev/log");   file("/proc/kmsg" program-override("kernel") flags(kernel) keep-timestamp(no));` |
| macOS | `file("/var/log/system.log" follow-freq(1));` **Note:** Starting with version 3.7, the AxoSyslog`system()` driver automatically extracts the msgid from the message (if available), and stores it in the `.solaris.msgid` macro. To extract the msgid from the message without using the `system()`driver, use the `extract-solaris-msgid()` parser. You can find the exact source of this parser in the [AxoSyslog GitHub repository](https://github.com/axoflow/axosyslog/blob/master/scl/solaris/plugin.conf). |
| NetBSD | `unix-dgram("/var/run/log");` **Note:** Starting with version 3.7, the AxoSyslog`system()` driver automatically extracts the msgid from the message (if available), and stores it in the `.solaris.msgid` macro. To extract the msgid from the message without using the `system()`driver, use the `extract-solaris-msgid()` parser. You can find the exact source of this parser in the [AxoSyslog GitHub repository](https://github.com/axoflow/axosyslog/blob/master/scl/solaris/plugin.conf). |
| OpenBSD | `openbsd();` |
| Solaris 8 | `sun-streams("/dev/log");` **Note:** Starting with version 3.7, the AxoSyslog`system()` driver automatically extracts the msgid from the message (if available), and stores it in the `.solaris.msgid` macro. To extract the msgid from the message without using the `system()`driver, use the `extract-solaris-msgid()` parser. You can find the exact source of this parser in the [AxoSyslog GitHub repository](https://github.com/axoflow/axosyslog/blob/master/scl/solaris/plugin.conf). |
| Solaris 9 | `sun-streams("/dev/log" door("/etc/.syslog_door"));` **Note:** Starting with version 3.7, the AxoSyslog`system()` driver automatically extracts the msgid from the message (if available), and stores it in the `.solaris.msgid` macro. To extract the msgid from the message without using the `system()`driver, use the `extract-solaris-msgid()` parser. You can find the exact source of this parser in the [AxoSyslog GitHub repository](https://github.com/axoflow/axosyslog/blob/master/scl/solaris/plugin.conf). |
| Solaris 10 | `sun-streams("/dev/log" door("/var/run/syslog_door"));` **Note:** Starting with version 3.7, the AxoSyslog`system()` driver automatically extracts the msgid from the message (if available), and stores it in the `.solaris.msgid` macro. To extract the msgid from the message without using the `system()`driver, use the `extract-solaris-msgid()` parser. You can find the exact source of this parser in the [AxoSyslog GitHub repository](https://github.com/axoflow/axosyslog/blob/master/scl/solaris/plugin.conf). |

## `system()` source options

The `system()` driver has the following options:

## hook-commands()

*Description:* This option makes it possible to execute external programs when the relevant driver is initialized or torn down. The `hook-commands()` can be used with all source and destination drivers with the exception of the `usertty()` and `internal()` drivers.

> **Note:**
> The AxoSyslog application must be able to start and restart the external program, and have the necessary permissions to do so. For example, if your host is running AppArmor or SELinux, you might have to modify your AppArmor or SELinux configuration to enable AxoSyslog to execute external applications.

### Using `hook-commands()` when AxoSyslog starts or stops

To execute an external program when AxoSyslog starts or stops, use the following options:

#### `startup()`

| Type: | string |
| --- | --- |
| Default: | N/A |

*Description:* Defines the external program that is executed as AxoSyslog starts.

#### `shutdown()`

| Type: | string |
| --- | --- |
| Default: | N/A |

*Description:* Defines the external program that is executed as AxoSyslog stops.

### Using the hook-commands() when AxoSyslog reloads

To execute an external program when the AxoSyslog configuration is initiated or torn down, for example, on startup/shutdown or during a AxoSyslog reload, use the following options:

#### `setup()`

| Type: | string |
| --- | --- |
| Default: | N/A |

*Description:* Defines an external program that is executed when the AxoSyslog configuration is initiated, for example, on startup or during a AxoSyslog reload.

#### `teardown()`

| Type: | string |
| --- | --- |
| Default: | N/A |

*Description:* Defines an external program that is executed when the AxoSyslog configuration is stopped or torn down, for example, on shutdown or during a AxoSyslog reload.

### Example: Using hook-commands() with a network source

In the following example, the `hook-commands()` is used with the `network()` driver and it opens an [iptables](https://en.wikipedia.org/wiki/Iptables "https://en.wikipedia.org/wiki/Iptables") port automatically as AxoSyslog is started/stopped.

The assumption in this example is that the `LOGCHAIN` chain is part of a larger ruleset that routes traffic to it. Whenever the AxoSyslog created rule is there, packets can flow, otherwise the port is closed.

```shell
source {
    network(transport(udp)
    hook-commands(
          startup("iptables -I LOGCHAIN 1 -p udp --dport 514 -j ACCEPT")
          shutdown("iptables -D LOGCHAIN 1")
        )
     );
};
```

Last modified September 30, 2026: [Fold small options pages into the main source page (3b62180c)](https://github.com/axoflow/axosyslog-core-docs/commit/3b62180c24b54091714b1e47056ce1ff25020ad7)
