新手入门也不知道什么日志分析服务好,鸟哥说logwatch,那我就从logwatch开始吧!
logwatch用到了emai发邮件,先从配置邮件发送sendmail开始:
harvey@harvey-Virtual-Machine:~$ sudo apt-get install sendmail [sudo] password for harvey: 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成
harvey@harvey-Virtual-Machine:~$ sudo service sendmail status [sudo] password for harvey: MSP: is run via cron (20m) #表示服务已经开启了 MTA: 17646 /usr/sbin/sendmail-mta -Am -L sm-mta -bd -q10m UID PID PPID C STIME TTY TIME CMD root 17646 1 0 21:45 ? 00:00:00 sendmail: MTA: accepting connections Daemon Status: (process 18662) Console socket child Current number of children: 0 QueueDir free disk space (in blocks): 34795684 Load average: 0 Child Process 17646 Status: accepting connections
harvey@harvey-Virtual-Machine:~$ mail *********@gmail.com Cc: 14******1@qq.com Subject: 这是我用ubuntu发送的邮件 测试一下用ubutu直接发送log分析文件的可行性
harvey@harvey-Virtual-Machine:~$ ll /var/spool/mqueue 总用量 8 drwxrwsrwx 2 smmta smmsp 4096 3月 22 12:01 ./ drwxr-xr-x 11 root root 4096 3月 21 21:44 ../
harvey@harvey-Virtual-Machine:~$ mailq MSP Queue status... /var/spool/mqueue-client is empty Total requests: 0 MTA Queue status... /var/spool/mqueue is empty Total requests: 0
#给QQ邮箱发送邮件后查看 harvey@harvey-Virtual-Machine:~$ mail "/var/mail/harvey": 1 message 1 new >N 1 Mail Delivery Subs 六 3月 22 12: 65/2616 Returned mail: see transcript for de ? #现在表示有一个新的邮件,直接回车就可以查看邮件内容 #我的被拒绝邮件有如下信息: #(reason: 550 Mail content denied. http://service.mail.qq.com/cgi-bin/help?subtype=1&&id =20022&&no=1000726)#打开后面的网址就是腾讯拒绝的理由 #用sina邮箱发送邮件后查看那 harvey@harvey-Virtual-Machine:~$ mail "/var/mail/harvey": 1 message 1 new >N 1 Mail Delivery Subs 六 3月 22 12: 70/2893 Returned mail: see transcript for de ? #回车查看有以下提示 #(reason: 550 #5.7.1 Your access to submit messages to this e-mail system has been rejec ted.)
如果希望启动logwatch后用QQ邮件发送的话,必须把自己的发件地址添加到邮箱的白名单里。
参考资料:Linux系统下如何使用mail发送Internet邮件?
Ubuntu 中sendmail 的安装、配置与发送邮件的具体实现
linux之发送邮件--sendmail服务配置,布布扣,bubuko.com
原文:http://www.cnblogs.com/zhanghaiyublog/p/3617386.html