環境:客戶端和服務端都需要安裝rsyslog服務
rsyslog server端
cd /etc/rsyslog.d/ cat server.conf $ModLoad imtcp $InputTCPServerRun 514 vim /etc/rsyslog.conf local4.* /var/log/history.log
rsyslog client端
cat /etc/rsyslog.d/client.conf local4.* @@server端ip:514
cat /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://xxxxxx/Linuxjc/1146758.html TechArticle