- added new stylesheet file for highlighting

- added highlight and coloured facility/severities.
- fixed a bug with the pager, works now again. still not perfect but works for now.
- I'm feeling sad button is now the "Custom Fast Search" button, the default searches for the word error.
- added a few configuration options into the config file with explanations.
- minor other fixes and changes.
This commit is contained in:
Andre Lorbach 2008-04-11 18:21:59 +02:00
parent b13b4a177f
commit 6bfc736ab4
15 changed files with 486 additions and 376 deletions

View File

@ -82,8 +82,8 @@ class Template {
{
// BEGIN DELTA MOD
global $CFG;
// For ShowPageRenderStats
if ( $CFG['ShowPageRenderStats'] == 1 )
// For MiscShowPageRenderStats
if ( $CFG['MiscShowPageRenderStats'] == 1 )
FinishPageRenderStats( $vars );
// END DELTA MOD

View File

@ -143,7 +143,6 @@ class LogStreamDisk extends LogStream {
*/
public function Read($uID, &$arrProperitesOut) {
$this->Sseek($uID, EnumSeek::UID, 0);
$tmp = $this->_readDirection;
$this->_readDirection = EnumReadDirection::Forward;
$ret = $this->ReadNext($uID, $arrProperitesOut);
@ -188,7 +187,7 @@ class LogStreamDisk extends LogStream {
// Loop until the filter applies, or another error occurs.
} while ( $this->ApplyFilters($ret, $arrProperitesOut) != SUCCESS && $ret == SUCCESS );
// reached here means return result!
return $ret;
}
@ -211,17 +210,7 @@ class LogStreamDisk extends LogStream {
$line = '';
foreach ( $this->_arrProperties as $property )
$arrProperitesOut[$property] = '';
/*
$arrProperitesOut[SYSLOG_DATE] = '';
$arrProperitesOut[SYSLOG_FACILITY] = '';
$arrProperitesOut[SYSLOG_FACILITY_TEXT] = '';
$arrProperitesOut[SYSLOG_SEVERITY] = '';
$arrProperitesOut[SYSLOG_SEVERITY_TEXT] = '';
$arrProperitesOut[SYSLOG_HOST] = '';
$arrProperitesOut[SYSLOG_SYSLOGTAG] = '';
$arrProperitesOut[SYSLOG_MESSAGE] = '';
$arrProperitesOut[SYSLOG_MESSAGETYPE] = '';
*/
do {
$pos = -1;
if (($pos = strpos($this->_buffer, "\n", $this->_p_buffer)) !== false) {
@ -269,17 +258,6 @@ class LogStreamDisk extends LogStream {
$line = '';
foreach ( $this->_arrProperties as $property )
$arrProperitesOut[$property] = '';
/*
$arrProperitesOut[SYSLOG_DATE] = '';
$arrProperitesOut[SYSLOG_FACILITY] = '';
$arrProperitesOut[SYSLOG_FACILITY_TEXT] = '';
$arrProperitesOut[SYSLOG_SEVERITY] = '';
$arrProperitesOut[SYSLOG_SEVERITY_TEXT] = '';
$arrProperitesOut[SYSLOG_HOST] = '';
$arrProperitesOut[SYSLOG_SYSLOGTAG] = '';
$arrProperitesOut[SYSLOG_MESSAGE] = '';
$arrProperitesOut[SYSLOG_MESSAGETYPE] = '';
*/
do {
$pos = -1;

View File

@ -93,7 +93,7 @@ class LogStreamLineParsersyslog extends LogStreamLineParser {
if ( strlen($arrArguments[SYSLOG_MESSAGE]) > 0 )
{
// TODO: Cannot Parse Syslog message with this pattern!
die ("wtf syslog - '" . $arrArguments[SYSLOG_MESSAGE] . "'");
echo ("wtf syslog - '" . $arrArguments[SYSLOG_MESSAGE] . "' <br>");
}
}

View File

@ -1,81 +1,91 @@
<?php
/*
*********************************************************************
* phpLogCon - http://www.phplogcon.org
* -----------------------------------------------------------------
* Main Configuration File
*
* -> Configuration need variables for the Database connection
*
* Copyright (C) 2008 Adiscon GmbH.
*
* This file is part of phpLogCon.
*
* PhpLogCon is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PhpLogCon is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with phpLogCon. If not, see <http://www.gnu.org/licenses/>.
*
* A copy of the GPL can be found in the file "COPYING" in this
* distribution.
*********************************************************************
*/
/*
*********************************************************************
* phpLogCon - http://www.phplogcon.org
* -----------------------------------------------------------------
* Main Configuration File
*
* -> Configuration need variables for the Database connection
*
* Copyright (C) 2008 Adiscon GmbH.
*
* This file is part of phpLogCon.
*
* PhpLogCon is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PhpLogCon is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with phpLogCon. If not, see <http://www.gnu.org/licenses/>.
*
* A copy of the GPL can be found in the file "COPYING" in this
* distribution.
*********************************************************************
*/
// --- Avoid directly accessing this file!
if ( !defined('IN_PHPLOGCON') )
{
die('Hacking attempt');
exit;
}
// ---
// --- Avoid directly accessing this file!
if ( !defined('IN_PHPLOGCON') )
{
die('Hacking attempt');
exit;
}
// ---
// --- Database options
$CFG['UseDB'] = false;
$CFG['DBServer'] = "localhost";
$CFG['Port'] = 3306;
$CFG['DBName'] = "";
$CFG['TBPref'] = "logcon_";
$CFG['User'] = "root";
$CFG['Pass'] = "";
// ---
// --- Generic Options
$CFG['ShowDebugMsg'] = 1;
$CFG["ShowPageRenderStats"] = 1; // If enabled, you will see Pagerender Settings
// ---
// --- Database options
$CFG['UserDBEnabled'] = false;
$CFG['UserDBServer'] = "localhost";
$CFG['UserDBPort'] = 3306;
$CFG['UserDBName'] = "";
$CFG['UserDBPref'] = "logcon_";
$CFG['UserDBUser'] = "root";
$CFG['UserDBPass'] = "";
// ---
// --- Default Frontend Options
// --- Misc Options
$CFG['MiscShowDebugMsg'] = 1;
$CFG["MiscShowPageRenderStats"] = 1; // If enabled, you will see Pagerender Settings
// ---
// ---
// --- Default Frontend Options
$CFG['ViewUseTodayYesterday'] = 1; // If enabled, the date from today and yesterday is displayed as "today" and "yesterday"
$CFG['ViewMessageCharacterLimit'] = 100; // Default character limit for the message gets trunscated.
$CFG['ViewEntriesPerPage'] = 50; // Default number of syslog entries shown per page
$CFG['ViewEnableDetailPopups'] = 1; // If enabled, you will see additional Details for each syslog message on mouse over.
// --- Source Options
$CFG['Sources'][0]['ID'] = "Source1";
$CFG['Sources'][0]['Name'] = "Syslog Disk File";
$CFG['Sources'][0]['SourceType'] = SOURCE_DISK;
$CFG['Sources'][0]['LogLineType'] = "syslog";
$CFG['Sources'][0]['DiskFile'] = $gl_root_path . "samplelogs/syslog";
$CFG['Sources'][1]['ID'] = "Source2";
$CFG['Sources'][1]['Name'] = "Old Syslog Disk File";
$CFG['Sources'][1]['SourceType'] = SOURCE_DISK;
$CFG['Sources'][1]['LogLineType'] = "syslog";
$CFG['Sources'][1]['DiskFile'] = $gl_root_path . "samplelogs/syslog.0";
$CFG['Sources'][2]['ID'] = "Source3";
$CFG['Sources'][2]['Name'] = "RSyslog Disk File";
$CFG['Sources'][2]['SourceType'] = SOURCE_DISK;
$CFG['Sources'][2]['LogLineType'] = "syslog";
$CFG['Sources'][2]['DiskFile'] = $gl_root_path . "samplelogs/rsyslog";
$CFG['Sources'][3]['ID'] = "Source4";
$CFG['Sources'][3]['Name'] = "WinSyslog Disk File";
$CFG['Sources'][3]['SourceType'] = SOURCE_DISK;
$CFG['Sources'][3]['LogLineType'] = "winsyslog";
$CFG['Sources'][3]['DiskFile'] = $gl_root_path . "samplelogs/winsyslog";
// ---
$CFG['SearchCustomButtonCaption'] = "I'd like to feel sad"; // Default caption for the custom fast search button
$CFG['SearchCustomButtonSearch'] = "error"; // Default search string for the custom search button
// ---
// --- Source Options
$CFG['Sources'][Source1]['ID'] = "Source1";
$CFG['Sources'][Source1]['Name'] = "Syslog Disk File";
$CFG['Sources'][Source1]['SourceType'] = SOURCE_DISK;
$CFG['Sources'][Source1]['LogLineType'] = "syslog";
$CFG['Sources'][Source1]['DiskFile'] = $gl_root_path . "samplelogs/syslog";
$CFG['Sources'][Source2]['ID'] = "Source2";
$CFG['Sources'][Source2]['Name'] = "Old Syslog Disk File";
$CFG['Sources'][Source2]['SourceType'] = SOURCE_DISK;
$CFG['Sources'][Source2]['LogLineType'] = "syslog";
$CFG['Sources'][Source2]['DiskFile'] = $gl_root_path . "samplelogs/syslog.0";
$CFG['Sources'][Source3]['ID'] = "Source3";
$CFG['Sources'][Source3]['Name'] = "RSyslog Disk File";
$CFG['Sources'][Source3]['SourceType'] = SOURCE_DISK;
$CFG['Sources'][Source3]['LogLineType'] = "syslog";
$CFG['Sources'][Source3]['DiskFile'] = $gl_root_path . "samplelogs/rsyslog";
$CFG['Sources'][Source4]['ID'] = "Source4";
$CFG['Sources'][Source4]['Name'] = "WinSyslog Disk File";
$CFG['Sources'][Source4]['SourceType'] = SOURCE_DISK;
$CFG['Sources'][Source4]['LogLineType'] = "winsyslog";
$CFG['Sources'][Source4]['DiskFile'] = $gl_root_path . "samplelogs/winsyslog";
// ---
?>

82
src/css/highlight.css Normal file
View File

@ -0,0 +1,82 @@
/* Generic Style defintions */
.highlight_1
{
color: #F61313;
background-color: #FFFFFF;
}
.highlight_2
{
color: #F66913;
background-color: #FFFFFF;
}
.highlight_3
{
color: #17911C;
background-color: #FFFFFF;
}
.highlight_4
{
color: #C01695;
background-color: #FFFFFF;
}
.highlight_5
{
color: #1D618B;
background-color: #FFFFFF;
}
.highlight_6
{
color: #6C9117;
background-color: #FFFFFF;
}
.highlight_7
{
color: #0F2B7F;
background-color: #FFFFFF;
}
.highlight_8
{
color: #541791;
background-color: #FFFFFF;
}
.highlight_9
{
color: #146043;
background-color: #FFFFFF;
}
.highlight_10
{
color: #FF5451;
background-color: #333333;
}
.highlight_11
{
color: #F8C858;
background-color: #333333;
}
.highlight_12
{
color: #FCFF84;
background-color: #333333;
}
.highlight_13
{
color: #CEF07A;
background-color: #333333;
}
.highlight_14
{
color: #7AF0C2;
background-color: #333333;
}
.highlight_15
{
color: #84AFFF;
background-color: #333333;
}
.highlight_16
{
color: #A684FF;
background-color: #333333;
}

View File

@ -68,6 +68,24 @@ define('SYSLOG_LOCAL4', 20);
define('SYSLOG_LOCAL5', 21);
define('SYSLOG_LOCAL6', 22);
define('SYSLOG_LOCAL7', 23);
$facility_colors[SYSLOG_KERN] = "#F1BEA7";
$facility_colors[SYSLOG_USER] = "#F1D0A7";
$facility_colors[SYSLOG_MAIL] = "#F1E3A7";
$facility_colors[SYSLOG_DAEMON] = "#E5F1A7";
$facility_colors[SYSLOG_AUTH] = "#D3F1A7";
$facility_colors[SYSLOG_SYSLOG] = "#C1F1A7";
$facility_colors[SYSLOG_LPR] = "#A7F1D6";
$facility_colors[SYSLOG_NEWS] = "#A7F1E8";
$facility_colors[SYSLOG_UUCP] = "#A7E1F1";
$facility_colors[SYSLOG_CRON] = "#A7C8F1";
$facility_colors[SYSLOG_LOCAL0] = "#F2F2F2";
$facility_colors[SYSLOG_LOCAL1] = "#E4E5E6";
$facility_colors[SYSLOG_LOCAL2] = "#D6D9DA";
$facility_colors[SYSLOG_LOCAL3] = "#C9CDCF";
$facility_colors[SYSLOG_LOCAL4] = "#BEC2C4";
$facility_colors[SYSLOG_LOCAL5] = "#B1B6B9";
$facility_colors[SYSLOG_LOCAL6] = "#A3AAAD";
$facility_colors[SYSLOG_LOCAL7] = "#969DA1";
define('SYSLOG_EMERG', 0);
define('SYSLOG_ALERT', 1);
@ -77,6 +95,14 @@ define('SYSLOG_WARNING', 4);
define('SYSLOG_NOTICE', 5);
define('SYSLOG_INFO', 6);
define('SYSLOG_DEBUG', 7);
$severity_colors[SYSLOG_EMERG] = "#840A15";
$severity_colors[SYSLOG_ALERT] = "#BA0716";
$severity_colors[SYSLOG_CRIT] = "#CE0819";
$severity_colors[SYSLOG_ERR] = "#FF0A1F";
$severity_colors[SYSLOG_WARNING] = "#EF8200";
$severity_colors[SYSLOG_NOTICE] = "#14AD42";
$severity_colors[SYSLOG_INFO] = "#0C9C91";
$severity_colors[SYSLOG_DEBUG] = "#119BDE";
// ---
?>

View File

@ -50,6 +50,7 @@ $content['TITLE'] = "PhpLogCon - Release " . $content['BUILDNUMBER']; // Title o
$content['BASEPATH'] = $gl_root_path;
$content['EXTRA_METATAGS'] = "";
$content['EXTRA_JAVASCRIPT'] = "";
$content['EXTRA_STYLESHEET'] = "";
// ---
function InitBasicPhpLogCon()
@ -81,10 +82,14 @@ function InitPhpLogConConfigFile()
include_once($gl_root_path . 'config.php');
// Easier DB Access
define('DB_CONFIG', $CFG['TBPref'] . "config");
define('DB_CONFIG', $CFG['UserDBPref'] . "config");
// For ShowPageRenderStats
if ( $CFG['ShowPageRenderStats'] == 1 )
// Copy all entries into content variable
foreach ($CFG as $key => $value )
$content[$key] = $value;
// For MiscShowPageRenderStats
if ( $CFG['MiscShowPageRenderStats'] == 1 )
{
$content['ShowPageRenderStats'] = "true";
InitPageRenderStats();
@ -127,7 +132,7 @@ function InitPhpLogCon()
InitPhpLogConConfigFile();
// Establish DB Connection
if ( $CFG['UseDB'] )
if ( $CFG['UserDBEnabled'] )
DB_Connect();
// Now load the Page configuration values
@ -233,7 +238,7 @@ function InitConfigurationValues()
$rows = DB_GetAllRows($result, true, true);
// If Database is enabled, try to read from database!
if ( $CFG['UseDB'] )
if ( $CFG['UserDBEnabled'] )
{
if ( isset($rows ) )
{
@ -527,7 +532,7 @@ function CheckUserLogin( $username, $password )
}
else
{
if ( $CFG['ShowDebugMsg'] == 1 )
if ( $CFG['MiscShowDebugMsg'] == 1 )
DieWithFriendlyErrorMsg( "Debug Error: Could not login user '" . $username . "' <br><br><B>Sessionarray</B> <pre>" . var_export($_SESSION, true) . "</pre><br><B>SQL Statement</B>: " . $sqlselect );
// Default return false

View File

@ -33,56 +33,47 @@
if ( isset($CFG['Sources']) )
{
$iCount = count($CFG['Sources']);
for ( $i = 0; $i< $iCount; $i++ )
foreach( $CFG['Sources'] as &$mysource )
{
if ( isset($CFG['Sources'][$i]['SourceType']) )
if ( isset($mysource['SourceType']) )
{
// Set Array Index, TODO: Check for invalid characters!
$iSourceID = $CFG['Sources'][$i]['ID'];
if ( !isset($content['Sources'][$iSourceID]) )
$iSourceID = $mysource['ID'];
// Copy general properties
// $content['Sources'][$iSourceID]['ID'] = $mysource['ID'];
// $content['Sources'][$iSourceID]['Name'] = $mysource['Name'];
// $content['Sources'][$iSourceID]['SourceType'] = $mysource['SourceType'];
// Set default if not set!
if ( !isset($mysource['LogLineType']) )
$content['Sources'][$iSourceID]['LogLineType'] = "syslog";
// Only for the display box
$content['Sources'][$iSourceID]['selected'] = "";
// Create Config instance!
if ( $mysource['SourceType'] == SOURCE_DISK )
{
// Copy general properties
$content['Sources'][$iSourceID]['ID'] = $CFG['Sources'][$i]['ID'];
$content['Sources'][$iSourceID]['Name'] = $CFG['Sources'][$i]['Name'];
$content['Sources'][$iSourceID]['SourceType'] = $CFG['Sources'][$i]['SourceType'];
// Optional parameters
if ( isset($CFG['Sources'][$i]['LogLineType']) )
$content['Sources'][$iSourceID]['LogLineType'] = $CFG['Sources'][$i]['LogLineType'];
else // Default = syslog
$content['Sources'][$iSourceID]['LogLineType'] = "syslog";
// Only for the display box
$content['Sources'][$iSourceID]['selected'] = "";
// Create Config instance!
if ( $CFG['Sources'][$i]['SourceType'] == SOURCE_DISK )
{
$content['Sources'][$iSourceID]['ObjRef'] = new LogStreamConfigDisk();
$content['Sources'][$iSourceID]['ObjRef']->FileName = $CFG['Sources'][$i]['DiskFile'];
$content['Sources'][$iSourceID]['ObjRef']->LineParserType = $CFG['Sources'][$i]['LogLineType'];
}
else if ( $CFG['Sources'][$i]['SourceType'] == SOURCE_MYSQLDB )
{
// TODO!
die( "Not supported yet!" );
}
else
{
// UNKNOWN, remove config entry!
unset($content['Sources'][$iSourceID]);
// TODO: Output CONFIG WARNING
}
// Set default SourceID here!
if ( isset($content['Sources'][$iSourceID]) && !isset($currentSourceID) )
$currentSourceID = $iSourceID;
$content['Sources'][$iSourceID]['ObjRef'] = new LogStreamConfigDisk();
$content['Sources'][$iSourceID]['ObjRef']->FileName = $mysource['DiskFile'];
$content['Sources'][$iSourceID]['ObjRef']->LineParserType = $mysource['LogLineType'];
}
else if ( $mysource['SourceType'] == SOURCE_MYSQLDB )
{
// TODO!
die( "Not supported yet!" );
}
else
{
// TODO: OUTPUT CONFIG WARNING - duplicated ID!
{
// UNKNOWN, remove config entry!
unset($content['Sources'][$iSourceID]);
// TODO: Output CONFIG WARNING
}
// Set default SourceID here!
if ( isset($content['Sources'][$iSourceID]) && !isset($currentSourceID) )
$currentSourceID = $iSourceID;
}
}
}

View File

@ -52,6 +52,10 @@ IncludeLanguageFile( $gl_root_path . '/lang/' . $LANG . '/main.php' );
InitFilterHelpers();
// *** *** //
// --- Extra Stylesheet!
$content['EXTRA_STYLESHEET'] = '<link rel="stylesheet" href="css/highlight.css" type="text/css">';
// ---
// --- CONTENT Vars
if ( isset($_GET['uid']) )
{
@ -69,6 +73,9 @@ $content['uid_last'] = UID_UNKNOWN;
// Init Sorting variables
$content['sorting'] = "";
$content['searchstr'] = "";
$content['highlightstr'] = "";
$content['EXPAND_HIGHLIGHT'] = "false";
//if ( isset($content['myserver']) )
// $content['TITLE'] = "phpLogCon :: Home :: Server '" . $content['myserver']['Name'] . "'"; // Title of the Page
@ -76,9 +83,27 @@ $content['searchstr'] = "";
$content['TITLE'] = "phpLogCon :: Home";
// Read and process filters from search dialog!
if ( isset($_POST['search']) )
if ( (isset($_POST['search']) || isset($_GET['search'])) && (isset($_POST['filter']) || isset($_GET['filter'])) )
{
if ( $_POST['search'] == $content['LN_SEARCH_PERFORMADVANCED'])
// Copy search over
if ( isset($_POST['search']) )
$mysearch = $_POST['search'];
else
$mysearch = $_GET['search'];
if ( isset($_POST['search']) )
$myfilter = $_POST['filter'];
else
$myfilter = $_GET['filter'];
// Optionally read highlight words
if ( isset($_POST['highlight']) )
$content['highlightstr'] = $_POST['highlight'];
else if ( isset($_GET['highlight']) )
$content['highlightstr'] = $_GET['highlight'];
// Evaluate search now
if ( $mysearch == $content['LN_SEARCH_PERFORMADVANCED'])
{
if ( isset($_POST['filter_datemode']) )
{
@ -165,11 +190,41 @@ if ( isset($_POST['search']) )
$content['searchstr'] .= $_POST['filter_message'];
}
else if ( $_POST['search'] == $content['LN_SEARCH'])
else if ( $mysearch == $content['LN_SEARCH'])
{
// Message is just appended
if ( isset($_POST['filter']) && strlen($_POST['filter']) > 0 )
$content['searchstr'] = $_POST['filter'];
if ( isset($myfilter) && strlen($myfilter) > 0 )
$content['searchstr'] = $myfilter;
}
if ( strlen($content['highlightstr']) > 0 )
{
// user also wants to highlight words!
if ( strpos($content['highlightstr'], ",") === false)
{
$content['highlightwords'][0]['highlight'] = $content['highlightstr'];
$content['highlightwords'][0]['cssclass'] = "highlight_1";
$content['highlightwords'][0]['htmlcode'] = '<span class="' . $content['highlightwords'][0]['cssclass'] . '">' . $content['highlightwords'][0]['highlight']. '</span>';
}
else
{
// Split array into words
$tmparray = explode( ",", $content['highlightstr'] );
foreach( $tmparray as $word )
{
$content['highlightwords'][]['highlight'] = $word;
}
// Assign CSS Class to highlight words
for ($i = 0; $i < count($content['highlightwords']); $i++)
{
$content['highlightwords'][$i]['cssclass'] = "highlight_" . ($i+1);
$content['highlightwords'][$i]['htmlcode'] = '<span class="' . $content['highlightwords'][$i]['cssclass'] . '">' . $content['highlightwords'][$i]['highlight']. '</span>';
}
}
// Default expand Highlight Arrea!
$content['EXPAND_HIGHLIGHT'] = "true";
}
}
@ -188,36 +243,102 @@ if ( isset($content['Sources'][$currentSourceID]) && $content['Sources'][$curren
$stream->SetFilter($content['searchstr']);
$stream->Open( array ( SYSLOG_DATE, SYSLOG_FACILITY, SYSLOG_FACILITY_TEXT, SYSLOG_SEVERITY, SYSLOG_SEVERITY_TEXT, SYSLOG_HOST, SYSLOG_SYSLOGTAG, SYSLOG_MESSAGE, SYSLOG_MESSAGETYPE ), true);
$stream->SetReadDirection(EnumReadDirection::Backward);
$uID = $currentUID;
$counter = 0;
while ($stream->ReadNext($uID, $logArray) == SUCCESS && $counter <= 30)
if ($uID != UID_UNKNOWN)
{
// Copy Obtained array
$content['syslogmessages'][] = $logArray;
// Copy UID
$content['syslogmessages'][$counter]['UID'] = $uID;
// Set truncasted message for display
if ( isset($logArray[SYSLOG_MESSAGE]) )
$content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] = GetStringWithHTMLCodes(strlen($logArray[SYSLOG_MESSAGE]) > 100 ? substr($logArray[SYSLOG_MESSAGE], 0, 100 ) . " ..." : $logArray[SYSLOG_MESSAGE]);
else
$content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] = "";
// Create Displayable DataStamp
$content['syslogmessages'][$counter][SYSLOG_DATE_FORMATED] = GetFormatedDate($content['syslogmessages'][$counter][SYSLOG_DATE]);
// Increment Counter
$counter++;
// First read will also set the start position of the Stream!
$ret = $stream->Read($uID, $logArray);
}
else
$ret = $stream->ReadNext($uID, $logArray);
if ( $stream->ReadNext($uID, $logArray) == SUCCESS )
if ( $ret == SUCCESS )
{
$content['uid_next'] = $uID;
// Enable Player Pager
$content['main_pagerenabled'] = "true";
//Loop through the messages!
do
{
// Copy Obtained array
$content['syslogmessages'][] = $logArray;
// Copy UID
$content['syslogmessages'][$counter]['UID'] = $uID;
// Set truncasted message for display
if ( isset($logArray[SYSLOG_MESSAGE]) )
$content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] = GetStringWithHTMLCodes(strlen($logArray[SYSLOG_MESSAGE]) > 100 ? substr($logArray[SYSLOG_MESSAGE], 0, 100 ) . " ..." : $logArray[SYSLOG_MESSAGE]);
else
$content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] = "";
if ( isset($content['highlightwords']) )
{
// We need to highlight some words ^^!
foreach( $content['highlightwords'] as $highlightword )
$content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] = preg_replace( "/(" . $highlightword['highlight'] . ")/i", '<span class="' . $highlightword['cssclass'] . '">\\1</span>', $content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] );
// $content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] = str_ireplace( $highlightword['highlight'], $highlightword['htmlcode'], $content['syslogmessages'][$counter][SYSLOG_MESSAGETRUNSCATED] );
}
// Create Displayable DataStamp
$content['syslogmessages'][$counter][SYSLOG_DATE_FORMATED] = GetFormatedDate($content['syslogmessages'][$counter][SYSLOG_DATE]);
// --- Set CSS Class
if ( $counter % 2 == 0 )
$content['syslogmessages'][$counter]['cssclass'] = "line1";
else
$content['syslogmessages'][$counter]['cssclass'] = "line2";
// Set Syslog severity and facility col colors
if ( isset($content['syslogmessages'][$counter][SYSLOG_SEVERITY]) && strlen($content['syslogmessages'][$counter][SYSLOG_SEVERITY]) > 0)
{
$content['syslogmessages'][$counter]['severity_color'] = $severity_colors[$content['syslogmessages'][$counter][SYSLOG_SEVERITY]];
$content['syslogmessages'][$counter]['severity_cssclass'] = "lineColouredWhite";
}
else
{
// Use default colour!
$content['syslogmessages'][$counter]['severity_color'] = $severity_colors[SYSLOG_INFO];
$content['syslogmessages'][$counter]['severity_cssclass'] = $content['syslogmessages'][$counter]['cssclass'];
}
if ( isset($content['syslogmessages'][$counter][SYSLOG_FACILITY]) && strlen($content['syslogmessages'][$counter][SYSLOG_FACILITY]) > 0)
{
$content['syslogmessages'][$counter]['facility_color'] = $facility_colors[$content['syslogmessages'][$counter][SYSLOG_FACILITY]];
$content['syslogmessages'][$counter]['facility_cssclass'] = "lineColouredBlack";
}
else
{
// Use default colour!
$content['syslogmessages'][$counter]['facility_color'] = $facility_colors[SYSLOG_LOCAL0];
$content['syslogmessages'][$counter]['facility_cssclass'] = $content['syslogmessages'][$counter]['cssclass'];
}
// ---
// Increment Counter
$counter++;
} while ($stream->ReadNext($uID, $logArray) == SUCCESS && $counter <= $CFG['ViewEntriesPerPage']);
if ( $stream->ReadNext($uID, $logArray) == SUCCESS )
{
$content['uid_next'] = $uID;
// Enable Pager
$content['main_pagerenabled'] = "true";
}
else if ( $currentUID != UID_UNKNOWN )
{
// We can still go back, enable Pager
$content['main_pagerenabled'] = "true";
}
// This will enable to Main SyslogView
$content['syslogmessagesenabled'] = "true";
}
else
{
// TODO DISPLAY MISSING LOGDATA!
}
// Close file!
@ -229,21 +350,6 @@ if ( isset($content['Sources'][$currentSourceID]) && $content['Sources'][$curren
//$content['syslogmessages'][0] = array ( SYSLOG_DATE => "Feb 7 17:56:24", SYSLOG_FACILITY => 0, SYSLOG_FACILITY_TEXT => "kernel", SYSLOG_SEVERITY => 5, SYSLOG_SEVERITY_TEXT => "notice", SYSLOG_HOST => "localhost", SYSLOG_SYSLOGTAG => "RSyslogTest", SYSLOG_MESSAGE => "Kernel log daemon terminating.", SYSLOG_MESSAGETYPE => IUT_Syslog, );
//$content['syslogmessages'][1] = array ( SYSLOG_DATE => "Feb 6 18:56:24", SYSLOG_FACILITY => 0, SYSLOG_FACILITY_TEXT => "kernel", SYSLOG_SEVERITY => 5, SYSLOG_SEVERITY_TEXT => "notice", SYSLOG_HOST => "localhost", SYSLOG_SYSLOGTAG => "RSyslogTest", SYSLOG_MESSAGE => "Kernel log daemon terminating.", SYSLOG_MESSAGETYPE => IUT_Syslog, );
if ( isset($content['syslogmessages']) && count($content['syslogmessages']) > 0 )
{
// This will enable to Main SyslogView
$content['syslogmessagesenabled'] = "true";
for($i = 0; $i < count($content['syslogmessages']); $i++)
{
// --- Set CSS Class
if ( $i % 2 == 0 )
$content['syslogmessages'][$i]['cssclass'] = "line1";
else
$content['syslogmessages'][$i]['cssclass'] = "line2";
// ---
}
}
// ---
// --- Parsen and Output

View File

@ -90,3 +90,29 @@ function hidevisibility(ElementNameToggle, ElementNameButton)
toggle.style.visibility = "hidden";
toggle.style.display = "none";
}
function ResetFormValues(formName)
{
var myform = document.getElementById(formName);
var i = 0;
var iCount = myform.elements.length;
// Loop through text fields
for(i = 0; i < iCount; i++)
{
if (myform.elements[i].type == "text" )
{
// Reset textfield
myform.elements[i].value = "";
}
}
}
function SubmitForm(formName)
{
var myform = document.getElementById(formName);
if (myform != null)
{
myform.submit();
}
}

View File

@ -27,11 +27,15 @@ $content['LN_GRID_MSG'] = "Message";
$content['LN_SEARCH_USETHISBLA'] = "Use the form below and your advanced search will appear here";
$content['LN_SEARCH_FILTER'] = "Search (filter):";
$content['LN_SEARCH_ADVANCED'] = "Advanced Search";
$content['LN_SEARCH_FEELSAD'] = "I'm feeling sad ...";
//$content['LN_SEARCH_FEELSAD'] = "I'm feeling sad ...";
$content['LN_SEARCH'] = "Search";
$content['LN_SEARCH_RESET'] = "Reset search";
$content['LN_SEARCH_PERFORMADVANCED'] = "Perform Advanced Search";
$content['LN_HIGHLIGHT'] = "Hightlight >>";
$content['LN_HIGHLIGHT_OFF'] = "Hightlight <<";
$content['LN_HIGHLIGHT_WORDS'] = "Hightlight words comma separated";
// Filter Options
$content['LN_FILTER_DATE'] = "Datetime Range";

View File

@ -3,9 +3,9 @@
<head>
<title>{TITLE}</title>
{EXTRA_METATAGS}
<link rel="stylesheet" href="css/defaults.css" type="text/css">
<link rel="stylesheet" href="themes/{user_theme}/main.css" type="text/css">
{EXTRA_STYLESHEET}
<script type='text/javascript' src='{BASEPATH}js/common.js'></script>
{EXTRA_JAVASCRIPT}
</head>

View File

@ -1,7 +1,7 @@
<!-- INCLUDE include_header.html -->
<table border="0" cellspacing="0" cellpadding="2" align="center">
<form action="" method="post" id="search">
<form action="" method="post" 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">
@ -11,8 +11,9 @@
<input maxlength="2048" name="filter" size="80" title="Search" value="{searchstr}" class="SearchFormTextbox">
<br>
<input name="search" type="submit" value="{LN_SEARCH}" class="SearchFormControl">
<input name="search" type="submit" value="{LN_SEARCH_FEELSAD}" class="SearchFormControl">
<input type="reset" value="{LN_SEARCH_RESET}" class="SearchFormControl">
<a href="?search={LN_SEARCH}&filter={SearchCustomButtonSearch}" target="_top"><input name="lucky" type="button" value="{SearchCustomButtonCaption}" class="SearchFormControl"></a>
<input type="button" value="{LN_SEARCH_RESET}" class="SearchFormControl" OnClick="ResetFormValues('searchform');">
<input type="button" value="{LN_HIGHLIGHT}" class="SearchFormControl" OnClick="togglevisibility('HightLightArea');">
<br>
</td>
<td nowrap align="left" nowrap valign="top">
@ -21,186 +22,47 @@
<i>(sample: faciliy:local0 severity:warn)</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}</b></td>
<!-- END highlightwords -->
</tr>
</table>
</td>
</tr>
<!-- ENDIF EXPAND_HIGHLIGHT="true" -->
</table>
</span>
</td>
</tr>
</form>
</table>
<div id="HiddenOptions" class="HiddenContent">
<form action="" method="post" name="filterdateform">
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td width="50%" valign="top" class="table_with_border">
<table border="0" cellpadding="1" cellspacing="1" width="100%" align="center">
<tr>
<td colspan="2" align="center" valign="top" class="title">
<strong>{LN_FILTER_DATE}</strong></td>
</tr>
<tr>
<td align="left" class="cellmenu2" width="150" nowrap><b>{LN_FILTER_DATEMODE}</b></td>
<td align="right" class="line0" width="100%">
<select name="filter_datemode" size="1" OnChange="toggleDatefiltervisibility('filterdateform');">
<!-- BEGIN datemodes -->
<option {selected} value={ID}>{DisplayName}</option>
<!-- END datemodes -->
</select>
</td>
</tr>
</table>
<div id="HiddenDateFromOptions" class="HiddenContent">
<table border="0" cellpadding="1" cellspacing="1" bgcolor="#DDDDDD" width="100%" align="center">
<tr>
<td align="left" class="cellmenu2" width="150" nowrap><b>{LN_FILTER_DATEFROM}</b></td>
<td align="right" class="line1" width="100%">
<select name="filter_daterange_from_year" size="1">
<!-- BEGIN filter_daterange_from_year_list -->
<option {selected} value="{value}">{value}</option>
<!-- END filter_daterange_from_year_list -->
</select>
-
<select name="filter_daterange_from_month" size="1">
<!-- BEGIN filter_daterange_from_month_list -->
<option {selected} value="{value}">{value}</option>
<!-- END filter_daterange_from_month_list -->
</select>
-
<select name="filter_daterange_from_day" size="1">
<!-- BEGIN filter_daterange_from_day_list -->
<option {selected} value="{value}">{value}</option>
<!-- END filter_daterange_from_day_list -->
</select>
</td>
</tr>
<tr>
<td align="left" class="cellmenu2" width="150" nowrap><b>{LN_FILTER_DATETO}</b></td>
<td align="right" class="line0" width="100%">
<select name="filter_daterange_to_year" size="1">
<!-- BEGIN filter_daterange_to_year_list -->
<option {selected} value="{value}">{value}</option>
<!-- END filter_daterange_to_year_list -->
</select>
-
<select name="filter_daterange_to_month" size="1">
<!-- BEGIN filter_daterange_to_month_list -->
<option {selected} value="{value}">{value}</option>
<!-- END filter_daterange_to_month_list -->
</select>
-
<select name="filter_daterange_to_day" size="1">
<!-- BEGIN filter_daterange_to_day_list -->
<option {selected} value="{value}">{value}</option>
<!-- END filter_daterange_to_day_list -->
</select>
</td>
</tr>
</table>
</div>
<div id="HiddenDateLastXOptions" class="HiddenContent">
<table border="0" cellpadding="1" cellspacing="1" bgcolor="#DDDDDD" width="100%" align="center">
<tr>
<td align="left" class="cellmenu2" width="250" nowrap><b>{LN_FILTER_DATELASTX}</b></td>
<td align="right" class="line1" width="100%">
<select name="filter_daterange_last_x" size="1">
<!-- BEGIN filter_daterange_last_x_list -->
<option {selected} value="{ID}">{DisplayName}</option>
<!-- END filter_daterange_last_x_list -->
</select>
</td>
</tr>
</table>
</div>
<!--
<table border="0" cellpadding="1" cellspacing="1" bgcolor="#DDDDDD" width="100%" align="center">
<tr>
<td align="center" colspan="2">
<input type="button" value="{LN_FILTER_ADD2SEARCH}" OnClick="addDatefilterToSearch('filterdateform', 'search');">
</td>
</tr>
</table>
-->
</td>
<td width="10" valign="top" nowrap>&nbsp;</td>
<td width="50%" valign="top" class="table_with_border">
<table border="0" cellpadding="1" cellspacing="1" width="100%" align="center">
<tr>
<td colspan="4" align="center" valign="top" class="title">
<strong>{LN_FILTER_OTHERS}</strong></td>
</tr>
<tr>
<td align="left" class="cellmenu2" width="50%" nowrap><b>{LN_FILTER_FACILITY}</b></td>
<td align="right" class="line1" nowrap>
<select name="filter_facility" size="8" multiple>
<!-- BEGIN filter_facility_list -->
<option {selected} value="{ID}">{DisplayName}</option>
<!-- END filter_facility_list -->
</select>
</td>
<td align="left" class="cellmenu2" width="50%" nowrap><b>{LN_FILTER_SEVERITY}</b></td>
<td align="right" class="line1" nowrap>
<select name="filter_severity" size="8" multiple>
<!-- BEGIN filter_severity_list -->
<option {selected} value="{ID}">{DisplayName}</option>
<!-- END filter_severity_list -->
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="50%" valign="top" class="table_with_border">
<table border="0" cellpadding="1" cellspacing="1" width="100%" align="center">
<tr>
<td colspan="2" align="center" valign="top" class="title">
<strong>{LN_FILTER_MESSAGE}</strong></td>
</tr>
<tr>
<td align="center" class="line0" width="100%">
<input maxlength="2048" name="filter" size="70" title="Search" value="">
</td>
</tr>
</table>
</td>
<td width="10" valign="top" nowrap>&nbsp;</td>
<td width="50%" valign="top" class="table_with_border">
<table border="0" cellpadding="1" cellspacing="1" width="100%" align="center">
<tr>
<td align="left" class="cellmenu2" width="150" nowrap><b>{LN_FILTER_SYSLOGTAG}</b></td>
<td align="right" class="line1" nowrap>
<input maxlength="2048" name="filter" size="50" title="Search" value="">
</td>
</tr>
<tr>
<td align="left" class="cellmenu2" width="150" nowrap><b>{LN_FILTER_SOURCE}</b></td>
<td align="right" class="line1" nowrap>
<input maxlength="2048" name="filter" size="50" title="Search" value="">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3" valign="top" align="center">
<br>
<input name="search" type="submit" value="Perform Advanced Search" class="SearchFormControl">
</td>
</tr>
</table>
</form>
<br>
</div>
<!-- IF EXPAND_HIGHLIGHT="true" -->
<script language="javascript">
// Run some needed javascript functions now!
toggleDatefiltervisibility('filterdateform');
// Manually expand Hightlight field
togglevisibility('HightLightArea');
</script>
<!-- ENDIF EXPAND_HIGHLIGHT="true" -->
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="with_border">
<tr>
@ -244,8 +106,8 @@
<tr>
<td align="right" class="{cssclass}"><B>{UID}</B></td>
<td align="center" class="{cssclass}" nowrap><B>{timereported_formatted}</B></td>
<td align="left" class="{cssclass}" nowrap><B>{syslogfacility-text}</B></td>
<td align="left" class="{cssclass}" nowrap><B>{syslogseverity-text}</B></td>
<td align="left" class="{facility_cssclass}" bgcolor="{facility_color}" nowrap><B>{syslogfacility-text}</B></td>
<td align="left" class="{severity_cssclass}" bgcolor="{severity_color}" nowrap><B>{syslogseverity-text}</B></td>
<td align="left" class="{cssclass}" nowrap><B>{syslogtag}</B></td>
<td align="center" class="{cssclass}"><B>{IUT}</B></td>
<td align="left" class="{cssclass}" nowrap><B>{FROMHOST}</B></td>

View File

@ -183,6 +183,16 @@ font
background-color:#F9F9F9;
background-image: url("images/dither.png");
}
.lineColouredWhite
{
font-size: 8pt;
color: #FFFFFF;
}
.lineColouredBlack
{
font-size: 8pt;
color: #000000;
}
/* TOP Menu Classes */
.topmenu1

View File

@ -183,6 +183,16 @@ font
background-color:#F9F9F9;
background-image: url("images/dither.png");
}
.lineColouredWhite
{
font-size: 8pt;
color: #FFFFFF;
}
.lineColouredBlack
{
font-size: 8pt;
color: #000000;
}
/* TOP Menu Classes */
.topmenu1