Project

General

Profile

Actions

Regression #14283

closed

Nothing is logged through ``syslog`` if the configuration contains an empty ``<syslogd>`` section or if that section is not present

Added by Chris Linstruth about 1 year ago. Updated 11 months ago.

Status:
Resolved
Priority:
High
Assignee:
Category:
Logging
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
23.05
Release Notes:
Default
Affected Version:
2.7.0
Affected Architecture:

Description

/var/etc/syslog.d empty. Nothing is being logged to /var/log files.

Possibly related to #13446 src/etc/inc/syslog.inc#L216

Actions #1

Updated by Jim Pingle about 1 year ago

  • Subject changed from /var/etc/syslog.d empty. Nothing is going to syslog files. to Nothing is logged through ``syslog`` if the configuration contains an empty ``<syslogd>`` section or if that section is not present
  • Priority changed from Normal to High
  • Target version set to 2.7.0
  • Plus Target Version set to 23.05

In source:src/etc/inc/syslog.inc#L216 it checks for an empty syslog section which isn't really a valid test. Before the change in #13446 it checked if the section was there, not if it was empty. But even that test wasn't really valid. As a result if the section is not there, or if it's empty, then /var/etc/syslog.d/pfSense.conf is not written, so nothing is logged.

Having no settings should be the same as the default settings, which should still setup the logs.

Some care will be needed to ensure the $syslogcfg variable is at least an array if it's empty, and that any options inside that array are accessed safety.

Actions #2

Updated by Jim Pingle about 1 year ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100
Actions #3

Updated by Jim Pingle about 1 year ago

The code in this area is slightly different in plus which makes generating a patch more difficult. In the interest of minimizing changes to older systems, this diff should apply against 23.01 and have the correct net effect without being as nice/proper a fix as what I committed for 23.05/2.7.0.

diff --git a/src/etc/inc/syslog.inc b/src/etc/inc/syslog.inc
index feced73bd3..dd875cfd6d 100644
--- a/src/etc/inc/syslog.inc
+++ b/src/etc/inc/syslog.inc
@@ -217,7 +217,7 @@ EOD;
        safe_mkdir("{$g['varetc_path']}/syslog.d");

        $syslogd_extra = "";
-       if (!empty($syslogcfg)) {
+       if (true) {
                $separatelogfacilities = array('ntp', 'ntpd', 'ntpdate', 'charon', 'ipsec_starter', 'openvpn', 'poes', 'l2tps', 'hostapd', 'dnsmasq', 'named', 'filterdns', 'unbound', 'dhcpd', 'dhcrelay', 'dhclient', 'dhcp6c', 'dpinger', 'radvd', 'routed', 'zebra', 'ospfd', 'ospf6d', 'bgpd', 'watchfrr', 'miniupnpd', 'igmpproxy', 'filterlog');
                if (watchdogd_enabled()) {
                        array_push($separatelogfacilities, 'watchdogd');

Also as a workaround, visiting the system log settings and pressing Save without changing anything would also fix the original issue, as that would define the syslog section of the config with content sufficient it would pass the original test.

Actions #4

Updated by Danilo Zrenjanin about 1 year ago

  • Status changed from Feedback to Resolved

Tested the diff against:

23.01-RELEASE (amd64)
built on Fri Feb 10 20:06:33 UTC 2023
FreeBSD 14.0-CURRENT

It fixes the issue. I am marking this ticket resolved.

Actions #5

Updated by Jim Pingle 11 months ago

  • Affected Version set to 2.7.0
Actions

Also available in: Atom PDF