服务器端
1、 yum install httpd mysql* php* mod_ssl rsyslog-mysql -y
2、配置/etc/sysconfig/rsyslog
SYSLOGD_OPTIONS="-c2 -r514 -x -m 180"
KLOGD_OPTIONS="-x"
3、配置/etc/rsyslog.conf
$ModLoad
imuxsock $ModLoad
imklog $ModLoad immark
$ModLoad imudp
$UDPServerRun 514
增加
$template
SpiceTmpl,"%TIMESTAMP%.%TIMESTAMP:::date-subseconds% %syslogtag%
%syslogseverity-text%:%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n"
4、防火墙开通514端口
-A INPUT -p udp --dport 514
-j ACCEPT
客户端
修改/etc/rsyslog.conf
*.* @rsyslog-serverIP:514
5、同步时间
yum install ntpdate -y
ntpdate asia.pool.ntp.org
验证:
在客户端输入命令 如ls du vi等
在服务器端 tail /var/log/messages可看见类似:
Jun 25 18:54:30 mini root: [euid=root]:root pts/0 2014-06-25
17:53 (chenweiguo.f-club.cn):[/root]service rsyslog restart
Jun 25 18:57:42 mini root: [euid=root]:root pts/0 2014-06-25 17:53
(chenweiguo.f-club.cn):[/root]ls
Jun 25 18:57:46 mini root: [euid=root]:root pts/0 2014-06-25 17:53
(chenweiguo.f-club.cn):[/root]du
Jun 25 19:11:38 mini root: [euid=root]:root pts/0 2014-06-25 17:53
(chenweiguo.f-club.cn):[/root]cat /etc/rsyslog.conf