×

Linux rsyslog记录指定的设备IP存放到指定的目录位置

hqy hqy 发表于2020-06-05 19:18:46 浏览2247 评论0

抢沙发发表评论

在/etc/rsyslog.conf中加上如下设定


$template aaa,"/log/%$YEAR%-%$MONTH%/%fromhost-ip%/%fromhost-ip%_%$YEAR%-%$MONTH%-%$DAY%-%$HOUR%.log"


:fromhost-ip, isequal,"192.168.10.1" ?aaa


:fromhost-ip, isequal, "192.168.20.1" ?aaa


注:将192.168.10.1 and 192.168.20.1的log存放到aaa指定的目录中


$template bbb,"/log/%$YEAR%-%$MONTH%/%fromhost-ip%/%fromhost-ip%_%$YEAR%-%$MONTH%-%$DAY%-%$HOUR%.log"


:fromhost-ip, startswith,"192.168.10." ?bbb


:fromhost-ip, startswith,"192.168.20." ?bbb


:fromhost-ip, startswith,"192.168.30." ?bbb


注:将192.168.10.X , 192.168.20.X, 192.168.30.X的设备log存到bbb指定的目录中


打赏

本文链接:https://www.kinber.cn/post/1367.html 转载需授权!

分享到:


推荐本站淘宝优惠价购买喜欢的宝贝:

image.png

 您阅读本篇文章共花了: 

群贤毕至

访客