EMOS postfix日志相关操作介绍

来源:互联网 发布:js添加class的css样式 编辑:程序博客网 时间:2024/06/06 00:54

       emos邮件系统的mtapostfix,有很强的日志功能,任何登录、邮件发送、投递等信息都会在日志中记录,因此我们有必要了解postfix日志的相关操作:日志查看、日志清空等。

1、  日志存放目录

日志存放目录: /etc/syslog.conf,可以在此处找到mail日志存放目录。

       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、  日志查看

可以通过moretailhead等命令查看postfix的日志信息,通常是/var/log/maillog文件。

tail -f /var/log/maillog

head -num /var/log/maillog, 查看日志的前num

tail -num /var/log/maillog, 查看日志的后num

 

3、  日志检查

       使用命令:egrep '(reject|warning|error|fatal|panic):' /var/log/maillog,可以将日志按级别信息提取出来。

 

4、  日志清空

       清空日志不用重启机器就可以,cp /dev/null /var/log/maillog就可以清空。

 

5、  日志分析

       日志分析需要借助第三方工具,http://www.cublog.cn/u/26011/showart_414622.htmlhttp://makert.blog.51cto.com/209063/49395等都介绍了postfix的日志分析工具,在此不再赘述。

原创粉丝点击