Getting logwatch to print out a list of apt packages with upgrades

Useful one to have appear in your inbox in the morning. Have just done this on a server, so I thought I'd put it here to remind myself. This works for debian and Ubuntu variants, which have the apt command (a meta-script for the apt-get ecosystem)

In note form …

Add the following text to /etc/logwatch/scripts/services/apt

#!/bin/bash
/usr/bin/apt list --upgradable

Add the following text to /etc/logwatch/conf/services/apt.conf

# The title shown in the report.
Title = "Packages to upgrade"

# The name of the log file group (file name). 
# e.g for /etc/logwatch/conf/logfiles/apt.conf, we'd have Logfile = apt
LogFile = NONE

As we have NONE there, we don't need to create /etc/logwatch/conf/logfiles/apt.conf.

Leave a Comment