I ran into an issue recently when trying to configure logwatch to send daily emails for my postfix installs via a script in the /etc/cron.d directory. The same applies for user crontabs.

Here is a nice howto for installing logwatch itself and creating the crontab if you don’t know how to do that.

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-logwatch-log-analyzer-and-reporter-on-a-vps

What this tutorial doesn’t say though (and I should really have known this :P) was that the default mailer for logwatch is /usr/sbin/sendmail and /usr/sbin is not accessible by the cron process unless you extend the PATH variable at the top of your script.

Here is the example. The important bit is in bold.

PATH=/usr/sbin:/usr/bin:/sbin:/bin

# +---------------- minute (0 - 59)
# |  +------------- hour (0 - 23)
# |  |  +---------- day of month (1 - 31)
# |  |  |  +------- month (1 - 12)
# |  |  |  |  +---- day of week (0 - 6) (Sunday=0 or 7)
# |  |  |  |  |
# *  *  *  *  *   

55 11,23 * * * root logwatch --detail High --service postfix --range Today --mailto someone@email.com