Created attachment 214687 [details] librenms.diff This patch adds a new rc_variable: librenms_logflags, which defaults to logging to a logfile. When overwriting this variable from rc.conf by eg "-S -T librenms", this can be used to use syslog instead of direct logfile logging. I default to logfile logging because not everyone wants to use the same syslog parameters. Also, I don't like ports including syslog or newsyslog sample files because of the various flags people tend to keep consistent. EG compression on or off for newsyslog rotation probably depends on if you have ZFS (already compressed) or UFS.
I my not get to this until June. PGCon is next week and BSDCan is the week after. My current priorities are there.
Created attachment 215481 [details] librenms.diff Rename librenms_logflags to librenms_daemonflags, to make it more general and correct.
Hi Dan, friendly bump :).
I've found another logging issue. In some cases librenms doesn't respect $config['log_dir']. With $config['log_dir'] = '/var/log/librenms'; it writes errors like below in the /usr/local/www/librenms/logs/librenms.log, though other poller log messages go in the /var/log/librenms/librenms.log. [2020-07-26 09:44:06] production.ERROR: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '35-5' for key 'ports_device_id_ifindex_unique' (SQL: UPDATE `ports` set `ifIndex`=5,`ifSpeed_pre v`=0,`ifHighSpeed_prev`=0,`poll_time`=1595745846,`poll_prev`=1592753465,`poll_period`=2992381 WHERE `port_id` = 75066) (SQL: UPDATE `ports` set `ifIndex`=5,`ifSpeed_prev`=0,`ifHighSpeed_prev`=0,`poll_time`=1 595745846,`poll_prev`=1592753465,`poll_period`=2992381 WHERE `port_id` = 75066)#0 /usr/local/www/librenms/includes/polling/ports.inc.php(896): dbUpdate(Array, 'ports', '`port_id` = ?', Array) #1 /usr/local/www/librenms/includes/polling/functions.inc.php(315): include('/usr/local/www/...') #2 /usr/local/www/librenms/poller.php(142): poll_device(Array, false) #3 {main}
(In reply to Alexander Moisseev from comment #4) Perhaps what you say is related to #246598
(In reply to Dan Langille from comment #5) https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246598
It is early. I need to wake up. :)
(In reply to Alexander Moisseev from comment #4) More recent versions of LibreNMS do not use config.php as much as previous versions. I found this: config/logging.php: 'path' => env('APP_LOG', \LibreNMS\Config::get('log_file', base_path('logs/librenms.log'))), config/logging.php: 'path' => env('APP_LOG', \LibreNMS\Config::get('log_file', base_path('logs/librenms.log'))),
Please try adding this line to /usr/local/www/librenms/.env: APP_LOG=/var/log/librenms/librenms.log
(In reply to Dan Langille from comment #9) Thanks, it worked. Now LibreNMS writes those errors in the proper place (/var/log/librenms/librenms.log).
A commit references this bug: Author: dvl Date: Sun Jul 26 17:48:43 UTC 2020 New revision: 543487 URL: https://svnweb.freebsd.org/changeset/ports/543487 Log: Fix double logging HEADS UP: See UPDATING for changes affecting your upgrade. New installs not affected. This patch adds a new rc_variable: librenms_daemonflags The -T option is gone as that will force a log to syslog, doubling up on log entries. A new APP_LOG setting has been added to the .env file. Please update and move your logs. See UPDATING. PR: 246598 Submitted by: Dries Michiels <driesm.michiels@gmail.com> Changes: head/UPDATING head/net-mgmt/librenms/Makefile head/net-mgmt/librenms/files/librenms.in head/net-mgmt/librenms/files/patch-.env.example head/net-mgmt/librenms/files/pkg-message.in
Thank you.