The MTA: postfix of the emos mail system has a strong log function. Any login, email sending, delivery, and other information will be recorded in the log. Therefore, it is necessary for us to understand the operations related to the Postfix log: view logs and clear logs.
1. log storage directory
Log storage directory:/etc/syslog. conf, where you can find the mail log storage directory.
Postfix daemon processes run in the background, and log problems and normal activity to the Syslog daemon. the syslogd process sorts events by class and severity, and appends them to logfiles. the logging classes, levels and logfile names are usually specified in/etc/syslog. conf. at the very least you need something like:
/Etc/syslog. conf:
Mail. Err/dev/console
Mail. debug/var/log/maillog
After changing the syslog. conf file, send a "Hup" signal to the syslogd process.
2. View logs
You can use commands such as more, tail, and head to view the Postfix log information, usually the/var/log/maillog file.
Tail-F/var/log/maillog
Head-num/var/log/maillog, view the first num row of the log
Tail-num/var/log/maillog, And the num line after the log is viewed
3. Log check
Run the command egrep '(reject | warning | error | fatal | panic):'/var/log/maillog to extract logs by level.
4. Log clearing
You can clear logs without restarting the machine. CP/dev/null/var/log/maillog can be cleared.
5. Log Analysis
Third-party tools are required for log analysis.