2012-01-19 98 views
6

我有标准的syslog_rules.xml(OSSEC 2.6.0)。 这是不好的话在/var/log/messages文件的标准规则:OSSEC |如何添加例外规则

<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> 

任何想法?

回答

9

你最好的选择是写一条规则来忽略这个短语。你可以添加类似以下内容/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将如何分析它。您可能需要在此规则中添加其他选项,否则您可能不会。

5

如果你有一个以上的话,你可以添加类似以下内容/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>