Added few new icons, and added predefined searches.

Predefined searches can be easily reached by the Button left to the search
box. For now I have created a bunch of usefull samples. I hope users are
going to contribute more. A predefined search is simply the querystring
from url for now. The popup is done as css menu, so it works without
javascript as well.

Fixed minor bugs I noticed while developing.
This commit is contained in:
Andre Lorbach 2008-04-21 17:48:07 +02:00
parent bbb0ec0f04
commit eea4371eb5
21 changed files with 203 additions and 64 deletions

View File

@ -82,6 +82,14 @@ class LogStreamLineParsersyslog extends LogStreamLineParser {
$arrArguments[SYSLOG_SYSLOGTAG] = $out[3];
$arrArguments[SYSLOG_MESSAGE] = $out[4];
}
// Sample (Syslog): Mar 7 17:18:35 debandre exiting on signal 15
else if ( preg_match("/(... [0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}) (.*?) (.*?)$/", $szLine, $out ) )
{
// Copy parsed properties!
$arrArguments[SYSLOG_DATE] = GetEventTime($out[1]);
$arrArguments[SYSLOG_HOST] = $out[2];
$arrArguments[SYSLOG_MESSAGE] = $out[3];
}
// Sample (RSyslog): 2008-03-28T11:07:40+01:00 localhost rger: test 1
else if ( preg_match("/([0-9]{4,4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}\+[0-9]{1,2}:[0-9]{1,2}) (.*?) (.*?):(.*?)$/", $szLine, $out ) )
{
@ -107,14 +115,10 @@ class LogStreamLineParsersyslog extends LogStreamLineParser {
$arrArguments[SYSLOG_DATE] = GetEventTime($out[1]);
$arrArguments[SYSLOG_MESSAGE] = $out[2];
}
else
{
if ( strlen($arrArguments[SYSLOG_MESSAGE]) > 0 )
{
// TODO: Cannot Parse Syslog message with this pattern!
echo ("wtf syslog - '" . $arrArguments[SYSLOG_MESSAGE] . "' <br>");
}
if ( isset($arrArguments[SYSLOG_MESSAGE]) && strlen($arrArguments[SYSLOG_MESSAGE]) > 0 )
OutputDebugMessage("Unparseable syslog msg - '" . $arrArguments[SYSLOG_MESSAGE] . "'");
}
// If SyslogTag is set, we check for MessageType!

View File

@ -75,10 +75,6 @@ class LogStreamLineParserwinsyslog extends LogStreamLineParser {
$arrArguments[SYSLOG_SEVERITY] = $out[5];
$arrArguments[SYSLOG_SYSLOGTAG] = $out[6];
$arrArguments[SYSLOG_MESSAGE] = $out[7];
// // Expand SYSLOG_FACILITY and SYSLOG_SEVERITY
// $arrArguments[SYSLOG_FACILITY_TEXT] = GetFacilityDisplayName( $arrArguments[SYSLOG_FACILITY] );
// $arrArguments[SYSLOG_SEVERITY_TEXT] = GetSeverityDisplayName( $arrArguments[SYSLOG_SEVERITY] );
}
else if ( preg_match("/([0-9]{4,4}-[0-9]{1,2}-[0-9]{1,2},[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}),([0-9]{4,4}-[0-9]{1,2}-[0-9]{1,2},[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}),(.*?),([0-9]{1,2}),([0-9]{1,2}),(.*?)$/", $szLine, $out ) )
{
@ -88,18 +84,11 @@ class LogStreamLineParserwinsyslog extends LogStreamLineParser {
$arrArguments[SYSLOG_FACILITY] = $out[4];
$arrArguments[SYSLOG_SEVERITY] = $out[5];
$arrArguments[SYSLOG_MESSAGE] = $out[6];
// // Expand SYSLOG_FACILITY and SYSLOG_SEVERITY
// $arrArguments[SYSLOG_FACILITY_TEXT] = GetFacilityDisplayName( $arrArguments[SYSLOG_FACILITY] );
// $arrArguments[SYSLOG_SEVERITY_TEXT] = GetSeverityDisplayName( $arrArguments[SYSLOG_SEVERITY] );
}
else
{
if ( strlen($arrArguments[SYSLOG_MESSAGE]) > 0 )
{
// TODO: Cannot Parse Syslog message with this pattern!
die ("wtf winsyslog - '" . $arrArguments[SYSLOG_MESSAGE] . "'");
}
if ( isset($arrArguments[SYSLOG_MESSAGE]) && strlen($arrArguments[SYSLOG_MESSAGE]) > 0 )
OutputDebugMessage("Unparseable Winsyslog message - '" . $arrArguments[SYSLOG_MESSAGE] . "'");
}
// If SyslogTag is set, we check for MessageType!

View File

@ -74,6 +74,17 @@ $CFG['Columns'][] = SYSLOG_MESSAGETYPE;
$CFG['Columns'][] = SYSLOG_MESSAGE;
// ---
// --- Predefined Searches!
$CFG['Search'][] = array ( "DisplayName" => "Syslog Warnings and Errors", "SearchQuery" => "filter=severity%3A0%2C1%2C2%2C3%2C4&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "Syslog Errors", "SearchQuery" => "filter=severity%3A0%2C1%2C2%2C3&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from the last hour", "SearchQuery" => "filter=datelastx%3A1&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 12 hours", "SearchQuery" => "filter=datelastx%3A2&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 24 hours", "SearchQuery" => "filter=datelastx%3A3&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 7 days", "SearchQuery" => "filter=datelastx%3A4&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 31 days", "SearchQuery" => "filter=datelastx%3A5&search=Search" );
// $CFG['Search'][] = array ( "DisplayName" => "", "SearchQuery" => "" );
// ---
// --- Source Options
$CFG['Sources'][Source1]['ID'] = "Source1";
$CFG['Sources'][Source1]['Name'] = "Syslog Disk File";
@ -120,6 +131,6 @@ $CFG['Sources'][Source6]['DBName'] = "syslogng";
$CFG['Sources'][Source6]['DBUser'] = "root";
$CFG['Sources'][Source6]['DBPassword'] = "";
$CFG['Sources'][Source6]['DBTableName'] = "logs";
// ---
?>
?>

View File

@ -22,6 +22,13 @@
display: none;
}
.SelectSavedFilter
{
margin-top: 3px;
border: 1px solid;
border-color: #233B51 #124A7C #124A7C #233B51;
}
.syslogdetails, a.syslogdetails, a.syslogdetails:link, a.syslogdetails:active, a.syslogdetails:visited
{
font-weight:normal;
@ -30,13 +37,12 @@
.syslogdetails
{
position:relative; /*this is the key*/
z-index:24;
z-index:4;
}
.syslogdetails:hover
{
z-index:25;
/* font-weight:normal;*/
z-index:5;
}
.syslogdetails span {display: none}
/*the span will display just on :hover state*/

55
src/css/menu.css Normal file
View File

@ -0,0 +1,55 @@
#menu {
width: 16px; /* set width of menu */
}
#menu ul { /* remove bullets and list indents */
list-style: none;
margin: 0;
padding: 0;
}
/* style, color and size links and headings to suit */
#menu a, #menu h2 {
display: block;
border-width: 1px;
border-style: solid;
margin: 0;
padding: 2px 3px;
}
#menu h2 {
font: bold 11px/16px;
text-align: center;
}
#menu a {
text-decoration: none;
border-color: #44617D #203040 #203040 #44617D;
}
#menu a:hover {
border-style: invert;
text-decoration: none;
border-color: #44617D #203040 #203040 #44617D;
}
#menu li {
z-index:10;
/* make the list elements a containing block for the nested lists */
position: relative;
}
#menu ul ul {
position: absolute;
top: 16px;
left: 0px; /* to position them to the right of their containing block */
width: 300; /* width is based on the containing block */
}
div#menu ul ul,
div#menu ul li:hover ul ul
{display: none;}
div#menu ul li:hover ul,
div#menu ul ul li:hover ul
{display: block;}

