<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Keyword Filtering</title><link>https://sourceforge.net/p/ossecdashboard/wiki/Keyword%2520Filtering/</link><description>Recent changes to Keyword Filtering</description><atom:link href="https://sourceforge.net/p/ossecdashboard/wiki/Keyword%20Filtering/feed" rel="self"/><language>en</language><lastBuildDate>Wed, 16 Nov 2011 18:17:01 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/ossecdashboard/wiki/Keyword%20Filtering/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage Keyword Filtering modified by John Landers</title><link>https://sourceforge.net/p/ossecdashboard/wiki/Keyword%2520Filtering/</link><description>&lt;pre&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">John Landers</dc:creator><pubDate>Wed, 16 Nov 2011 18:17:01 -0000</pubDate><guid>https://sourceforge.net92c9c8926bda15bc621b99e0e9ae7c19ae0677b3</guid></item><item><title>WikiPage Filtering modified by John Landers</title><link>https://sourceforge.net/p/ossecdashboard/wiki/Filtering/</link><description>&lt;b&gt;Filtering&lt;/b&gt;

The dashboard allows you to filter/search based on keywords or regular expressions. This wiki entry helps to clarify how this process works.

&lt;b&gt;1. General Knowledge&lt;/b&gt;

The code that determines a match is contained in the Alerts class (resources/Classes/Alerts.class.php). The method is this:

~~~~~
&lt;?PHP
public function patternMatch() {
                if( !isset($_GET['myKeywords']) )
                        return true;

                if( $_GET['myKeywords'] == null || empty($_GET['myKeywords']) )
                        return true;

                $pattern = urldecode($_GET['myKeywords']);

                // Assume the given pattern is regex
                if( preg_match('/^\//',$pattern) ) {
                        return preg_match($pattern, $this-&gt;_alertGroup . $this-&gt;_alertSystemSource . $this-&gt;_alertLogSource . $this-&gt;_alertRuleID . $this-&gt;_alertRuleMsg . $this-&gt;_origMsg);
                } else {
                        return stristr($this-&gt;_alertGroup . $this-&gt;_alertSystemSource . $this-&gt;_alertLogSource . $this-&gt;_alertRuleID . $this-&gt;_alertRuleMsg . $this-&gt;_origMsg, $pattern);
                }
        }

?&gt;
~~~~~

The method returns true if the found alert is a match to what we want, and returns false otherwise. As I'm sure you can also see here, this is a pretty simplistic way to do things. I do intend to expand on this in the future.

&lt;b&gt;2. Keyword Matching&lt;/b&gt;

You can type whatever you want in the filter box and a case insensitive string match is applied to all parts of the found alert. If it's a match, you'll see it in your results.

&lt;b&gt;3. Regular Expressions&lt;/b&gt;

Regular expressions are deemed as any keyword entry that begins with a /. The whole entry is evaluated as a pattern given to the PHP preg_match() function. For example: /clamav.*update/i

It's important to note that you need to match the preg_match() requirements. Ref: www.php.net/preg_match</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">John Landers</dc:creator><pubDate>Wed, 16 Nov 2011 18:16:26 -0000</pubDate><guid>https://sourceforge.netd3197e7b174749c767a6c22591376949d5e5de12</guid></item></channel></rss>