This section describes how to configure AxoSyslog as a relay.
This is the multi-page printable view of this section. Click here to print.
Configuring AxoSyslog relays
1 - Configuring AxoSyslog on relay hosts
To configure AxoSyslog on a relay host, complete the following steps:
-
Install the AxoSyslog application on the host. For details on installing AxoSyslog on specific operating systems, see Install AxoSyslog.
-
Configure the network sources that collect the log messages sent by the clients.
-
Create a network destination that points to the AxoSyslog server.
-
Create a log statement connecting the network sources to the AxoSyslog server.
-
Configure the local sources that collect the log messages of the relay host.
-
Create a log statement connecting the local sources to the AxoSyslog server.
-
Enable the
keep-hostname()
and disable thechain-hostnames()
options. (For details on how these options work, see Global options.)Note It is recommended to use these options on your AxoSyslog server as well. -
Set filters and options (for example, TLS encryption) as necessary.
NoteBy 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 relays
The following is a simple configuration file that collects local and incoming log messages and forwards them to a logserver using the IETF-syslog protocol.
@version: 4.10.0
@include "scl.conf"
options {
time-reap(30);
mark-freq(10);
keep-hostname(yes);
chain-hostnames(no);
};
source s_local {
system(); internal();
};
source s_network {
syslog(transport(tcp));
};
destination d_syslog_tcp {
syslog("192.168.1.5" transport("tcp") port(2010));
};
log {
source(s_local); source(s_network);
destination(d_syslog_tcp);
};
2 - How relaying log messages works
Depending on your exact needs about relaying log messages, there are many scenarios and AxoSyslog options that influence how the log message will look like on the logserver. Some of the most common cases are summarized in the following example:
Consider the following example: client-host > relay > server, where the IP address of client-host
is 192.168.1.2
. The client-host
device sends a syslog message to relay
. Depending on the settings of relay
, the following can happen.
-
By default, the
keep-hostname()
option is disabled, sorelay
writes the IP address of the sender host (in this case,192.168.1.2
) to the HOST field of the syslog message, discarding any IP address or hostname that was originally in the message. -
If the
keep-hostname()
option is enabled onrelay
, but name resolution is disabled (theuse-dns()
option is set tono
),relay
uses the HOST field of the message as-is, which is probably192.168.1.2
. -
To resolve the
192.168.1.2
IP address to a hostname onrelay
using a DNS server, use thekeep-hostname(no)
anduse-dns(yes)
options. If the DNS server is properly configured and reverse DNS lookup is available for the192.168.1.2
address, AxoSyslog will rewrite the HOST field of the log message toclient-host
.Note It is also possible to resolve IP addresses locally, without relying on the DNS server. For details on local name resolution, see Resolving hostnames locally. -
The above points apply to the AxoSyslog server (
server
) as well, so ifrelay
is configured properly, use thekeep-hostname(yes)
option onserver
to retain the proper HOST field. Settingkeep-hostname(no)
onserver
would result in AxoSyslog rewriting the HOST field to the address of the host that sent the message toserver
, which isrelay
in this case. -
If you cannot or do not want to resolve the
192.168.1.2
IP address onrelay
, but want to store your log messages onserver
using the IP address of the original host (that is,client-host
), you can enable thespoof-source()
option onrelay
. However,spoof-source()
works only under the following conditions:- The
syslog-ng
binary has been compiled with the--enable-spoof-source
option. - The log messages are sent using the highly unreliable UDP transport protocol. (Extremely unrecommended.)
- The