Binary file not shown.

After

Width:  |  Height:  |  Size: 899 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 966 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 890 B

View File

@ -86,7 +86,7 @@ $fields[SYSLOG_DATE]['FieldID'] = SYSLOG_DATE;
$fields[SYSLOG_DATE]['FieldCaptionID'] = 'LN_FIELDS_DATE';
$fields[SYSLOG_DATE]['FieldType'] = FILTER_TYPE_DATE;
$fields[SYSLOG_DATE]['Sortable'] = true;
$fields[SYSLOG_DATE]['DefaultWidth'] = "110";
$fields[SYSLOG_DATE]['DefaultWidth'] = "115";
$fields[SYSLOG_DATE]['FieldAlign'] = "center";
$fields[SYSLOG_HOST]['FieldID'] = SYSLOG_HOST;
$fields[SYSLOG_HOST]['FieldCaptionID'] = 'LN_FIELDS_HOST';

View File

@ -63,7 +63,7 @@ $LANG_EN = "en"; // Used for fallback
$LANG = "en"; // Default language
// Default Template vars
$content['BUILDNUMBER'] = "2.0.107";
$content['BUILDNUMBER'] = "2.01.1";
$content['TITLE'] = "PhpLogCon - Release " . $content['BUILDNUMBER']; // Title of the Page
$content['BASEPATH'] = $gl_root_path;
$content['EXTRA_METATAGS'] = "";
@ -166,11 +166,42 @@ function InitPhpLogCon()
// Create Language List
CreateLanguageList();
// Init Predefined Searches List
CreatePredefinedSearches();
// --- Enable PHP Debug Mode
InitPhpDebugMode();
// ---
}
function CreatePredefinedSearches()
{
global $CFG, $content;
if ( isset($CFG['Search']) )
{
// Enable predefined searches
$content['EnablePredefinedSearches'] = true;
// Loop through all predefined searches!
foreach ($CFG['Search'] as $mykey => $mySearch)
{
// Copy configured searches into content array!
$content['Search'][$mykey]["ID"] = $mykey;
$content['Search'][$mykey]["Selected"] = false;
// --- Set CSS Class
if ( $mykey % 2 == 0 )
$content['Search'][$mykey]['cssclass'] = "line1";
else
$content['Search'][$mykey]['cssclass'] = "line2";
// ---
}
}
else // Disable predefined searches
$content['EnablePredefinedSearches'] = false;
}
function InitPhpDebugMode()
{
global $content;
@ -233,6 +264,15 @@ function InitFrontEndVariables()
$content['MENU_SEARCH'] = "image=" . $content['BASEPATH'] . "images/icons/view.png";
$content['MENU_SELECTION_DISABLED'] = "image=" . $content['BASEPATH'] . "images/icons/selection.png";
$content['MENU_SELECTION_ENABLED'] = "image=" . $content['BASEPATH'] . "images/icons/selection_delete.png";
$content['MENU_PAGER_BEGIN'] = $content['BASEPATH'] . "images/icons/media_beginning.png";
$content['MENU_PAGER_PREVIOUS'] = $content['BASEPATH'] . "images/icons/media_rewind.png";
$content['MENU_PAGER_NEXT'] = $content['BASEPATH'] . "images/icons/media_fast_forward.png";
$content['MENU_PAGER_END'] = $content['BASEPATH'] . "images/icons/media_end.png";
$content['MENU_NAV_LEFT'] = $content['BASEPATH'] . "images/icons/navigate_left.png";
$content['MENU_NAV_RIGHT'] = $content['BASEPATH'] . "images/icons/navigate_right.png";
$content['MENU_NAV_CLOSE'] = $content['BASEPATH'] . "images/icons/navigate_close.png";
$content['MENU_NAV_OPEN'] = $content['BASEPATH'] . "images/icons/navigate_open.png";
}
// Lang Helper for Strings with ONE variable

