Red Hat Bugzilla – Bug 1462615
Default installation does not report on systemd services requiring journalctl access to their logs
Last modified: 2017-07-12 22:02:23 EDT
After a clean (re-)installation of F25 and installing logwatch I found that services which no longer write their own log files were not being reported by logwatch. I was specifically looking for the sshd report which I was seeing prior to the re-installation.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Clean F25 installation
2. dnf install logwatch
3. Execute logwatch
No report on sshd logins or, I think, any service for which there is no longer a logfile, even though /usr/share/logwatch/default.conf/services all refer to logfiles rather than a journalctl-based log.
Report section "SSHD BEGIN" through "SSHD END" reporting logins (esp. failed ones) via ssh.
With some guidance from "Bjorn" on the logwatch forum, I got logwatch to display information available only through journalctl. I had to create the following three files:
 /etc/logwatch/conf/services/sshd.conf containing:
LogFile = null
*JournalCtl = "--output=cat --unit=sshd.service"
 /etc/logwatch/conf/logfiles/null.conf containing:
LogFile = null.log
 /var/log/null.log, a non-empty log file containing:
This is a dummy log file to help logwatch show journalctl logs
With these three files in place my logwatch report now includes an SSHD section:
--------------------- SSHD Begin ------------------------
Users logging in through sshd:
192.168.0.100: 5 times
---------------------- SSHD End -------------------------
NOTE: /usr/share/logwatch/scripts/journalctl contains the following text, but it is not correct for services that do not use their own log files:
# The purpose of this script is to pass the output of the journalctl
# command to the logwatch parsers. The corresponding conf/logfile
# can be simple. The following example shows a logfile with two lines:
# LogFile = /dev/null
# *JournalCtl = "--output=cat --unit=service_name.service"
This might work on the logfiles configuration but not for a services configuration.
There might be a temptation to classify this as a documentation bug except that all of the /usr/share/logwatch/default.conf/services/*.conf files for systemd services won't generate the expected report section. They need to be modified for logwatch to produce any output. (Or you have to install another utility to duplicate entries from journalctl in their own log files.
Changing to F26 because this still isn't fixed.
I had to do a clean install of F25 Workstation and am not getting any output at all from Logwatch, even after the above changes
(In reply to Gerald Cox from comment #1)
> Changing to F26 because this still isn't fixed.
> I had to do a clean install of F25 Workstation and am not getting any output
> at all from Logwatch, even after the above changes
Try "sudo logwatch --debug 100" to see if the debugging output gives you any insight.
You shouldn't use the "--output=cat" option, should you? That removes the time stamp and process name from the output lines, parts that at least some logwatch patterns look for.
I have tried to do this on some of my systems, and it seems to work. For example, my /etc/logwatch/conf/logfiles/cron.conf looks like this:
LogFile = /etc/logwatch/conf/empty
*JournalCtl = "--no-pager --unit=crond.service"
*RemoveService = anacron
(In reply to Ivor Durham from comment #2)
> (In reply to Gerald Cox from comment #1)
> > Changing to F26 because this still isn't fixed.
> > I had to do a clean install of F25 Workstation and am not getting any output
> > at all from Logwatch, even after the above changes
> Try "sudo logwatch --debug 100" to see if the debugging output gives you any
with more information. The good people over at the Arch distro seem to have a good handle on it.