Chinaunix首页 | 论坛 | 博客
  • 博客访问: 101063708
  • 博文数量: 19283
  • 博客积分: 9968
  • 博客等级: 上将
  • 技术积分: 196062
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-07 14:28
文章分类

全部博文(19283)

文章存档

2011年(1)

2009年(125)

2008年(19094)

2007年(63)

分类: LINUX

2008-03-22 19:46:06

作者: anycan  出自:
如果要想迅速的得到 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 ] [--logfile ]
[--print] [--mailto ] [--archives] [--range ] [--debug ]
[--save ] [--help] [--version] [--service ]
[--numeric] [--output ]
[--splithosts] [--multiemail]

--detail : Report Detail Level - High, Med, Low or any #.
--logfile : *Name of a logfile definition to report on.
--logdir : Name of default directory where logs are stored.
--service : *Name of a service definition to report on.
--print: Display report to stdout.
--mailto : Mail report to .
--archives: Use archived log files too.
--save : Save to .
--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 : 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 : 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 ,即最高
阅读(274) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~