From 3c2e2ee27e94de3ae1f88a5c218ff94e638df7e0 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 5 May 2008 17:07:08 +0200 Subject: [PATCH] Added filtering support for the new Eventlog fields --- src/classes/logstream.class.php | 29 +++++++++++++++++++++++++++ src/index.php | 35 +++++++++++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/src/classes/logstream.class.php b/src/classes/logstream.class.php index bb1ea34..04cbe2c 100644 --- a/src/classes/logstream.class.php +++ b/src/classes/logstream.class.php @@ -340,6 +340,35 @@ abstract class LogStream { } // --- break; + /* BEGIN Eventlog based fields */ + case "eventid": + $tmpKeyName = SYSLOG_EVENT_ID; + $tmpFilterType = FILTER_TYPE_NUMBER; + // --- Extra numeric Check + if ( isset($tmpValues) ) + { + foreach( $tmpValues as $mykey => $szValue ) + { + if ( is_numeric($szValue) ) + $tmpValues[$mykey] = $szValue; + } + } + else + { + if ( !is_numeric($tmpArray[FILTER_TMP_VALUE]) ) + $tmpArray[FILTER_TMP_VALUE] = ""; + } + // --- + break; + case "eventlogtype": + $tmpKeyName = SYSLOG_EVENT_LOGTYPE; + $tmpFilterType = FILTER_TYPE_STRING; + break; + case "eventlogsource": + $tmpKeyName = SYSLOG_EVENT_SOURCE; + $tmpFilterType = FILTER_TYPE_STRING; + break; + /* END Eventlog based fields */ case "syslogtag": $tmpKeyName = SYSLOG_SYSLOGTAG; $tmpFilterType = FILTER_TYPE_STRING; diff --git a/src/index.php b/src/index.php index 21398b5..f3fd775 100644 --- a/src/index.php +++ b/src/index.php @@ -386,8 +386,19 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . GetMessageTypeDisplayName( $logArray[$mycolkey] ). "'", 'IconSource' => $content['MENU_BULLET_BLUE'] ); - } + /* Eventlog based fields */ + else if ( $mycolkey == SYSLOG_EVENT_ID ) + { + // Set OnClick Menu for SYSLOG_EVENT_ID + $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => '?filter=eventid%3A' . $logArray[$mycolkey] . '&search=Search', + 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . $logArray[$mycolkey] . "'", + 'IconSource' => $content['MENU_BULLET_BLUE'] + ); + } + } else if ( $content['fields'][$mycolkey]['FieldType'] == FILTER_TYPE_STRING ) { @@ -483,7 +494,27 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); } - + /* Eventlog based fields */ + else if ( $mycolkey == SYSLOG_EVENT_LOGTYPE ) + { + // Set OnClick Menu for SYSLOG_EVENT_LOGTYPE + $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => '?filter=eventlogtype%3A' . $logArray[$mycolkey] . '&search=Search', + 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . $logArray[$mycolkey] . "'", + 'IconSource' => $content['MENU_BULLET_BLUE'] + ); + } + else if ( $mycolkey == SYSLOG_EVENT_SOURCE ) + { + // Set OnClick Menu for SYSLOG_EVENT_SOURCE + $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => '?filter=eventlogsource%3A' . $logArray[$mycolkey] . '&search=Search', + 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . $logArray[$mycolkey] . "'", + 'IconSource' => $content['MENU_BULLET_BLUE'] + ); + } } } }