环境:客户端和服务端都需要安装rsyslog服务
跳板机-rsyslogserver端
1
2
3
4
5
6
|
/etc/rsyslog
.d
/server
.conf
$ModLoad imtcp
$InputTCPServerRun 514
/etc/rsyslog
.conf
local4.*
/var/log/history
.log
sudo
service rsyslog restart
|
客户端-rsyslogclient端
1
2
|
/etc/rsyslog
.d
/client
.conf
local4.* @@你的运维机:514
|
eth0网卡根据情况修改
1
2
|
/etc/profile
.d
/client
.sh
export
PROMPT_COMMAND=
'{ msg=$(history 1 | { read x y; echo $y; });logger -p local4.info ["LOCAL|`grep IPADDR /etc/sysconfig/network-scripts/ifcfg-eth0|sed '
s
/IPADDR
=
//g
'`" -- "SSH|$SSH_CONNECTION $SSH_TTY" -- "USER|$USER" -- "PWD|$PWD"]: "$msg"; }'
|
重启服务
1
|
service rsyslog restart
|
本文转自 shouhou2581314 51CTO博客,原文链接:http://blog.51cto.com/thedream/1720502,如需转载请自行联系原作者