在rsyslog.conf中的日志中替换味精

时间:2019-05-09 05:36:17

标签: replace rsyslog

我使用的是rsyslog的旧版,具体是 5.8 。 我想用新的单词(例如“ XXXX”)替换日志中单词的所有实例

例如,扫描每条日志行,如果出现“用户名”一词,则将其替换为“ XXXX”

使用外部python py omprog模块的屏蔽方法不起作用(https://www.rsyslog.com/masking-data-in-logs-and-rsyslog/

但是我发现了 property_replacer filter 选项:(https://www.rsyslog.com/doc/v5-stable/configuration/property_replacer.html)andhttps://www.rsyslog.com/doc/v5-stable/configuration/filters.html#examples)。

我已经从上面提到的property_replacer文档中借用了该示例,该文档应该找到带有用户名一词的味精并将整个内容转换为小写(只是为了得到一个简单的工作示例):

我的rsyslog.conf文件中当前有以下行: if $msg contains 'username' then %msg:::lowercase%

但是,我遇到了错误:

line 38:\"if $msg contains 'username' then %msg:::lowercase%\"\nrsyslogd: 
warning: selector line without 
actions will be discarded\nrsyslogd: 
CONFIG ERROR: could not interpret master config file

如何在rsyslog v5中有效地替换味精?

我正确定位了所有传入消息吗?

谢谢

0 个答案:

没有答案