在/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://hqyman.cn/post/1367.html 非本站原创文章欢迎转载,原创文章需保留本站地址!
休息一下~~