centos rsyslog mysql_centos下配置日志服务器rsyslog(一)

服务器端

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值