How do I make Sendmail write to a log file?

Posted on 2005-04-13
Last Modified: 2013-12-17

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
Question by:EaglePress
    LVL 34

    Assisted Solution

    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                                                      /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 ( 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.
    LVL 8

    Accepted Solution

    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:               /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.

    LVL 8

    Expert Comment

    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.

    LVL 34

    Expert Comment

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    I have seen a lot of questions on EE where there have been problems sending out emails to one or more external email domains and most issues can be resolved fairly simply by checking to see that your Mail Server configuration is setup optimally and …
    Easy CSR creation in Exchange 2007,2010 and 2013
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    In this video we show how to create a Contact in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Contact ta…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now