Configuring AxoSyslog on client hosts
Purpose:
To configure AxoSyslog on a client host, complete the following steps.
Steps:
-
Install the AxoSyslog application on the host. For details installing AxoSyslog on specific operating systems, see Install AxoSyslog.
-
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 thesyslog-ng.conf
part is under theconfig.raw
section in thevalues.yaml
file. For details, see Parameters of the AxoSyslog 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.
Note 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.NoteThe default configuration file of AxoSyslog collects platform-specific log messages and the internal log messages of AxoSyslog.
source s_local { system(); internal(); };
- Native packages of a platform (like the ones downloaded from Linux repositories) typically place the configuration file under the
-
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")); };
-
Create a log statement connecting the local sources to the AxoSyslog server or relay. For example:
log { source(s_local); destination(d_network); };
-
If the logs will also be stored locally on the host, create local file destinations.
NoteThe default configuration of AxoSyslog places the collected messages into the
/var/log/messages
file:destination d_local { file("/var/log/messages"); };
-
Create a log statement connecting the local sources to the file destination.
NoteThe default configuration of AxoSyslog has only one log statement:
log { source(s_local); destination(d_local); };
-
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.9.0. It collects local log messages and the log messages of AxoSyslog and saves them in the /var/log/messages
file.
@version: 4.9.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.9.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);
};