配置
指定local6.warning
写到日志文件/var/log/work.log
,命令:
echo "local6.warning /var/log/work.log" > /etc/rsyslog.d/55-work.conf
重启服务
systemctl restart rsyslog
测试
-
命令
logger -p local6.warning aaa -
验证
cat /var/log/work.log ,显示如下:
Dec 1 11:41:27 work dewan: aaa
- 命令简化
alias logging='logger -p local6.warning'