Logwatch Weekly

I like Logwatch, but I don't like how it defaults to daily notifications, and it places the disk information at the very bottom.


sudo apt install logwatch

Create (or edit) /etc/logwatch/conf/logwatch.conf with the following:

#
# Linux:
# /etc/logwatch/conf/logwatch.conf
#
# FreeBSD:
# /usr/local/etc/logwatch/logwatch.conf
#

# switch from daily to weekly
Range = between -7 days and -1 days

# make sure we output to mail
Output = mail

# increase detail level above 0 / low
Detail = 4

# exclude the "bottom" df script since we have a "top" script
Service = "-zz-disk_space" 

# EoF

Create (or edit) /etc/logwatch/conf/services/00-disk.conf with the following:

#
# Linux:
# /etc/logwatch/conf/services/00-disk.conf
#
# FreeBSD:
# /usr/local/etc/logwatch/services/00-disk.conf
#

# report title
Title = "Disk Space"

# which logfiles
LogFile = NONE

# Uncomment this to show the system directory sizes /opt /usr/ /var/log
# $show_disk_usage = 1

# The variables df_options and disk_cmd are used to customize the
# reporting of filesystem disk usage.
$disk_cmd = "df $df_options"

# FreeBSD
# $df_options = "-h -t nodevfs,linprocfs,linsysfs,tmpfs"

# For Linux
$df_options = "-h -l -x tmpfs -x devtmpfs"

# print a warning if the disk utilization exceeds this number.
# the default is 90. set to 0 if no warning desired.
# $diskfull_threshold = 0

# exclude directories from disk full warnings
# $diskfull_exclude_dirs = /run/media

# EoF

Copy the original disk service to our new name:

sudo cp -a /usr/share/logwatch/scripts/services/zz-disk_space /etc/logwatch/scripts/services/00-disk

Make Logwatch run weekly:

sudo mv /etc/cron.daily/00logwatch /etc/cron.weekly/

You can test the new format:

sudo /etc/cron.weekly/00logwatch