View File

@ -145,4 +145,17 @@ function GetFormatedDate($evttimearray)
return $szDateFormatted = date("Y-m-d H:i:s", $evttimearray[EVTIME_TIMESTAMP] );
}
?>
function OutputDebugMessage($szDbg)
{
global $CFG;
if ( $CFG['MiscShowDebugMsg'] == 1 )
{
print("<table width=\"600\" align=\"center\" class=\"with_border\">");
print("<tr><td valign='top'><B>Debugmessage:</B> </td>");
print("<td>" . $szDbg . "</td></tr>");
print("</table><br>");
}
}
?>

View File

@ -53,7 +53,8 @@ InitFilterHelpers(); // Helpers for frontend filtering!
// ---
// --- Define Extra Stylesheet!
$content['EXTRA_STYLESHEET'] = '<link rel="stylesheet" href="css/highlight.css" type="text/css">';
$content['EXTRA_STYLESHEET'] = '<link rel="stylesheet" href="css/highlight.css" type="text/css">' . "\r\n";
$content['EXTRA_STYLESHEET'] .= '<link rel="stylesheet" href="css/menu.css" type="text/css">';
// ---
// --- CONTENT Vars

View File

@ -40,6 +40,8 @@ $content['LN_GEN_PREVIOUSPAGE'] = "Previous Page";
$content['LN_GEN_RECORDCOUNT'] = "Total records found";
$content['LN_GEN_PAGERSIZE'] = "Records per page";
$content['LN_GEN_PAGE'] = "Page";
$content['LN_GEN_PREDEFINEDSEARCHES'] = "Predefined Searches";
// Main Index Site
$content['LN_ERROR_INSTALLFILEREMINDER'] = "Warning! You still have NOT removed the 'install.php' from your phpLogCon main directory!";

