1

I'm trying to send logs to my email. I'm doing this via SSH. I edited the file:

/usr/share/logwatch/default.conf/logwatch.conf

and edited these lines:

Output = mail
Format = html
Encode = none

MailTo = [email protected]

I have tried:

sudo logwatch

But the command just hangs there but is still responsive. E.g. I can still press enter to go to the next line.

I've tried doing it manually with:

sudo logwatch --detail Low --mailto email@address --service all --range yesterday

Same problem.

After a few minutes it stops and I can enter another command. I check my email but theres nothing from logwatch. Even in my spam/junk folder.

Any idea what's happening?

EDIT: I have iptables, fail2ban and ufw installed. If that makes any difference.

I have also tried:

echo "This is a test" | mail -s Testing [email protected]

I recieved the email in my spam folder. I feel like the problem is Logwatch.

LtMuffin
  • 113
  • 1
  • 7

2 Answers2

2

possible cause is you are not using the sendmail but mail to send emails then:

nano /usr/share/logwatch/default.conf/logwatch.conf

find and replace:

#mailer = "/usr/sbin/sendmail -t"

with

mailer = "/usr/bin/mail"

or with the executable of your choise.

then test with

sudo /usr/sbin/logwatch --output mail --format html --range yesterday --service all

sending of regular mail sending can be tested with

echo "This is the body of the email" | mail -s "This is the subject line" [email protected]

Alex
  • 121
  • 2
1

Please have a look at your MTA's log files, e.g. /var/log/exim4/mainlog and watch out for SMTP errors.

I suggest this as I had a very similar situation, in which my e-mail provider's SMTP-server classified the e-mails produced by logwatch as spam, refusing to forward them. Other e-mails, as demonstrated by you, passed.

Workaround:

In my case it helped to save logwatch's output into a file and attaching it to an e-mail:

#!/bin/bash
tmpfile="/tmp/logwatch.txt"
/usr/sbin/logwatch > $tmpfile
echo "attached." | mail -s "logwatch output" -A "$tmpfile" email@provider

On debian, logwatch comes with a script scheduled by cron (located in /etc/cron.daily). You can use this snippet to modify it.

giusti
  • 1,797
  • 2
  • 15
  • 30
bus
  • 11
  • 1