环境:客户端和服务端都需要安装rsyslog服务
跳板机-rsyslogserver端
/etc/rsyslog.d/server.conf $ModLoad imtcp $InputTCPServerRun 514 /etc/rsyslog.conf local4.* /var/log/history.log sudo service rsyslog restart
客户端-rsyslogclient端
/etc/rsyslog.d/client.conf local4.* @@你的运维机:514
eth0网卡根据情况修改
/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"; }‘
重启服务
service rsyslog restart
本文出自 “不抛弃!不放弃” 博客,请务必保留此出处http://thedream.blog.51cto.com/6427769/1720502
原文地址:http://thedream.blog.51cto.com/6427769/1720502