定制rsyslogd的log格式

官网的log格式配置文档如下:
https://www.rsyslog.com/doc/v8-stable/configuration/templates.html

定制一个仅包含log本身的syslog消息格式,首先修改/etc/rsyslog.conf文件,添加一个myFormat模板,

template(name="myFormat" type="string"
         string="<%PRI%>%msg%\n"
        )
$ActionFileDefaultTemplate myFormat



然后修改文件/etc/rsyslog.d/50-default.conf,在末尾加入如下行,将myFormat格式的log发送到IP为192.168.1.1的主机的5000端口。


user.* @192.168.1.1:5000;myFormat



猜你喜欢

转载自blog.csdn.net/sinat_20184565/article/details/80998446
今日推荐