Skip to content
Snippets Groups Projects
Commit 90428d2d authored by Thomas Bellman's avatar Thomas Bellman Committed by Hans Persson
Browse files

Handle syslog server with multiple addresses.

When we refactored the setup of sending syslogs to a central syslog
server, we intended for the code to handle the case where the name of
the server resolved to multiple addresses, e.g. because it had both
IPv4 and IPv6 addresses.  We obviously did not test that properly, as
setting the ipfamily parameter of logging::syslog_client to list both
families, caused it to write "130.236.101.112001:6b0:17:1::1:11" to
the rsyslog configuration; that's what you get when trying to format
a list ["130.236.101.11", "2001:6b0:17:1::1:11"] (the current addresses
of our central log server) using sprintf %s...

The proper thing to do is to just pick the first address returned by
resolve_ipnets().  Do so.

This was originally commit e1f2d29570c0 in intserv.
parent 82781b3b
No related branches found
No related tags found
No related merge requests found
......@@ -112,7 +112,7 @@ class logging::syslog_client(
$cfg_d_file = '/etc/rsyslog.d/log-to-logserver.conf'
$syslogaddr = resolve_ipnets($logserver, $ipfamily, 'stable')
$syslogaddrs = resolve_ipnets($logserver, $ipfamily, 'stable')
$protoprefix = $protocol ? {
'udp' => '@',
......@@ -127,7 +127,7 @@ class logging::syslog_client(
$cfg_line = sprintf(
"%s\t\t%s[%s]%s;%s\n",
$selector, $protoprefix, $syslogaddr, $xport, $format)
$selector, $protoprefix, $syslogaddrs[0], $xport, $format)
file {
$cfg_d_file:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment