Skip to content

log2ram & msmtp email #242

@chgaertner

Description

@chgaertner

Dear all,

I have set up log2ram on my Raspberry Pi and I want to use msmtp to be alerted. The msmtp package (and msmtp-mta and mailutils) have been installed successfully and this command ...
echo "Test-Message" | mail -s "Test-Subject" [email protected]
... sends an email.

I used this line in the log2ram configuration file to set up the email functionality:
NOTIFICATION_COMMAND=echo "Log2Ram Error on $HOSTNAME" | mail -s "Pi-08 (Printserver) Log2Ram" [email protected]

After a restart, I see the following error messages in journalctl:
Feb 22 00:53:24 himbeere-08 log2ram[197]: /etc/log2ram.conf: line 24: Log2Ram Error on pi-08: command not found
Feb 22 00:53:24 himbeere-08 log2ram[197]: mail: Null message body; hope that's ok
Feb 22 00:53:24 himbeere-08 log2ram[197]: mail: cannot send message: Process exited with a non-zero status
Line 24 is the line with the NOTIFICATION_COMMAND setting.

The msmtp log file shows two entries, the first one was the test email successfully sent and the second one for some reason shows that the mailserver host cannot be reached. This seems to make no sense as it is the same computer and nothing has changed in the 1 minute between the two attempts to send an email. The only difference I noted is that the manual email from the command line was sent as user "pi" whereas the other email sent (or not sent) by log2ram had as a user "root".
Feb 22 00:52:29 host=mbox.(redacted).at tls=on auth=on [email protected] from=pi@pi-08 [email protected] mailsize=157 smtpstatus=250 smtpmsg='250 2.0.0 Ok: queued as 61E72C815F' exitcode=EX_OK
Feb 22 00:53:21 host=mbox.(redacted).at tls=on auth=on [email protected] from=root@pi-08 [email protected] errormsg='cannot locate host mbox.(redacted).at: Temporary failure in name resolution' exitcode=EX_NOHOST
A ping to mbox.(redacted).at is successful all the time.

Can anyone of you give me some advice?

Thank you,
Christian

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions