• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 286
  • Last Modified:

How do I make Sendmail write to a log file?

Hello-

I am a beginner with Sendmail.  I have also been away from work for a couple of months, so I don't know what has changed.

Here's my problem:
Before I went on leave, sendmail would log all messages in the /var/logs/maillog file.  Upon my return, I went to debug a mail problem.  The maillog file was empty.  The LogLevel is set to 9.  Should I change that?  is it possible that the info is being written to a different log file?  If so, how do I find that log?

thanks for your help
Crissy
0
EaglePress
Asked:
EaglePress
  • 2
  • 2
2 Solutions
 
PsiCopCommented:
sendmail does no logging on its own, regardless of the LogLevel setting. It depends entirely on the syslog facility. If syslog is not configured to record messages from the "mail" FACILITY, then what basically happens is that sendmail's log entries are discarded.

You haven't stated the platform/OS/version you're on - I've mostly been using sendmail v8.12.11 - v8.13.1 on Solaris 8, so the rest of this is based on that environment (if you have a different environment, well, that's why including platform/version info in your Question is important). In /etc/syslog.conf, I added these lines:

# Log E-Mail system messages to special logs
mail.info                                                      /var/log/mail-info.log
mail.notice                                                   /var/log/mail-rbl.log
mail.warning;mail.err;mail.crit;mail.emerg     /var/log/mail-problem.log

Routine informational messages (mail.info) get put in one file, RBL hits are logged under the "notice" SEVERITY and go into another file, and all other messages from the "mail" FACILITY are logged to a 3rd file.

See --> man syslogd
See --> man syslog.conf
See --> man syslog

Note that you have to create the files you specify if they do not already exist. They must be writable by the UID under which syslogd (*not* sendmail) runs. You must restart syslogd for changes to syslog.conf to take effect, and syslogd must be running in order to capture sendmail's messages.
0
 
it_alchemistCommented:
Make sure that the syslog daemon is running as Sendmail depends on that for its logging. Make sure there is a line in /etc/syslog.conf  that reads:

mail.info               /var/log/maillog

If there is something else there already, then you know that that is where sendmail is storing its logs.

Otherwise make sure the /var/log/maillog file exists.

If it doesn't, create it then restart syslog daemon and sendmail.

LogLevel is fine.



0
 
it_alchemistCommented:
Sorry PsiCop, had been typing in the comment box, got distracted, came back, finished it, and then submitted without having noticed that you had already answered in the meantime.

0
 
PsiCopCommented:
No problem - I've done the exact same thing myself. Perils of an interrupt-driven environment. :-)
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now