喜悦国际村 
» 游客:  注册 | 登录 | 搜索 | 统计 | 喜悦证交所 | 帮助

RSS 订阅当前论坛  

[北京]代朋友公司招聘PHP高级程序员多名

上一主题 下一主题
     
标题: [经验] 用Logwatch工具监控Linux系统Log日志  
 
anycan
新手上路
Rank: 1



UID 109221
精华 0
积分 2
帖子 12
金钱 2 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2008-2-1
状态 离线
用Logwatch工具监控Linux系统Log日志

如果要想迅速的得到 Linux 环境中的日志报告信息, Logwatch 是一个很好的工具.

在debian上安装非常简单,只需要

#sudo apt-get install logwatch

查看昨天的信息,使用下面的命令就可以了。结果包括启动信息,登陆信息,磁盘使用状况等。

#logwatch –print

单独查看某项服务的信息,比如ssh,使用

#logwatch –service  sshd –print

具体使用可以

[root@www m6699.com]# logwatch --help

Usage: /usr/sbin/logwatch [--detail <level>] [--logfile <name>]
   [--print] [--mailto <addr>] [--archives] [--range <range>] [--debug <level>]
   [--save <filename>] [--help] [--version] [--service <name>]
   [--numeric] [--output <output_type>]
   [--splithosts] [--multiemail]

--detail <level>: Report Detail Level - High, Med, Low or any #.
--logfile <name>: *Name of a logfile definition to report on.
--logdir <name>: Name of default directory where logs are stored.
--service <name>: *Name of a service definition to report on.
--print: Display report to stdout.
--mailto <addr>: Mail report to <addr>.
--archives: Use archived log files too.
--save <filename>: Save to <filename>.
--range <range>: Date range: Yesterday, Today, All, Help
                             where help will describe additional options
--numeric: Display addresses numerically rather than symbolically and numerically
           (saves  a  nameserver address-to-name lookup).
--debug <level>: Debug Level - High, Med, Low or any #.
--splithosts: Create a report for each host in syslog.
--multiemail: Send each host report in a separate email.  Ignored if
              not using --splithosts.
--output <output type>: Report Format - mail, html or unformatted#.
--encode: Use base64 encoding on output mail.
--version: Displays current version.
--help: This message.
* = Switch can be specified multiple times...
   

但是每天ssh到服务器上使用太不方便,还好logwatch提供了mail功能

#vi /etc/logwatch/conf/logwatch.conf

修改下面的root为你自己的邮件地址

MailTo = XXX@163.com

同时,因为我们需要了解服务器的详细信息,所以,修改下面的

Detail = 是细节度,推荐 10 ,即最高
2008-2-1 02:15 PM#1
查看资料  发短消息  顶部
     


  可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题 | 开通个人空间  


 




Powered by Discuz! 6.1.0  © 2001-2010 Comsenz Inc.
Processed in 0.023065 second(s), 6 queries

(冀ICP备05009913号) 管理员:sadly 邮箱/MSN: sadly@phpx.com QQ:824008(长隐) 清除 Cookies - - Archiver - WAP