Bug 1462615 - Default installation does not report on systemd services requiring journalctl access to their logs
Default installation does not report on systemd services requiring journalctl...
Status: NEW
Product: Fedora
Classification: Fedora
Component: logwatch (Show other bugs)
26
All Linux
high Severity high
: ---
: ---
Assigned To: Jan Synacek
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-19 01:29 EDT by Ivor Durham
Modified: 2017-07-12 22:02 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ivor Durham 2017-06-19 01:29:48 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):

logwatch-7.4.3-3.fc25.noarch

Steps to Reproduce:
1. Clean F25 installation
2. dnf install logwatch
3. Execute logwatch

Actual results:

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.

Expected results:

Report section "SSHD BEGIN" through "SSHD END" reporting logins (esp. failed ones) via ssh.

Additional info:

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:

[1] /etc/logwatch/conf/services/sshd.conf containing:
LogFile = 
LogFile = null
*JournalCtl = "--output=cat --unit=sshd.service"

[2] /etc/logwatch/conf/logfiles/null.conf containing:

LogFile = null.log

[3] /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:
    durham:
       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.
Comment 1 Gerald Cox 2017-07-11 12:49:17 EDT
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
Comment 2 Ivor Durham 2017-07-11 13:26:02 EDT
(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.
Comment 3 Göran Uddeborg 2017-07-11 13:53:04 EDT
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 = 
LogFile = /etc/logwatch/conf/empty
*JournalCtl = "--no-pager --unit=crond.service"
*RemoveService = anacron
Comment 4 Gerald Cox 2017-07-12 22:02:23 EDT
(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
> insight.

I updated:
https://bugzilla.redhat.com/show_bug.cgi?id=864872
with more information.  The good people over at the Arch distro seem to have a good handle on it.

Note You need to log in before you can comment on or make changes to this bug.