1 自定义一个rsyslog服务配置项
[root@localhost rsyslog.d]# pwd /etc/rsyslog.d [root@localhost rsyslog.d]# cat jkktest.conf if ($programname == 'jkktest') then -/var/log/jkktest.log
使用 logger -it jkktest "loginfo" 就能向 jkktest 的日志/var/log/jkktest.log 中写入日志信息了
[root@localhost rsyslog.d]# logger -it jkktest "123456789" [root@localhost rsyslog.d]# cat /var/log/jkktest.log Nov 28 22:24:58 localhost jkktest[10617]: 123456789
丰富相关配置项,例如日志转储等
[root@localhost log]# cat /etc/logrotate.d/jkktest /var/log/jkktest.log { missingok size 1k rotate 5 postrotate service rsyslog restart endscript }