简单部署syslog日志服务

服务

yum -y install rsyslog

vi /etc/rsyslog.conf
$ModLoad imudp
$UDPServerRun 514

# ### end of the forwarding rule ###
$template IpTemplate,"/var/log/syslog/%FROMHOST-IP%/%$year%-%$month%-%$day%.log.log"
*.* ?IpTemplate

systemctl restart rsyslog
ss -tunlp |grep 514

测试发送

logger -P 5140 -n 指定的IP地址 "这是一条测试日志"


logger -P 514 -n 192.168.11.17 "这是一条测试日志"
logger -P 514 -n 192.168.11.17 "这是一条测试日志2"

查看

image

posted @ 2024-03-21 17:41  jluo123  阅读(46)  评论(0编辑  收藏  举报