12

我有标准的 syslog_rules.xml (OSSEC 2.6.0)。这是/var/log/messages文件中坏词的标准规则:

<var name="BAD_WORDS">core_dumped|failure|error|attack|bad |illegal |denied|refused|unauthorized|fatal|failed|Segmentation Fault|Corrupted</var>
.....    
<rule id="1002" level="2">
<match>$BAD_WORDS</match>
<options>alert_by_email</options>
<description>Unknown problem somewhere in the system.</description>
</rule>
.....

如何添加或修改使用$BAD_WORDS但不包括该auxpropfunc error短语的规则?也就是说,像这样:

<match>$BAD_WORDS</match>
<match>!auxpropfunc error</match>
<options>alert_by_email</options>

有任何想法吗?

4

2 回答 2

13

您最好的选择可能是编写一条规则来忽略该短语。您可以将以下内容添加到/var/ossec/rules/local_rules.xml

<rule id="SOMETHING" level="0">
  <if_sid>1002</if_sid>
  <match>auxpropfunc error</match>
  <description>Ignore auxpropfunc error.</description>
</rule>

然后,您可以通过 ossec-logtest 运行整个日志消息,以查看 OSSEC 将如何分析它。您可能需要在此规则中添加另一个选项,也可能不需要。

于 2012-01-19T18:36:54.913 回答
8

如果你有多个单词,你可以在 /var/ossec/rules/local_rules.xml 中添加如下内容

<var name="GOOD_WORDS">error_reporting|auxpropfunc error</var>

<rule id="100002" level="0">
  <if_sid>1002</if_sid>
  <match>$GOOD_WORDS</match>
  <description>Ignore good_words.</description>
</rule>
于 2013-02-18T03:25:32.723 回答