Skip to content

Commit

Permalink
Merge pull request #129 from cgzones/config
Browse files Browse the repository at this point in the history
Configuration related tweaks
  • Loading branch information
ssahani authored Nov 6, 2024
2 parents 085384d + 435d005 commit 4561586
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ systemd-netlogd reads configuration files named `/etc/systemd/netlogd.conf` and
Controls whether log messages received by the systemd-netlogd daemon shall be forwarded to a unicast UDP address or multicast UDP network group in syslog RFC 5424 format. The the address string format is similar to socket units. See systemd.socket(1)

Protocol=
Specifies whether to use udp, tcp, tls or dtls (Datagram Transport Layer Security) protocol. Defaults to udp.
Specifies whether to use udp, tcp, tls or dtls (Datagram Transport Layer Security) protocol. Defaults to udp.

LogFormat=
Specifies whether to use RFC 5424 format or RFC 3339 format. Takes one of rfc5424 or rfc3339. Defaults to rfc5424.
Expand All @@ -65,7 +65,7 @@ systemd-netlogd reads configuration files named `/etc/systemd/netlogd.conf` and
Takes a directory path. Specifies whether to operate on the specified journal directory DIR instead of the default runtime and system journal paths.
Namespace=
Takes a journal namespace identifier string as argument. If not specified the data collected by the default namespace is shown. If specified shows the log data of the specified namespace instead. If the namespace is specified as "*" data from all namespaces is shown, interleaved. If the namespace identifier is prefixed with "+" data from the specified namespace and the default namespace is shown, interleaved, but no other
Takes a journal namespace identifier string as argument. If not specified the data collected by the default namespace is shown. If specified shows the log data of the specified namespace instead. If the namespace is specified as "*" data from all namespaces is shown, interleaved. If the namespace identifier is prefixed with "+" data from the specified namespace and the default namespace is shown, interleaved, but no other.

ConnectionRetrySec=
Specifies the minimum delay before subsequent attempts to contact a Log server are made. Takes a time span value. The default unit is seconds, but other units may be specified, see systemd.time(5). Defaults to 30 seconds and must not be smaller than 1 second.
Expand Down
23 changes: 23 additions & 0 deletions src/netlog/netlog-conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,5 +216,28 @@ int manager_parse_config_file(Manager *m) {
m->connection_retry_usec = DEFAULT_CONNECTION_RETRY_USEC;
}

if (m->auth_mode != OPEN_SSL_CERTIFICATE_AUTH_MODE_DENY
&& m->protocol != SYSLOG_TRANSMISSION_PROTOCOL_TLS
&& m->protocol != SYSLOG_TRANSMISSION_PROTOCOL_DTLS)
log_warning("TLSCertificateAuthMode= set but unencrypted %s connection specified.", protocol_to_string(m->protocol));

if (m->dir && m->namespace)
log_warning("Ignoring Namespace= setting since Directory= is set.");

if (m->structured_data && m->syslog_structured_data)
log_warning("Ignoring UseSysLogStructuredData= since StructuredData= is set.");

if (timestamp_is_set(m->keep_alive_time) && !m->keep_alive)
log_warning("Ignoring KeepAliveTimeSec= since KeepAlive= is not set.");

if (m->keep_alive_interval > 0 && !m->keep_alive)
log_warning("Ignoring KeepAliveIntervalSec= since KeepAlive= is not set.");

if (m->keep_alive_cnt > 0 && !m->keep_alive)
log_warning("Ignoring KeepAliveProbes= since KeepAlive= is not set.");

if (m->send_buffer != 0 && (m->send_buffer < 4096 || m->send_buffer > 128 * 1024 * 1024))
log_warning("SendBuffer= set to an suspicious value of %zu.", m->send_buffer);

return 0;
}
2 changes: 1 addition & 1 deletion src/netlog/netlog-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static int manager_read_journal_input(Manager *m) {
message, hostname,
pid,
r >= 0 ? &tv : NULL,
m->structured_data ? structured_data : NULL,
structured_data,
m->syslog_msgid ? msgid : NULL);
}

Expand Down
2 changes: 1 addition & 1 deletion src/netlog/netlog-protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ int format_rfc5424(Manager *m,
/* Eighth: [structured-data] */
if (m->structured_data)
IOVEC_SET_STRING(iov[n++], m->structured_data);
else if (syslog_structured_data)
else if (m->syslog_structured_data && syslog_structured_data)
IOVEC_SET_STRING(iov[n++], syslog_structured_data);
else
IOVEC_SET_STRING(iov[n++], RFC_5424_NILVALUE);
Expand Down

0 comments on commit 4561586

Please sign in to comment.