Controlling syslog verbosity?

I'm pretty new to Pi-hole and am loving it - not problems at all with getting it running on DietPi. I had a quick question - is it possible to control the verbosity of the logging - I couldn't see a setting. There's quite a lot of chat - mostly to do with php

For example

Apr 23 11:09:01 DietPi CRON[705]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Apr 23 11:09:01 DietPi systemd[1]: Starting Clean php session files...
Apr 23 11:09:02 DietPi systemd[1]: phpsessionclean.service: Succeeded.
Apr 23 11:09:02 DietPi systemd[1]: Started Clean php session files.
Apr 23 11:10:01 DietPi CRON[783]: (root) CMD (   PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updatechecker local)
Apr 23 11:17:01 DietPi CRON[843]: (root) CMD (cd / && run-parts --report /etc/cron.hourly)
Apr 23 11:20:01 DietPi CRON[868]: (root) CMD (   PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updatechecker local)
Apr 23 11:30:01 DietPi CRON[946]: (root) CMD (   PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updatechecker local)

That's just 20 mins of normal running and it makes actually seeing anything relevent in syslog tricky, plus it means it's constantly writing to the sd card with no real reason.

Anyway to turn it down to "errors only"?

ta

pete S

This is an OS level function, not a Pi-hole issue.

Since you are running DietPi, please contact the DietPi maintainer:

Hi Pete,

this is not a Pi-hole question, but an OS question. But let me try to answer it. Moderators might want to move it to the Community Help subforum.

The logs you see (I guess via journalctl?) are not triggered by Pi-hole directly, but by system services, controlled by systemd, in particular the Cron daemon and phpsessionclean.service. There is no way to control the verbosity level of systemd-journald and it also would be the wrong place to filter it. What you can do is setting a log level for messages that are forwarded to the console or classic syslog daemons, like rsyslog (for /var/log/syslog|kern.log|daemon.log|...) from systemd-journald. Have a look here how to configure it: journald.conf(5) โ€” systemd โ€” Debian bookworm โ€” Debian Manpages

Addressing the explicit messages you see:

  • phpsessionclean.service is AFAIK not required in case of Pi-hole only, as Pi-hole does not use the PHP session facility (?). So you could theoretically disable it: systemctl disable --now phpsessionclean
    But I would leave it active. It does not hurt and you might install other PHP applications that use PHP sessions.
  • The Cron sessionclean job is actually a fallback, only required if systemd is not used as service manager. So you could remove that cron job without risk (for others reading this: only IF systemd is used as service manager and IF phpsessionclean.service is active!): rm /etc/cron.d/php
    PHP package upgrades will ask you about that missing file, and if you choose to leave it removed, /etc/cron.d/php.dpkg-dist will be created, but due to the dot in it's filename, it won't be processed by Cron.
  • The Pi-hole update check makes sense, and it's good to see it running regularly, so nothing to change here.

Just in theory, Cron job logs can be disabled completely or adjusted. See /etc/default/cron. EXTRA_OPTS="-L 0" would disable all logs for Cron jobs. But as you won't see any hint whether jobs are running or not (e.g. because of an issue), I would leave them enabled, or even increase the verbosity to show a note about job failures explicitly. I personally use EXTRA_OPTS="-L 5" to show job starts and failures.

Best regards

1 Like

That's brilliant Michael - thanks for the pointers. I'll go do some digging

pete S

Btw, if it's just about seeing relevant system logs, you can filter them with journalctl directly:

journalctl -p 4

Shows all logs up to "warnings". 3=errors, 2=critical errors ...

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.