我正在接收.log文件中的syslog数据。 该文件包含两种types的事件。 只包含syslogdate时间标记的事件和包含syslogdate时间标记的事件以及消息中的“timestamp =”字段。 使用规则,如何将包含“timestamp =”的任何事件拆分为单独的文件?
有关filter的rsyslog文档说$msg可以在这里帮助:
Probably, “msg” is the most prominent use case of property based filters. It is the actual message text. If you would like to filter based on some message content (eg the presence of a specific code), this can be done easily by: :msg, contains, "ID-4711" This filter will match when the message contains the string “ID-4711”.
和
*.* /var/log/file1 # the traditional way if $msg contains 'error' then /var/log/errlog # the expression-based way
如果我正确地理解了你的问题,你可以通过编辑你的configuration文件来检查$msg for timestamp =如果你发现这个值,写入一个单独的文件。
这是rsyslog版本8的文档。我build议检查你使用的rsyslog的版本,你find的任何例子(在文档或在互联网上)。