View File

@ -3,11 +3,26 @@
<table border="0" cellspacing="0" cellpadding="2" align="center">
<form action="" method="get" id="searchform" name="searchform">
<tr>
<!-- <td class="topmenu2 ExpansionPlus" nowrap align="center" width="105" id="advancedsearch"><a class="topmenu1_link" href="#" OnClick="togglevisibility('HiddenOptions', 'advancedsearch');">Advanced Search</a></td>-->
<td nowrap align="center" nowrap valign="middle">
<B>&nbsp;{LN_SEARCH_FILTER}</B>
<!-- <img src="{BASEPATH}images/icons/navigate_down.png" class="SelectSavedFilter" align="middle" width="16" height="16">-->
</td>
<!-- IF EnablePredefinedSearches="true" -->
<td nowrap align="left" nowrap valign="top">
<div id="menu">
<ul>
<li><img src="{MENU_NAV_CLOSE}" width="16" height="16" title="{LN_GEN_FIRSTPAGE}" class="SelectSavedFilter">
<ul class="with_border">
<li><h2 class="cellmenu1">{LN_GEN_PREDEFINEDSEARCHES}</h2>
<!-- BEGIN Search -->
<li class="{cssclass}"><a href="?{SearchQuery}" target="_top">{DisplayName}</a></li>
<!-- END Search -->
</ul>
</li>
</ul>
</div>
</td>
<!-- ENDIF EnablePredefinedSearches="true" -->
<td nowrap align="center" nowrap valign="top">
<input maxlength="2048" name="filter" size="80" title="Search" value="{searchstr}" class="SearchFormTextbox">
<br>
<input name="search" type="submit" value="{LN_SEARCH}" class="SearchFormControl">
@ -17,40 +32,43 @@
<br>
</td>
<td nowrap align="left" nowrap valign="top">
<a href="search.php" target="_top">{LN_SEARCH_ADVANCED}</a>
<br>
<i>(sample: faciliy:local0 severity:warning)</i>
</td>
</tr>
<tr>
<td colspan="2">
<span id="HightLightArea" name="HightLightArea" class="HiddenContent">
<table border="0" cellpadding="1" cellspacing="1" width="100%" align="center" class="with_border">
<tr>
<td colspan="2" align="center" valign="top" class="cellmenu2">
<strong>{LN_HIGHLIGHT_WORDS}</strong></td>
</tr>
<tr>
<td align="left" class="line1" nowrap>
<input maxlength="2048" name="highlight" size="75" title="Search" value="{highlightstr}">
<input name="search" type="submit" value="{LN_SEARCH}" class="SearchFormControl">
</td>
</tr>
<!-- IF EXPAND_HIGHLIGHT="true" -->
<tr>
<td align="center" class="line0" nowrap>
<table border="0" cellpadding="1" cellspacing="1" width="100%" align="center">
<tr>
<!-- BEGIN highlightwords -->
<td class="{cssclass}" align="center"><b>{highlight_raw}</b></td>
<!-- END highlightwords -->
</tr>
</table>
</td>
</tr>
<!-- ENDIF EXPAND_HIGHLIGHT="true" -->
</table>
</span>
<td colspan="5">
<span id="HightLightArea" name="HightLightArea" class="HiddenContent">
<table border="0" cellpadding="1" cellspacing="1" width="100%" align="center" class="with_border">
<tr>
<td colspan="2" align="center" valign="top" class="cellmenu2">
<strong>{LN_HIGHLIGHT_WORDS}</strong></td>
</tr>
<tr>
<td align="left" class="line1" nowrap>
<input maxlength="2048" name="highlight" size="75" title="Search" value="{highlightstr}">
<input name="search" type="submit" value="{LN_SEARCH}" class="SearchFormControl">
</td>
</tr>
<!-- IF EXPAND_HIGHLIGHT="true" -->
<tr>
<td align="center" class="line0" nowrap>
<table border="0" cellpadding="1" cellspacing="1" width="100%" align="center">
<tr>
<!-- BEGIN highlightwords -->
<td class="{cssclass}" align="center"><b>{highlight_raw}</b></td>
<!-- END highlightwords -->
</tr>
</table>
</td>
</tr>
<!-- ENDIF EXPAND_HIGHLIGHT="true" -->
</table>
</span>
</td>
</tr>
</form>
@ -86,18 +104,18 @@
<td nowrap width="50" class="line2"><B>{ViewEntriesPerPage}</B></td>
<td class="cellmenu2" nowrap><B>Pager: &nbsp; </B></td>
<td class="line0" nowrap><a href="?{additional_url_sortingonly}&uid={uid_first}{additional_url}" target="_top"><img src="{BASEPATH}images/icons/media_beginning.png" width="16" title="{LN_GEN_FIRSTPAGE}"></a>&nbsp;</td>
<td class="line0" nowrap><a href="?{additional_url_sortingonly}&uid={uid_first}{additional_url}" target="_top"><img src="{MENU_PAGER_BEGIN}" width="16" title="{LN_GEN_FIRSTPAGE}"></a>&nbsp;</td>
<!-- IF main_pager_previous_found="true" -->
<td class="line1" nowrap><a href="?{additional_url_sortingonly}&uid={uid_previous}{additional_url}" target="_top"><img src="{BASEPATH}images/icons/media_rewind.png" width="16" title="{LN_GEN_PREVIOUSPAGE}"></a>&nbsp;</td>
<td class="line1" nowrap><a href="?{additional_url_sortingonly}&uid={uid_previous}{additional_url}" target="_top"><img src="{MENU_PAGER_PREVIOUS}" width="16" title="{LN_GEN_PREVIOUSPAGE}"></a>&nbsp;</td>
<!-- ENDIF main_pager_previous_found="true" -->
<!-- BEGIN syslogpages -->
<td class="{cssclass}" nowrap><a href="?{additional_url_sortingonly}&uid={mypagebegin}{additional_url}" target="_top">{mypagenumber}</a>&nbsp;</td>
<!-- END syslogpages -->
<!-- IF main_pager_next_found="true" -->
<td class="line0" nowrap><a href="?{additional_url_sortingonly}&uid={uid_next}{additional_url}" target="_top"><img src="{BASEPATH}images/icons/media_fast_forward.png" width="16" title="{LN_GEN_NEXTPAGE}"></a>&nbsp;</td>
<td class="line0" nowrap><a href="?{additional_url_sortingonly}&uid={uid_next}{additional_url}" target="_top"><img src="{MENU_PAGER_NEXT}" width="16" title="{LN_GEN_NEXTPAGE}"></a>&nbsp;</td>
<!-- ENDIF main_pager_next_found="true" -->
<!-- IF main_pager_last_found="true" -->
<td class="line1" nowrap><a href="?{additional_url_sortingonly}&uid={uid_last}{additional_url}" target="_top"><img src="{BASEPATH}images/icons/media_end.png" width="16" title="{LN_GEN_LASTPAGE}"></a>&nbsp;</td>
<td class="line1" nowrap><a href="?{additional_url_sortingonly}&uid={uid_last}{additional_url}" target="_top"><img src="{MENU_PAGER_END}" width="16" title="{LN_GEN_LASTPAGE}"></a>&nbsp;</td>
<!-- ENDIF main_pager_last_found="true" -->
<!-- <td nowrap width="200" class="line2"><I>&nbsp;{LN_GEN_MOREPAGES}</I></td> -->
<!-- ENDIF main_pagerenabled="true" -->

View File

@ -385,7 +385,7 @@ A.cellmenu1_link:hover
}
/* Form elements */
select, input, button, textarea, .SelectSavedFilter
select, input, button, textarea
{
background-color: #E8E7E2;
color:#000000;