Merge branch 'devel' of ssh://al@git.adiscon.com/git/phplogcon into v3-stable

This commit is contained in:
Andre Lorbach 2011-12-01 16:34:24 +01:00
commit e666357369
28 changed files with 3286 additions and 595 deletions

View File

@ -1,4 +1,35 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Version 3.3.0 (beta), 2011-11-14
- Added more debug output at critical areas.
- New view for Reports in main area. The new view is simular to the
statistics page and makes the report more aware and accessable to
loganalyzer users. The reports are still edited in the Admin Center.
- Syslog/Eventlog Summary Report - both reports have been upgraded to V2!
The "Event Count" column has been moved to the left of the report.
The report use logstream functions now to generate the report data.
This has a huge positive impact on performance of database logstream
sources. Checksum calculation needed to consolidate messages is now
done by the logstream source.
- Fixed bug with filter edit handling in report admin
- Added function to generate missing checksums for all messages in
logstream reports. This means first time you generate a report could
take a little bit longer then usual.
- Some cosmetic changes in Syslog/Eventlog Summary report templates.
- Added optimization check into logstream sources. This check is
automatically performed by the report admin. If Fields, Indexes
or Triggers are missing, the report admin will inform you and give you
the possibility optimize the logstream source. These checks are supported
for Mysql, PostgreSQL and MSSQL only. Loganalyzer will need ALTER TABLE
rights in order to fix or optimize the database structure.
Indexes added by the a Report will enhance generation time as the
involved fields are used for grouping or sorting. Triggers are used
to generate the message checksum when a new data record is INSERTED
into the database.
- Changed mininum width of context menu on mainpage from
200 to 250px due display problems in some browsers.
- Savedreports in Report Admin can now be saved only. This is useful
to check the logstream source after change for optimization.
---------------------------------------------------------------------------
Version 3.2.3 (stable), 2011-11-08 Version 3.2.3 (stable), 2011-11-08
- Removed magic quotes check from database functions (obselete due - Removed magic quotes check from database functions (obselete due
the changes in the last version) the changes in the last version)

View File

@ -39,6 +39,7 @@ $gl_root_path = './../';
include($gl_root_path . 'include/functions_common.php'); include($gl_root_path . 'include/functions_common.php');
include($gl_root_path . 'include/functions_frontendhelpers.php'); include($gl_root_path . 'include/functions_frontendhelpers.php');
include($gl_root_path . 'include/functions_filters.php'); include($gl_root_path . 'include/functions_filters.php');
include($gl_root_path . 'include/functions_reports.php');
// Set PAGE to be ADMINPAGE! // Set PAGE to be ADMINPAGE!
define('IS_ADMINPAGE', true); define('IS_ADMINPAGE', true);
@ -59,10 +60,11 @@ if ( !isset($_SESSION['SESSION_ISREADONLY']) || $_SESSION['SESSION_ISREADONLY']
( (
isset($_GET['op']) && isset($_GET['op']) &&
( (
$_GET['op'] == "initreport" || strpos($_GET['op'], "initreport") !== false ||
$_GET['op'] == "removereport" || strpos($_GET['op'], "removereport") !== false ||
$_GET['op'] == "addsavedreport" || strpos($_GET['op'], "editsavedreport") !== false ||
$_GET['op'] == "removesavedreport" strpos($_GET['op'], "addsavedreport") !== false ||
strpos($_GET['op'], "removesavedreport") !== false
) )
) )
) )
@ -71,8 +73,6 @@ if ( !isset($_SESSION['SESSION_ISREADONLY']) || $_SESSION['SESSION_ISREADONLY']
// --- // ---
// --- BEGIN Custom Code // --- BEGIN Custom Code
// Hardcoded settings
define('URL_ONLINEREPORTS', 'http://tools.adiscon.net/listreports.php');
$content['OPTIONAL_TITLE'] = ""; $content['OPTIONAL_TITLE'] = "";
// Firts of all init List of Reports! // Firts of all init List of Reports!
@ -307,7 +307,7 @@ if ( isset($_GET['op']) )
$content['ERROR_MSG'] = $content['LN_REPORTS_ERROR_INVALIDID']; $content['ERROR_MSG'] = $content['LN_REPORTS_ERROR_INVALIDID'];
} }
} }
else if ($_GET['op'] == "addsavedreport") else if (strpos($_GET['op'], "addsavedreport") !== false )
{ {
if ( isset($_GET['id']) ) if ( isset($_GET['id']) )
{ {
@ -317,7 +317,9 @@ if ( isset($_GET['op']) )
// Init Form variables // Init Form variables
$content['ISADDSAVEDREPORT'] = "true"; $content['ISADDSAVEDREPORT'] = "true";
$content['REPORT_FORMACTION'] = "addsavedreport"; $content['REPORT_FORMACTION'] = "addsavedreport";
$content['REPORT_FORMACTIONRETURN'] = "addsavedreport_return";
$content['REPORT_SENDBUTTON'] = $content['LN_REPORTS_ADDSAVEDREPORT']; $content['REPORT_SENDBUTTON'] = $content['LN_REPORTS_ADDSAVEDREPORT'];
$content['REPORT_SENDANDRETURN'] = $content['LN_REPORTS_ADDSAVEDREPORTANDRETURN'];
$content['FormUrlAddOP'] = "?op=addsavedreport&id=" . $content['ReportID']; $content['FormUrlAddOP'] = "?op=addsavedreport&id=" . $content['ReportID'];
// Check if report exists // Check if report exists
@ -359,6 +361,9 @@ if ( isset($_GET['op']) )
$mySource['sourceselected'] = ""; $mySource['sourceselected'] = "";
} }
// Check if logstream is optimized!
CheckConfiguredLogStreamSource($myReport, $content['SourceID']);
// Create Outputlist // Create Outputlist
$content['outputFormat'] = REPORT_OUTPUT_HTML; $content['outputFormat'] = REPORT_OUTPUT_HTML;
CreateOutputformatList( $content['outputFormat'] ); CreateOutputformatList( $content['outputFormat'] );
@ -390,12 +395,15 @@ if ( isset($_GET['op']) )
$content['ERROR_MSG'] = $content['LN_REPORTS_ERROR_INVALIDID']; $content['ERROR_MSG'] = $content['LN_REPORTS_ERROR_INVALIDID'];
} }
} }
else if ($_GET['op'] == "editsavedreport") else if (strpos($_GET['op'], "editsavedreport") !== false )
{ {
// Set Mode to add // Set Mode to add
$content['ISADDSAVEDREPORT'] = "true"; $content['ISADDSAVEDREPORT'] = "true";
$content['REPORT_FORMACTION'] = "editsavedreport"; $content['REPORT_FORMACTION'] = "editsavedreport";
$content['REPORT_FORMACTIONRETURN'] = "editsavedreport_return";
$content['REPORT_SENDBUTTON'] = $content['LN_REPORTS_EDITSAVEDREPORT']; $content['REPORT_SENDBUTTON'] = $content['LN_REPORTS_EDITSAVEDREPORT'];
$content['REPORT_SENDANDRETURN'] = $content['LN_REPORTS_EDITSAVEDREPORTANDRETURN'];
if ( isset($_GET['id']) ) if ( isset($_GET['id']) )
{ {
@ -448,6 +456,9 @@ if ( isset($_GET['op']) )
$mySource['sourceselected'] = ""; $mySource['sourceselected'] = "";
} }
// Check if logstream is optimized!
CheckConfiguredLogStreamSource($myReport, $content['SourceID']);
// Create Outputlist // Create Outputlist
$content['outputFormat'] = $mySavedReport['outputFormat']; $content['outputFormat'] = $mySavedReport['outputFormat'];
CreateOutputformatList( $content['outputFormat'] ); CreateOutputformatList( $content['outputFormat'] );
@ -590,9 +601,9 @@ if ( isset($content['ISADDSAVEDREPORT']) && $content['ISADDSAVEDREPORT'] )
$szFilterString = ""; $szFilterString = "";
if ( if (
( strlen($content['filterString']) <= 0 && // ( strlen($content['filterString']) <= 0 &&
isset($_POST['report_filterString']) ) // isset($_POST['report_filterString']) )
|| // ||
( strlen($content['filterString']) > 0 && ( strlen($content['filterString']) > 0 &&
!isset($_POST['subop']) && !isset($_POST['subop']) &&
!isset($_POST['subop_edit']) && !isset($_POST['subop_edit']) &&
@ -740,10 +751,20 @@ if ( isset($content['ISADDSAVEDREPORT']) && $content['ISADDSAVEDREPORT'] )
$i++; $i++;
} }
// DEBUG stuff // Reset Allfilters Array to NULL in this case!
// echo $content['filterString'] . "<br>\r\n"; if ( strlen($szFilterString) <= 0 )
// echo $szFilterString . "<br>\r\n"; {
// print_r ( $AllFilters ); $content['filterString'] = "";
$content['filterString_htmlform'] = "";
}
/*
// DEBUG stuff
echo $content['filterString'] . "<br>\r\n";
echo $szFilterString . "<br>\r\n";
print_r ( $AllFilters );
// */
} }
} }
@ -797,7 +818,10 @@ if ( isset($content['ISADDSAVEDREPORT']) && $content['ISADDSAVEDREPORT'] )
} }
// Copy Final Filterstring if necessary // Copy Final Filterstring if necessary
if ( strlen($szFilterString) > 0 ) if ( strlen($szFilterString) > 0 )
{
$content['filterString'] = $szFilterString; $content['filterString'] = $szFilterString;
$content['filterString_htmlform'] = htmlspecialchars($szFilterString);
}
// echo $content['SourceID']; // echo $content['SourceID'];
if ( isset($content['Sources'][$content['SourceID']]['ObjRef']) ) if ( isset($content['Sources'][$content['SourceID']]['ObjRef']) )
@ -959,7 +983,6 @@ if ( isset($_POST['op']) )
// Get ReportID! // Get ReportID!
if ( isset($_POST['id']) ) { $content['ReportID'] = DB_RemoveBadChars($_POST['id']); } else {$content['ReportID'] = ""; } if ( isset($_POST['id']) ) { $content['ReportID'] = DB_RemoveBadChars($_POST['id']); } else {$content['ReportID'] = ""; }
// Only Continue if reportid is valud! // Only Continue if reportid is valud!
if ( isset($content['REPORTS'][ $content['ReportID'] ]) ) if ( isset($content['REPORTS'][ $content['ReportID'] ]) )
{ {
@ -1074,7 +1097,7 @@ if ( isset($_POST['op']) )
if ( !isset($content['ISERROR']) ) if ( !isset($content['ISERROR']) )
{ {
// Everything was alright, so we go to the next step! // Everything was alright, so we go to the next step!
if ( $_POST['op'] == "addsavedreport" ) if ( strpos($_POST['op'], "addsavedreport") !== false )
{ {
// Add custom search now! // Add custom search now!
$sqlquery = "INSERT INTO " . DB_SAVEDREPORTS . " (reportid, sourceid, customTitle, customComment, filterString, customFilters, outputFormat, outputTarget, outputTargetDetails, scheduleSettings) $sqlquery = "INSERT INTO " . DB_SAVEDREPORTS . " (reportid, sourceid, customTitle, customComment, filterString, customFilters, outputFormat, outputTarget, outputTargetDetails, scheduleSettings)
@ -1089,14 +1112,29 @@ if ( isset($_POST['op']) )
'" . $content['outputTargetDetails'] . "', '" . $content['outputTargetDetails'] . "',
'" . $content['scheduleSettings'] . "' '" . $content['scheduleSettings'] . "'
)"; )";
// Perform INSERT
$result = DB_Query($sqlquery); $result = DB_Query($sqlquery);
// Get INSERTID from query!
$lastInsertID = mysql_insert_id();
// free ressources
DB_FreeQuery($result); DB_FreeQuery($result);
// Do the final redirect // Do the final redirect
RedirectResult( GetAndReplaceLangStr( $content['LN_REPORTS_HASBEENADDED'], DB_StripSlahes($content['customTitle']) ) , "reports.php" ); if ( strpos($_POST['op'], "_return") !== false )
RedirectResult( GetAndReplaceLangStr( $content['LN_REPORTS_HASBEENADDED'], DB_StripSlahes($content['customTitle']) ) , "reports.php" );
else
{
// Correct FormUrlAddUrl!
$szRediUrl = str_replace( "op=addsavedreport", "op=editsavedreport", $content['FormUrlAddOP']);
$szRediUrl .= "&savedreportid=" . $lastInsertID;
// Redirect to editpage!
RedirectResult( GetAndReplaceLangStr( $content['LN_REPORTS_HASBEENADDED'], DB_StripSlahes($content['customTitle']) ) , "reports.php" . $szRediUrl );
}
} }
else if ( $_POST['op'] == "editsavedreport" ) else if ( strpos($_POST['op'], "editsavedreport") !== false )
{ {
$result = DB_Query("SELECT ID FROM " . DB_SAVEDREPORTS . " WHERE ID = " . $content['SavedReportID']); $result = DB_Query("SELECT ID FROM " . DB_SAVEDREPORTS . " WHERE ID = " . $content['SavedReportID']);
$myrow = DB_GetSingleRow($result, true); $myrow = DB_GetSingleRow($result, true);
@ -1123,7 +1161,10 @@ if ( isset($_POST['op']) )
DB_FreeQuery($result); DB_FreeQuery($result);
// Done redirect! // Done redirect!
RedirectResult( GetAndReplaceLangStr( $content['LN_REPORTS_HASBEENEDIT'], DB_StripSlahes($content['customTitle']) ) , "reports.php" ); if ( strpos($_POST['op'], "_return") !== false )
RedirectResult( GetAndReplaceLangStr( $content['LN_REPORTS_HASBEENEDIT'], DB_StripSlahes($content['customTitle']) ) , "reports.php" );
else
RedirectResult( GetAndReplaceLangStr( $content['LN_REPORTS_HASBEENEDIT'], DB_StripSlahes($content['customTitle']) ) , "reports.php" . $content['FormUrlAddOP'] );
} }
} }
@ -1224,6 +1265,198 @@ $page -> output();
// --- // ---
// --- BEGIN Helper functions // --- BEGIN Helper functions
// --- // ---
/*
* Helper function to init custom filters from report
*/
function CheckConfiguredLogStreamSource($myReport, $mySourceID)
{
global $content, $extraErrorDescription;
// Get Objectreference to report
$myReportObj = $myReport["ObjRef"];
// Handle GET and POST input!
$content['MSG_WARNING_FORMURL'] = $_SERVER['SCRIPT_NAME'] . "?";
$content['MSG_CHECK_URL'] = $_SERVER['SCRIPT_NAME'] . "?";
foreach ($_GET as $varname => $varvalue)
{
// All variables!
$content['MSG_WARNING_FORMURL'] .= $varname . "=" . $varvalue . "&";
// Skip the Optimize variable!
if (strpos( $varname, "optimize" ) === false )
$content['MSG_CHECK_URL'] .= $varname . "=" . $varvalue . "&";
}
foreach ($_POST as $varname => $varvalue)
$content['POST_VARIABLES'][] = array( "varname" => $varname, "varvalue" => $varvalue );
// Append Force Optimice Paramater
$content['MSG_CHECK_URL'] .= "forcecheckoptimize=true";
// Check if optimize variable is set!
if ( isset($_GET['optimize']) )
{
// Check what we have to do
if ( $_GET['optimize'] == "addfields" )
{
// This will create all INDEXES we need for this logstream!
$res = $myReportObj->CreateMissingLogStreamFields( $mySourceID );
if ( $res != SUCCESS )
{
$content['ISERROR'] = true;
$content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_REPORTS_ERROR_FAILED_ADDING_FIELDS'], $content['SOURCES'][$mySourceID]['Name'], $res );
if ( isset($extraErrorDescription) )
$content['ERROR_MSG'] .= "<br><br>" . GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
}
// Show information in performance warning area
$content['ISSOURCENOTOPTIMIZED'] = true;
$content['MSG_WARNING_TITLE'] = $content['LN_REPORTS_FIELDS_CREATED'];
$content['MSG_WARNING_CLASS'] = 'PriorityNotice';
$content['MSG_WARNING_DETAILS'] = GetAndReplaceLangStr( $content['LN_REPORTS_FIELDS_CREATED_SUCCESS'], $content['SOURCES'][$mySourceID]['Name'] );
$content['MSG_WARNING_SUBMITFORM'] = "false";
// return result
return $res;
}
else if ( $_GET['optimize'] == "indexes" )
{
// This will create all INDEXES we need for this logstream!
$res = $myReportObj->CreateLogStreamIndexes( $mySourceID );
if ( $res != SUCCESS )
{
$content['ISERROR'] = true;
$content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_REPORTS_ERROR_FAILED_CREATE_INDEXES'], $content['SOURCES'][$mySourceID]['Name'], $res );
if ( isset($extraErrorDescription) )
$content['ERROR_MSG'] .= "<br><br>" . GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
}
// Show information in performance warning area
$content['ISSOURCENOTOPTIMIZED'] = true;
$content['MSG_WARNING_TITLE'] = $content['LN_REPORTS_INDEX_CREATED'];
$content['MSG_WARNING_CLASS'] = 'PriorityNotice';
$content['MSG_WARNING_DETAILS'] = GetAndReplaceLangStr( $content['LN_REPORTS_INDEX_CREATED_SUCCESS'], $content['SOURCES'][$mySourceID]['Name'] );
$content['MSG_WARNING_SUBMITFORM'] = "false";
// return result
return $res;
}
else if ( $_GET['optimize'] == "trigger" )
{
// This will create all INDEXES we need for this logstream!
$res = $myReportObj->CreateLogStreamTrigger( $mySourceID );
if ( $res != SUCCESS )
{
$content['ISERROR'] = true;
$content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_REPORTS_ERROR_FAILED_CREATE_TRIGGER'], $content['SOURCES'][$mySourceID]['Name'], $res );
if ( isset($extraErrorDescription) )
$content['ERROR_MSG'] .= "<br><br>" . GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
}
else
{
// Show information in performance warning area
$content['ISSOURCENOTOPTIMIZED'] = true;
$content['MSG_WARNING_TITLE'] = $content['LN_REPORTS_TRIGGER_CREATED'];
$content['MSG_WARNING_CLASS'] = 'PriorityNotice';
$content['MSG_WARNING_DETAILS'] = GetAndReplaceLangStr( $content['LN_REPORTS_TRIGGER_CREATED_SUCCESS'], $content['SOURCES'][$mySourceID]['Name'] );
$content['MSG_WARNING_SUBMITFORM'] = "false";
}
// return result
return $res;
}
else if ( $_GET['optimize'] == "checksum" )
{
// This will create all INDEXES we need for this logstream!
$res = $myReportObj->ChangeChecksumFieldUnsigned( $mySourceID );
if ( $res != SUCCESS )
{
$content['ISERROR'] = true;
$content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_REPORTS_ERROR_FAILED_CHANGE_CHECKSUM'], $content['SOURCES'][$mySourceID]['Name'], $res );
if ( isset($extraErrorDescription) )
$content['ERROR_MSG'] .= "<br><br>" . GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
}
else
{
// Show information in performance warning area
$content['ISSOURCENOTOPTIMIZED'] = true;
$content['MSG_WARNING_TITLE'] = $content['LN_REPORTS_CHECKSUM_CHANGED'];
$content['MSG_WARNING_CLASS'] = 'PriorityNotice';
$content['MSG_WARNING_DETAILS'] = GetAndReplaceLangStr( $content['LN_REPORTS_CHECKSUM_CHANGED_SUCCESS'], $content['SOURCES'][$mySourceID]['Name'] );
$content['MSG_WARNING_SUBMITFORM'] = "false";
}
// return result
return $res;
}
}
// Use SESSION to check if Source needs to be checked for optimization
$bForceCheck = false;
if ( !isset($_SESSION['Sources'][$mySourceID]['optimized']) ||
$_SESSION['Sources'][$mySourceID]['optimized'] == false ||
( isset($_GET['forcecheckoptimize']) && $_GET['forcecheckoptimize'] == "true" )
)
// Set Checking to true!
$bForceCheck = true;
// Lets see if we need to check
if ( $bForceCheck )
{
// Run checks
$res = $myReportObj->CheckLogStreamSource( $mySourceID );
if ( $res != SUCCESS )
{
// Current Logstream Source is not optimized! Show to user!
$content['ISSOURCENOTOPTIMIZED'] = true;
if ( $res == ERROR_DB_DBFIELDNOTFOUND )
{
$content['MSG_WARNING_TITLE'] = $content['LN_REPORTS_PERFORMANCE_WARNING'];
$content['MSG_WARNING_CLASS'] = 'PriorityWarning';
$content['MSG_WARNING_DETAILS'] = GetAndReplaceLangStr( $content['LN_REPORTS_ADD_MISSINGFIELDS'], $content['SOURCES'][$mySourceID]['Name'] ); // GetAndReplaceLangStr( $content['LN_REPORTS_ERROR_IDNOTFOUND'], $content['ReportID'] );
$content['MSG_WARNING_SUBMITFORM'] = "true";
$content['MSG_WARNING_FORMURL'] .= "optimize=addfields"; // Addmissing fields
}
else if ( $res == ERROR_DB_INDEXESMISSING )
{
$content['MSG_WARNING_TITLE'] = $content['LN_REPORTS_PERFORMANCE_WARNING'];
$content['MSG_WARNING_CLASS'] = 'PriorityWarning';
$content['MSG_WARNING_DETAILS'] = GetAndReplaceLangStr( $content['LN_REPORTS_OPTIMIZE_INDEXES'], $content['SOURCES'][$mySourceID]['Name'] ); // GetAndReplaceLangStr( $content['LN_REPORTS_ERROR_IDNOTFOUND'], $content['ReportID'] );
$content['MSG_WARNING_SUBMITFORM'] = "true";
$content['MSG_WARNING_FORMURL'] .= "optimize=indexes"; // Add missing INDEXES
}
else if ( $res == ERROR_DB_TRIGGERMISSING )
{
$content['MSG_WARNING_TITLE'] = $content['LN_REPORTS_PERFORMANCE_WARNING'];
$content['MSG_WARNING_CLASS'] = 'PriorityWarning';
$content['MSG_WARNING_DETAILS'] = GetAndReplaceLangStr( $content['LN_REPORTS_OPTIMIZE_TRIGGER'], $content['SOURCES'][$mySourceID]['Name'] ); // GetAndReplaceLangStr( $content['LN_REPORTS_ERROR_IDNOTFOUND'], $content['ReportID'] );
$content['MSG_WARNING_SUBMITFORM'] = "true";
$content['MSG_WARNING_FORMURL'] .= "optimize=trigger"; // Add missing TRIGGERS
}
else if ( $res == ERROR_DB_CHECKSUMERROR )
{
$content['MSG_WARNING_TITLE'] = $content['LN_REPORTS_PERFORMANCE_WARNING'];
$content['MSG_WARNING_CLASS'] = 'PriorityWarning';
$content['MSG_WARNING_DETAILS'] = GetAndReplaceLangStr( $content['LN_REPORTS_CHANGE_CHECKSUM'], $content['SOURCES'][$mySourceID]['Name'] ); // GetAndReplaceLangStr( $content['LN_REPORTS_ERROR_IDNOTFOUND'], $content['ReportID'] );
$content['MSG_WARNING_SUBMITFORM'] = "true";
$content['MSG_WARNING_FORMURL'] .= "optimize=checksum"; // Change Checksum field!
}
}
else
{
// Check was successfull! Set Checked Property in LogStream Source
$_SESSION['Sources'][$mySourceID]['optimized'] = true;
}
}
}
/*
* Helper function to init custom filters from report
*/
function InitCustomFilterDefinitions($myReport, $CustomFilterValues) function InitCustomFilterDefinitions($myReport, $CustomFilterValues)
{ {
global $content; global $content;
@ -1312,224 +1545,6 @@ function InitOutputtargetDefinitions($myReport, $outputTargetDetails)
} }
} }
function CreateCronCommand( $myReportID, $mySavedReportID = null )
{
global $content, $gl_root_path, $myReport;
if ( isset($mySavedReportID) )
{
// Get Reference to report!
$myReport = $content['REPORTS'][ $myReportID ];
// Get reference to savedreport
$mySavedReport = $myReport['SAVEDREPORTS'][ $mySavedReportID ];
// Get configured Source for savedreport
$myReportSource = null;
if ( isset($content['Sources'][ $mySavedReport['sourceid'] ]) )
$myReportSource = $content['Sources'][ $mySavedReport['sourceid'] ];
$pos = strpos( strtoupper(PHP_OS), "WIN");
if ($pos !== false)
{
// Running on Windows
$phpCmd = PHP_BINDIR . "\\php.exe";
$phpScript = realpath($gl_root_path) . "cron\\cmdreportgen.php";
}
else
{
// Running on LINUX
$phpCmd = PHP_BINDIR . "/php";
$phpScript = realpath($gl_root_path) . "/cron/cmdreportgen.php";
}
// Enable display of report command
$content['enableCronCommand'] = true;
$szCommand = $phpCmd . " " . $phpScript . " runreport " . $myReportID . " " . $mySavedReportID;
// --- Check for user or group sources
if ( $myReportSource['userid'] != null )
{
$szCommand .= " " . "userid=" . $myReportSource['userid'];
}
else if ( $myReportSource['groupid'] != null )
{
$szCommand .= " " . "groupid=" . $myReportSource['groupid'];
}
// ---
}
else
{
// Disable display of report command
$content['enableCronCommand'] = false;
$szCommand = "";
}
// return result
return $szCommand;
}
function InitOnlineReports()
{
global $content;
$xmlArray = xml2array( URL_ONLINEREPORTS );
if ( is_array($xmlArray) && isset($xmlArray['reports']['report']) && count($xmlArray['reports']['report']) > 0 )
{
foreach( $xmlArray['reports']['report'] as $myOnlineReport )
{
// Copy to OnlineReports Array
$content['ONLINEREPORTS'][] = $myOnlineReport;
}
// Success!
return true;
}
else
// Failure
return false;
}
// Helper function from php doc
function xml2array($url, $get_attributes = 1, $priority = 'tag')
{
$contents = "";
if (!function_exists('xml_parser_create'))
{
return false;
}
$parser = xml_parser_create('');
if (!($fp = @ fopen($url, 'rb')))
{
return false;
}
while (!feof($fp))
{
$contents .= fread($fp, 8192);
}
fclose($fp);
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8");
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, trim($contents), $xml_values);
xml_parser_free($parser);
if (!$xml_values)
return; //Hmm...
$xml_array = array ();
$parents = array ();
$opened_tags = array ();
$arr = array ();
$current = & $xml_array;
$repeated_tag_index = array ();
foreach ($xml_values as $data)
{
unset ($attributes, $value);
extract($data);
$result = array ();
$attributes_data = array ();
if (isset ($value))
{
if ($priority == 'tag')
$result = $value;
else
$result['value'] = $value;
}
if (isset ($attributes) and $get_attributes)
{
foreach ($attributes as $attr => $val)
{
if ($priority == 'tag')
$attributes_data[$attr] = $val;
else
$result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr'
}
}
if ($type == "open")
{
$parent[$level -1] = & $current;
if (!is_array($current) or (!in_array($tag, array_keys($current))))
{
$current[$tag] = $result;
if ($attributes_data)
$current[$tag . '_attr'] = $attributes_data;
$repeated_tag_index[$tag . '_' . $level] = 1;
$current = & $current[$tag];
}
else
{
if (isset ($current[$tag][0]))
{
$current[$tag][$repeated_tag_index[$tag . '_' . $level]] = $result;
$repeated_tag_index[$tag . '_' . $level]++;
}
else
{
$current[$tag] = array (
$current[$tag],
$result
);
$repeated_tag_index[$tag . '_' . $level] = 2;
if (isset ($current[$tag . '_attr']))
{
$current[$tag]['0_attr'] = $current[$tag . '_attr'];
unset ($current[$tag . '_attr']);
}
}
$last_item_index = $repeated_tag_index[$tag . '_' . $level] - 1;
$current = & $current[$tag][$last_item_index];
}
}
elseif ($type == "complete")
{
if (!isset ($current[$tag]))
{
$current[$tag] = $result;
$repeated_tag_index[$tag . '_' . $level] = 1;
if ($priority == 'tag' and $attributes_data)
$current[$tag . '_attr'] = $attributes_data;
}
else
{
if (isset ($current[$tag][0]) and is_array($current[$tag]))
{
$current[$tag][$repeated_tag_index[$tag . '_' . $level]] = $result;
if ($priority == 'tag' and $get_attributes and $attributes_data)
{
$current[$tag][$repeated_tag_index[$tag . '_' . $level] . '_attr'] = $attributes_data;
}
$repeated_tag_index[$tag . '_' . $level]++;
}
else
{
$current[$tag] = array (
$current[$tag],
$result
);
$repeated_tag_index[$tag . '_' . $level] = 1;
if ($priority == 'tag' and $get_attributes)
{
if (isset ($current[$tag . '_attr']))
{
$current[$tag]['0_attr'] = $current[$tag . '_attr'];
unset ($current[$tag . '_attr']);
}
if ($attributes_data)
{
$current[$tag][$repeated_tag_index[$tag . '_' . $level] . '_attr'] = $attributes_data;
}
}
$repeated_tag_index[$tag . '_' . $level]++; //0 and 1 index is already taken
}
}
}
elseif ($type == 'close')
{
$current = & $parent[$level -1];
}
}
return ($xml_array);
}
/* /*
* Helper functions to init a Datefield * Helper functions to init a Datefield
*/ */

View File

@ -208,7 +208,7 @@ abstract class LogStream {
* *
* @return integer Error stat * @return integer Error stat
*/ */
public abstract function ConsolidateDataByField($szConsFieldId, $nRecordLimit, $szSortFieldId, $nSortingOrder, $bIncludeLogStreamFields = false); public abstract function ConsolidateDataByField($szConsFieldId, $nRecordLimit, $szSortFieldId, $nSortingOrder, $bIncludeLogStreamFields = false, $bIncludeMinMaxDateFields = false);
/** /**
@ -253,6 +253,71 @@ abstract class LogStream {
public abstract function SaveMessageChecksum( $arrProperitesIn ); public abstract function SaveMessageChecksum( $arrProperitesIn );
/*
* Helper function to set the checksum for all messages in the current logstream class
*/
public abstract function UpdateAllMessageChecksum( );
/*
* Helper function for logstream classes to clear filter based stuff
*/
public abstract function ResetFilters( );
/*
* Helper function for logstream classes to check if all fields are available!
*/
public abstract function VerifyFields( $arrProperitesIn );
/*
* Helper function for logstream classes to create missing indexes, only applies to database based logstream classes
*/
public abstract function CreateMissingFields( $arrProperitesIn );
/*
* Helper function for logstream classes to check for data indexes, only applies to database based logstream classes
*/
public abstract function VerifyIndexes( $arrProperitesIn );
/*
* Helper function for logstream classes to create missing indexes, only applies to database based logstream classes
*/
public abstract function CreateMissingIndexes( $arrProperitesIn );
/*
* Helper function for logstream classes to check for missing triggers, only applies to database based logstream classes
*/
public abstract function VerifyChecksumTrigger( $myTriggerProperty );
/*
* Helper function for logstream classes to create missing trigger, only applies to database based logstream classes
*/
public abstract function CreateMissingTrigger( $myTriggerProperty, $myCheckSumProperty );
/*
* Helper function for logstream classes to create the SQL statement needed to create the trigger, only applies to database based logstream classes
*/
public abstract function GetCreateMissingTriggerSQL( $myDBTriggerField, $myDBTriggerCheckSumField );
/*
* Helper function for logstream classes to check if the checksum field is configured correctly
*/
public abstract function VerifyChecksumField( );
/*
* Helper function for logstream classes to change the checksum field from unsigned INT
*/
public abstract function ChangeChecksumFieldUnsigned( );
/* /*
* Helper functino to trigger initialisation of MsgParsers * Helper functino to trigger initialisation of MsgParsers
*/ */
@ -275,7 +340,10 @@ abstract class LogStream {
else else
$finalfilters = $szFilters; $finalfilters = $szFilters;
OutputDebugMessage("SetFilter combined = '" . $finalfilters . "'. ", DEBUG_DEBUG); OutputDebugMessage("LogStream|SetFilter: SetFilter combined = '" . $finalfilters . "'. ", DEBUG_DEBUG);
// Reset Filters first to make sure we do not add multiple filters!
$this->_filters = null;
// Parse Filters from string // Parse Filters from string
$this->ParseFilters($finalfilters); $this->ParseFilters($finalfilters);
@ -586,6 +654,23 @@ abstract class LogStream {
return null; return null;
} }
/*
* Helper function to get the internal Field ID by database field name!
*/
public function GetFieldIDbyDatabaseMapping($szTableType, $szFieldName)
{
global $content, $dbmapping;
foreach( $dbmapping[$szTableType]['DBMAPPINGS'] as $myFieldID => $myDBMapping )
{
if ( $myDBMapping == $szFieldName )
return $myFieldID;
}
// Default return!
return $szFieldName;
}
/* /*
* --- PIRVATE HELPERS! * --- PIRVATE HELPERS!
*/ */
@ -1184,7 +1269,5 @@ abstract class LogStream {
return -1; return -1;
} }
} }
?> ?>

View File

@ -64,6 +64,35 @@ class LogStreamConfigPDO extends LogStreamConfig {
return new LogStreamPDO($o); return new LogStreamPDO($o);
} }
public function GetPDOTriggersSupported()
{
// TRIGGERS are not supported for all db engines!
switch ($this->DBType)
{
case DB_MYSQL:
return true;
case DB_MSSQL:
return true;
case DB_ODBC:
return false;
case DB_PGSQL:
return true;
case DB_OCI:
return false;
case DB_DB2:
return false;
case DB_FIREBIRD:
return false;
case DB_INFORMIX:
return false;
case DB_SQLITE:
return false;
default:
return false;
}
}
public function GetPDODatabaseType() public function GetPDODatabaseType()
{ {
switch ($this->DBType) switch ($this->DBType)

View File

@ -112,6 +112,15 @@ class LogStreamDB extends LogStream {
return SUCCESS; return SUCCESS;
} }
/*
* Helper function to clear the current querystring!
*/
public function ResetFilters()
{
// Clear _SQLwhereClause variable!
$this->_SQLwhereClause = "";
}
/** /**
* Close the database connection. * Close the database connection.
* *
@ -172,6 +181,313 @@ class LogStreamDB extends LogStream {
return SUCCESS; return SUCCESS;
} }
/*
* Implementation of VerifyFields: Checks if fields exist in table
*/
public function VerifyFields( $arrProperitesIn )
{
global $dbmapping, $fields;
// Get List of Indexes as Array
$arrFieldKeys = $this->GetFieldsAsArray();
$szTableType = $this->_logStreamConfigObj->DBTableType;
// Loop through all fields to see which one is missing!
foreach ( $arrProperitesIn as $myproperty )
{
// echo $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "<br>";
if ( isset($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty]) && in_array($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty], $arrFieldKeys) )
{
OutputDebugMessage("LogStreamDB|VerifyFields: Found Field for '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "'", DEBUG_ULTRADEBUG);
continue;
}
else
{
// Index is missing for this field!
OutputDebugMessage("LogStreamDB|VerifyFields: Missing Field for '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "'", DEBUG_WARN);
return ERROR_DB_DBFIELDNOTFOUND;
}
}
// Successfull
return SUCCESS;
}
/*
* Implementation of VerifyIndexes: Checks if indexes exist for desired fields
*/
public function VerifyIndexes( $arrProperitesIn )
{
global $dbmapping, $fields;
// Get List of Indexes as Array
$arrIndexKeys = $this->GetIndexesAsArray();
$szTableType = $this->_logStreamConfigObj->DBTableType;
// Loop through all fields to see which one is missing!
foreach ( $arrProperitesIn as $myproperty )
{
// echo $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "<br>";
if ( isset($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty]) && in_array($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty], $arrIndexKeys) )
{
OutputDebugMessage("LogStreamDB|VerifyIndexes: Found INDEX for '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "'", DEBUG_ULTRADEBUG);
continue;
}
else
{
// Index is missing for this field!
OutputDebugMessage("LogStreamDB|VerifyIndexes: Missing INDEX for '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "'", DEBUG_WARN);
return ERROR_DB_INDEXESMISSING;
}
}
// Successfull
return SUCCESS;
}
/*
* Implementation of VerifyChecksumTrigger: Checks if checksum trigger exists
*/
public function VerifyChecksumTrigger( $myTriggerProperty )
{
global $dbmapping, $fields;
// Get List of Triggers as Array
$arrIndexTriggers = $this->GetTriggersAsArray();
$szTableType = $this->_logStreamConfigObj->DBTableType;
$szDBName = $this->_logStreamConfigObj->DBName;
$szTableName = $this->_logStreamConfigObj->DBTableName;
$szDBTriggerField = $dbmapping[$szTableType]['DBMAPPINGS'][$myTriggerProperty];
// Create Triggername
$szTriggerName = $szDBName . "_" . $szTableName . "_" . $szDBTriggerField;
// Try to find logstream trigger
if ( count($arrIndexTriggers) > 0 )
{
if ( in_array($szTriggerName, $arrIndexTriggers) )
return SUCCESS;
else
{
// Index is missing for this field!
OutputDebugMessage("LogStreamDB|VerifyChecksumTrigger: Missing TRIGGER '" . $szTriggerName . "' for Table '" . $szTableName . "'", DEBUG_WARN);
return ERROR_DB_TRIGGERMISSING;
}
}
else
{
// Index is missing for this field!
OutputDebugMessage("LogStreamDB|VerifyChecksumTrigger: No TRIGGERS found in your database", DEBUG_WARN);
return ERROR_DB_TRIGGERMISSING;
}
}
/*
* Implementation of CreateMissingIndexes: Checks if indexes exist for desired fields
*/
public function CreateMissingIndexes( $arrProperitesIn )
{
global $dbmapping, $fields, $querycount;
// Get List of Indexes as Array
$arrIndexKeys = $this->GetIndexesAsArray();
$szTableType = $this->_logStreamConfigObj->DBTableType;
// Loop through all fields to see which one is missing!
foreach ( $arrProperitesIn as $myproperty )
{
if ( isset($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty]) && in_array($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty], $arrIndexKeys) )
continue;
else
{
// Update Table schema now!
$szSql = "ALTER TABLE " . $this->_logStreamConfigObj->DBTableName . " ADD INDEX ( " . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . " )";
// Index is missing for this field!
OutputDebugMessage("LogStreamDB|CreateMissingIndexes: Createing missing INDEX for '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "' - " . $szSql, DEBUG_INFO);
// Add missing INDEX now!
$myQuery = mysql_query($szSql, $this->_dbhandle);
if (!$myQuery)
{
// Return failure!
$this->PrintDebugError("Dynamically Adding INDEX for '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "' failed with Statement: '" . $szSql . "'");
return ERROR_DB_INDEXFAILED;
}
}
}
// Successfull
return SUCCESS;
}
/*
* Implementation of CreateMissingFields: Checks if indexes exist for desired fields
*/
public function CreateMissingFields( $arrProperitesIn )
{
global $dbmapping, $fields, $querycount;
// Get List of Indexes as Array
$arrFieldKeys = $this->GetFieldsAsArray();
$szTableType = $this->_logStreamConfigObj->DBTableType;
// Loop through all fields to see which one is missing!
foreach ( $arrProperitesIn as $myproperty )
{
if ( isset($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty]) && in_array($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty], $arrFieldKeys) )
continue;
else
{
if ( $this->HandleMissingField( $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty], $arrProperitesIn ) == SUCCESS )
{
// Index is missing for this field!
OutputDebugMessage("LogStreamDB|CreateMissingFields: Createing missing FIELD for '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty], DEBUG_INFO);
}
else
{
// Return failure!
$this->PrintDebugError("Dynamically Adding FIELD for '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "' failed!");
return ERROR_DB_ADDDBFIELDFAILED;
}
}
}
// Successfull
return SUCCESS;
}
/*
* Implementation of GetCreateMissingTriggerSQL: Creates SQL needed to create a TRIGGER
*/
public function GetCreateMissingTriggerSQL( $myDBTriggerField, $myDBTriggerCheckSumField )
{
global $dbmapping, $fields, $querycount;
// Get List of Triggers as Array
$szDBName = $this->_logStreamConfigObj->DBName;
$szTableName = $this->_logStreamConfigObj->DBTableName;
// Create Triggername
$szTriggerName = $szDBName . "_" . $szTableName . "_" . $myDBTriggerField;
// Create TRIGGER SQL!
$szSql = "CREATE TRIGGER " . $szTriggerName . " BEFORE INSERT ON `" . $szTableName . "`
FOR EACH ROW
BEGIN
SET NEW." . $myDBTriggerCheckSumField . " = crc32(NEW." . $myDBTriggerField . ");
END
;";
return $szSql;
}
/*
* Implementation of CreateMissingTrigger: Creates missing triggers !
*/
public function CreateMissingTrigger( $myTriggerProperty, $myCheckSumProperty )
{
global $dbmapping, $fields, $querycount;
// Get List of Triggers as Array
$szTableName = $this->_logStreamConfigObj->DBTableName;
$szTableType = $this->_logStreamConfigObj->DBTableType;
$szDBTriggerField = $dbmapping[$szTableType]['DBMAPPINGS'][$myTriggerProperty];
$szDBTriggerCheckSumField = $dbmapping[$szTableType]['DBMAPPINGS'][$myCheckSumProperty];
// Get SQL Code to create the trigger!
$szSql = $this->GetCreateMissingTriggerSQL( $szDBTriggerField, $szDBTriggerCheckSumField );
// Index is missing for this field!
OutputDebugMessage("LogStreamDB|CreateMissingTrigger: Creating missing TRIGGER for '" . $szTableName . "' - $szDBTriggerCheckSumField = crc32(NEW.$szDBTriggerField)" . $szSql, DEBUG_INFO);
// Add missing INDEX now!
$myQuery = mysql_query($szSql, $this->_dbhandle);
if (!$myQuery)
{
// Return failure!
$this->PrintDebugError("Dynamically Adding TRIGGER for '" . $szTableName . "' failed!<br/><br/>If you want to manually add the TRIGGER, use the following SQL Command:<br/> " . str_replace("\n", "<br/>", $szSql) . "<br/>");
return ERROR_DB_TRIGGERFAILED;
}
// Successfull
return SUCCESS;
}
/*
* Implementation of ChangeChecksumFieldUnsigned: Changes the Checkusm field to unsigned!
*/
public function ChangeChecksumFieldUnsigned()
{
global $dbmapping, $fields, $querycount;
// Get variables
$szTableType = $this->_logStreamConfigObj->DBTableType;
// Change Checksumfield to use UNSIGNED!
$szUpdateSql = "ALTER TABLE `" . $this->_logStreamConfigObj->DBTableName . "` CHANGE `" .
$dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . "` `" .
$dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . "` INT(11) UNSIGNED NOT NULL DEFAULT '0'";
// Update Table schema now!
$myQuery = mysql_query($szUpdateSql, $this->_dbhandle);
if (!$myQuery)
{
// Return failure!
$this->PrintDebugError("ER_BAD_FIELD_ERROR - Failed to Change field '" . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . "' from signed to unsigned with sql statement: '" . $szUpdateSql . "'");
return ERROR_DB_CHECKSUMCHANGEFAILED;
}
// return results
return SUCCESS;
}
/*
* Implementation of VerifyChecksumField: Verifies if the checkusm field is signed or unsigned!
*/
public function VerifyChecksumField()
{
global $dbmapping, $fields, $querycount;
// Get variables
$szTableType = $this->_logStreamConfigObj->DBTableType;
// Create SQL and Get INDEXES for table!
$szSql = "SHOW COLUMNS FROM " . $this->_logStreamConfigObj->DBTableName . " WHERE Field = '" . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . "'";
$myQuery = mysql_query($szSql, $this->_dbhandle);
if ($myQuery)
{
// Get result!
$myRow = mysql_fetch_array($myQuery, MYSQL_ASSOC);
if (strpos( strtolower($myRow['Type']), "unsigned") === false )
{
// return error code!
return ERROR_DB_CHECKSUMERROR;
}
// Free query now
mysql_free_result ($myQuery);
// Increment for the Footer Stats
$querycount++;
}
// return results
return SUCCESS;
}
/** /**
* Read the data from a specific uID which means in this * Read the data from a specific uID which means in this
* case beginning with from the Database ID * case beginning with from the Database ID
@ -614,6 +930,46 @@ class LogStreamDB extends LogStream {
return $rowcount; return $rowcount;
} }
/*
* Implementation of the UpdateAllMessageChecksum
*
* Update all missing checksum properties in the current database
*/
public function UpdateAllMessageChecksum( )
{
global $querycount, $dbmapping;
$szTableType = $this->_logStreamConfigObj->DBTableType;
// UPDATE DATA NOW!
$szSql = "UPDATE " . $this->_logStreamConfigObj->DBTableName .
" SET " . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . " = crc32(" . $dbmapping[$szTableType]['DBMAPPINGS'][SYSLOG_MESSAGE] . ") " .
" WHERE " . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . " IS NULL OR " . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . " = 0";
// Output Debug Informations
OutputDebugMessage("LogStreamDB|UpdateAllMessageChecksum: Running Created SQL Query:<br>" . $szSql, DEBUG_ULTRADEBUG);
// Running SQL Query
$myQuery = mysql_query($szSql, $this->_dbhandle);
if ($myQuery)
{
// Debug Output
OutputDebugMessage("LogStreamDB|UpdateAllMessageChecksum: Successfully updated Checksum of '" . mysql_affected_rows($this->_dbhandle) . "' datarecords", DEBUG_INFO);
// Return success
return SUCCESS;
}
else
{
// error occured, output DEBUG message
$this->PrintDebugError("SaveMessageChecksum failed with SQL Statement ' " . $szSql . " '");
// Failed
return ERROR;
}
}
/* /*
* Implementation of the SaveMessageChecksum * Implementation of the SaveMessageChecksum
* *
@ -626,16 +982,13 @@ class LogStreamDB extends LogStream {
if ( isset($arrProperitesIn[SYSLOG_UID]) && isset($arrProperitesIn[MISC_CHECKSUM]) && isset($dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM]) ) if ( isset($arrProperitesIn[SYSLOG_UID]) && isset($arrProperitesIn[MISC_CHECKSUM]) && isset($dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM]) )
{ {
// DELETE DATA NOW! // UPDATE DATA NOW!
$szSql = "UPDATE " . $this->_logStreamConfigObj->DBTableName . $szSql = "UPDATE " . $this->_logStreamConfigObj->DBTableName .
" SET " . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . " = " . $arrProperitesIn[MISC_CHECKSUM] . " SET " . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . " = " . $arrProperitesIn[MISC_CHECKSUM] .
" WHERE " . $dbmapping[$szTableType]['DBMAPPINGS'][SYSLOG_UID] . " = " . $arrProperitesIn[SYSLOG_UID]; " WHERE " . $dbmapping[$szTableType]['DBMAPPINGS'][SYSLOG_UID] . " = " . $arrProperitesIn[SYSLOG_UID];
$myQuery = mysql_query($szSql, $this->_dbhandle); $myQuery = mysql_query($szSql, $this->_dbhandle);
if ($myQuery) if ($myQuery)
{ {
// Free res!
// NOT NEEDED HERE! mysql_free_result($myQuery);
// Return success // Return success
return SUCCESS; return SUCCESS;
} }
@ -688,7 +1041,7 @@ class LogStreamDB extends LogStream {
// Set Sorted Field // Set Sorted Field
if ( $szConsFieldId == $szSortFieldId ) if ( $szConsFieldId == $szSortFieldId )
$myDBSortedFieldName = "ItemCount"; $myDBSortedFieldName = "itemcount";
else else
$myDBSortedFieldName = $szSortFieldId; $myDBSortedFieldName = $szSortFieldId;
// --- // ---
@ -718,13 +1071,16 @@ class LogStreamDB extends LogStream {
// Create SQL String now! // Create SQL String now!
$szSql = "SELECT " . $szSql = "SELECT " .
$myDBQueryFields . $myDBQueryFields .
"count(" . $myDBConsFieldName . ") as ItemCount " . "count(" . $myDBConsFieldName . ") as itemcount " .
" FROM " . $this->_logStreamConfigObj->DBTableName . " FROM " . $this->_logStreamConfigObj->DBTableName .
$this->_SQLwhereClause . $this->_SQLwhereClause .
" GROUP BY " . $myDBGroupByFieldName . " GROUP BY " . $myDBGroupByFieldName .
" ORDER BY " . $myDBSortedFieldName . " " . $szSortingOrder . " ORDER BY " . $myDBSortedFieldName . " " . $szSortingOrder .
$szLimitSql ; $szLimitSql ;
// Output Debug Informations
OutputDebugMessage("LogStreamDB|ConsolidateItemListByField: Running Created SQL Query:<br>" . $szSql, DEBUG_ULTRADEBUG);
// Perform Database Query // Perform Database Query
$myquery = mysql_query($szSql, $this->_dbhandle); $myquery = mysql_query($szSql, $this->_dbhandle);
if ( !$myquery ) if ( !$myquery )
@ -766,7 +1122,7 @@ class LogStreamDB extends LogStream {
* *
* @return integer Error stat * @return integer Error stat
*/ */
public function ConsolidateDataByField($szConsFieldId, $nRecordLimit, $szSortFieldId, $nSortingOrder, $aIncludeCustomFields = null, $bIncludeLogStreamFields = false) public function ConsolidateDataByField($szConsFieldId, $nRecordLimit, $szSortFieldId, $nSortingOrder, $aIncludeCustomFields = null, $bIncludeLogStreamFields = false, $bIncludeMinMaxDateFields = false)
{ {
global $content, $dbmapping, $fields; global $content, $dbmapping, $fields;
@ -816,8 +1172,15 @@ class LogStreamDB extends LogStream {
else // Only Include ConsolidateField else // Only Include ConsolidateField
$myDBQueryFields = $myDBConsFieldName . ", "; $myDBQueryFields = $myDBConsFieldName . ", ";
// Add Min and Max fields for DATE if desired
if ( $bIncludeMinMaxDateFields )
{
$myDBQueryFields .= "Min(" . $dbmapping[$szTableType]['DBMAPPINGS'][SYSLOG_DATE] . ") as firstoccurrence_date, ";
$myDBQueryFields .= "Max(" . $dbmapping[$szTableType]['DBMAPPINGS'][SYSLOG_DATE] . ") as lastoccurrence_date, ";
}
if ( $szConsFieldId == $szSortFieldId ) if ( $szConsFieldId == $szSortFieldId )
$myDBSortedFieldName = "ItemCount"; $myDBSortedFieldName = "itemcount";
else else
$myDBSortedFieldName = $szSortFieldId; $myDBSortedFieldName = $szSortFieldId;
// --- // ---
@ -837,7 +1200,7 @@ class LogStreamDB extends LogStream {
$szLimitSql = ""; $szLimitSql = "";
// Create SQL Where Clause! // Create SQL Where Clause!
if ( $this->_SQLwhereClause == "" ) if ( strlen($this->_SQLwhereClause) <= 0 )
{ {
$res = $this->CreateSQLWhereClause(); $res = $this->CreateSQLWhereClause();
if ( $res != SUCCESS ) if ( $res != SUCCESS )
@ -847,13 +1210,16 @@ class LogStreamDB extends LogStream {
// Create SQL String now! // Create SQL String now!
$szSql = "SELECT " . $szSql = "SELECT " .
$myDBQueryFields . $myDBQueryFields .
"count(" . $myDBConsFieldName . ") as ItemCount " . "count(" . $myDBConsFieldName . ") as itemcount " .
" FROM " . $this->_logStreamConfigObj->DBTableName . " FROM " . $this->_logStreamConfigObj->DBTableName .
$this->_SQLwhereClause . $this->_SQLwhereClause .
" GROUP BY " . $myDBGroupByFieldName . " GROUP BY " . $myDBGroupByFieldName .
" ORDER BY " . $myDBSortedFieldName . " " . $szSortingOrder . " ORDER BY " . $myDBSortedFieldName . " " . $szSortingOrder .
$szLimitSql ; $szLimitSql ;
// Output Debug Informations
OutputDebugMessage("LogStreamDB|ConsolidateDataByField: Running Created SQL Query:<br>" . $szSql, DEBUG_ULTRADEBUG);
// Perform Database Query // Perform Database Query
$myquery = mysql_query($szSql, $this->_dbhandle); $myquery = mysql_query($szSql, $this->_dbhandle);
if ( !$myquery ) if ( !$myquery )
@ -870,12 +1236,17 @@ class LogStreamDB extends LogStream {
foreach ( $myRow as $myFieldName => $myFieldValue ) foreach ( $myRow as $myFieldName => $myFieldValue )
{ {
if ( $myFieldName == $dbmapping[$szTableType]['DBMAPPINGS'][$szConsFieldId] ) $myFieldID = $this->GetFieldIDbyDatabaseMapping($szTableType, $myFieldName);
$aNewRow[ $myFieldID ] = $myFieldValue;
/* if ( $myFieldName == $dbmapping[$szTableType]['DBMAPPINGS'][$szConsFieldId] )
$aNewRow[$szConsFieldId] = $myFieldValue; $aNewRow[$szConsFieldId] = $myFieldValue;
else else
{
$aNewRow[$myFieldName] = $myFieldValue; $aNewRow[$myFieldName] = $myFieldValue;
*/
// }
} }
// Add new row to result // Add new row to result
$aResult[] = $aNewRow; $aResult[] = $aNewRow;
} }
@ -887,7 +1258,6 @@ class LogStreamDB extends LogStream {
return ERROR_NOMORERECORDS; return ERROR_NOMORERECORDS;
} }
/** /**
* Implementation of GetCountSortedByField * Implementation of GetCountSortedByField
* *
@ -961,6 +1331,7 @@ class LogStreamDB extends LogStream {
} }
/* /*
* ============= Beginn of private functions ============= * ============= Beginn of private functions =============
*/ */
@ -1499,58 +1870,190 @@ class LogStreamDB extends LogStream {
/* /*
* Function handles missing database fields automatically! * Function handles missing database fields automatically!
*/ */
private function HandleMissingField() private function HandleMissingField( $szMissingField = null, $arrProperties = null )
{ {
global $dbmapping, $fields; global $dbmapping, $fields;
// Get Err description // Get Err description
$errdesc = mysql_error(); $errdesc = mysql_error();
// check matching of error msg! // Try to get missing field from SQL Error of not specified as argument
if ( preg_match("/Unknown column '(.*?)' in '(.*?)'$/", $errdesc, $errOutArr ) ) if ( $szMissingField == null )
{ {
$szTableType = $this->_logStreamConfigObj->DBTableType; if ( preg_match("/Unknown column '(.*?)' in '(.*?)'$/", $errdesc, $errOutArr ) )
$szMissingField = $errOutArr[1];
// Loop through all fields to see which one is missing! else
foreach ( $this->_arrProperties as $myproperty )
{ {
if ( isset($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty]) && $errOutArr[1] == $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] ) $this->PrintDebugError("ER_BAD_FIELD_ERROR - SQL Statement: ". $errdesc);
{ return ERROR_DB_DBFIELDNOTFOUND;
// Create SQL Numeric field }
$szUpdateSql = ""; }
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_NUMBER )
$szUpdateSql = "ALTER TABLE `" . $this->_logStreamConfigObj->DBTableName . "` ADD `" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "` int(11) NOT NULL DEFAULT '0'";
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_STRING )
$szUpdateSql = "ALTER TABLE `" . $this->_logStreamConfigObj->DBTableName . "` ADD `" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "` varchar(60) NOT NULL DEFAULT ''";
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_DATE )
$szUpdateSql = "ALTER TABLE `" . $this->_logStreamConfigObj->DBTableName . "` ADD `" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "` datetime NOT NULL DEFAULT '0000-00-00 00:00:00'";
if ( strlen($szUpdateSql) > 0 ) // Set Properties to default if NULL
{ if ( $arrProperties == null )
// Update Table schema now! $arrProperties = $this->_arrProperties;
$myQuery = mysql_query($szUpdateSql, $this->_dbhandle);
if (!$myQuery) // Get Tabletype
{ $szTableType = $this->_logStreamConfigObj->DBTableType;
// Return failure!
$this->PrintDebugError("ER_BAD_FIELD_ERROR - Dynamically Adding field '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "' with Statement failed: '" . $szUpdateSql . "'"); // Loop through all fields to see which one is missing!
return ERROR_DB_DBFIELDNOTFOUND; foreach ( $arrProperties as $myproperty )
} {
} if ( isset($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty]) && $szMissingField == $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] )
else {
// Create SQL Numeric field
$szUpdateSql = ""; $szUnsigned = "";
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_NUMBER )
{
// This will add the checksum field as unsigned automatically!
if ( $myproperty == MISC_CHECKSUM )
$szUnsigned = "UNSIGNED";
$szUpdateSql = "ALTER TABLE `" . $this->_logStreamConfigObj->DBTableName . "` ADD `" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "` int(11) " . $szUnsigned . " NOT NULL DEFAULT '0'";
}
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_STRING )
$szUpdateSql = "ALTER TABLE `" . $this->_logStreamConfigObj->DBTableName . "` ADD `" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "` varchar(60) NOT NULL DEFAULT ''";
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_DATE )
$szUpdateSql = "ALTER TABLE `" . $this->_logStreamConfigObj->DBTableName . "` ADD `" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "` datetime NOT NULL DEFAULT '0000-00-00 00:00:00'";
if ( strlen($szUpdateSql) > 0 )
{
// Update Table schema now!
$myQuery = mysql_query($szUpdateSql, $this->_dbhandle);
if (!$myQuery)
{ {
// Return failure! // Return failure!
$this->PrintDebugError("ER_BAD_FIELD_ERROR - Field '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "' is missing has to be added manually to the database layout!'"); $this->PrintDebugError("ER_BAD_FIELD_ERROR - Dynamically Adding field '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "' with Statement failed: '" . $szUpdateSql . "'");
return ERROR_DB_DBFIELDNOTFOUND; return ERROR_DB_ADDDBFIELDFAILED;
} }
} }
else
{
// Return failure!
$this->PrintDebugError("ER_BAD_FIELD_ERROR - Field '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "' is missing has to be added manually to the database layout!'");
return ERROR_DB_ADDDBFIELDFAILED;
}
}
}
// Reached this point means success!
return SUCCESS;
}
/*
* Helper function to return a list of Indexes for the logstream table
*/
private function GetIndexesAsArray()
{
global $querycount;
// Verify database connection (This also opens the database!)
$res = $this->Verify();
if ( $res != SUCCESS )
return $res;
// Init Array
$arrIndexKeys = array();
// Create SQL and Get INDEXES for table!
$szSql = "SHOW INDEX FROM " . $this->_logStreamConfigObj->DBTableName;
$myQuery = mysql_query($szSql, $this->_dbhandle);
if ($myQuery)
{
// Loop through results
while ($myRow = mysql_fetch_array($myQuery, MYSQL_ASSOC))
{
// Add to index keys
$arrIndexKeys[] = strtolower($myRow['Key_name']);
} }
// Reached this point means success! // Free query now
return SUCCESS; mysql_free_result ($myQuery);
// Increment for the Footer Stats
$querycount++;
} }
else
$this->PrintDebugError("ER_BAD_FIELD_ERROR - SQL Statement: ". $errdesc); // return Array
return ERROR_DB_DBFIELDNOTFOUND; return $arrIndexKeys;
}
/*
* Helper function to return a list of Fields from the logstream table
*/
private function GetFieldsAsArray()
{
global $querycount;
// Verify database connection (This also opens the database!)
$res = $this->Verify();
if ( $res != SUCCESS )
return $res;
// Init Array
$arrFieldKeys = array();
// Create SQL and Get INDEXES for table!
$szSql = "SHOW FIELDS FROM " . $this->_logStreamConfigObj->DBTableName;
$myQuery = mysql_query($szSql, $this->_dbhandle);
if ($myQuery)
{
// Loop through results
while ($myRow = mysql_fetch_array($myQuery, MYSQL_ASSOC))
{
// Add to index keys
$arrFieldKeys[] = strtolower($myRow['Field']);
}
// Free query now
mysql_free_result ($myQuery);
// Increment for the Footer Stats
$querycount++;
}
// return Array
return $arrFieldKeys;
}
/*
* Helper function to return a list of Indexes for the logstream table
*/
private function GetTriggersAsArray()
{
global $querycount;
// Verify database connection (This also opens the database!)
$res = $this->Verify();
if ( $res != SUCCESS )
return $res;
// Init Array
$arrIndexTriggers = array();
// Create SQL and Get INDEXES for table!
$szSql = "SHOW TRIGGERS";
$myQuery = mysql_query($szSql, $this->_dbhandle);
if ($myQuery)
{
// Loop through results
while ($myRow = mysql_fetch_array($myQuery, MYSQL_ASSOC))
{
// print_r ( $myRow );
// Add to index keys
$arrIndexTriggers[] = strtolower($myRow['Trigger']);
}
// Free query now
mysql_free_result ($myQuery);
// Increment for the Footer Stats
$querycount++;
}
// return Array
return $arrIndexTriggers;
} }
// --- End of Class! // --- End of Class!

View File

@ -92,6 +92,7 @@ class LogStreamDisk extends LogStream {
return SUCCESS; return SUCCESS;
} }
/** /**
* Close the file. * Close the file.
* *
@ -612,7 +613,6 @@ class LogStreamDisk extends LogStream {
public function GetLogStreamStats() public function GetLogStreamStats()
{ {
// Get some file data! // Get some file data!
/* /*
// return results! // return results!
return $stats; return $stats;
@ -658,6 +658,108 @@ class LogStreamDisk extends LogStream {
} }
/*
* Implementation of the UpdateAllMessageChecksum
*
* not implemented!
*/
public function UpdateAllMessageChecksum( )
{
return SUCCESS;
}
/*
* Helper function to clear the current querystring!
*/
public function ResetFilters()
{
// nothing todo in this logstream
return SUCCESS;
}
/*
* Helper function to verify fields | not needed in disk logstream!
*/
public function VerifyFields( $arrProperitesIn )
{
return SUCCESS;
}
/*
* Helper function to create missing fields | not needed in disk logstream!
*/
public function CreateMissingFields( $arrProperitesIn )
{
return SUCCESS;
}
/*
* Helper function to verify indexes | not needed in disk logstream!
*/
public function VerifyIndexes( $arrProperitesIn )
{
return SUCCESS;
}
/*
* Helper function to create missing indexes | not needed in disk logstream!
*/
public function CreateMissingIndexes( $arrProperitesIn )
{
return SUCCESS;
}
/*
* Helper function to verify triggers | not needed in disk logstream!
*/
public function VerifyChecksumTrigger( $myTriggerProperty )
{
return SUCCESS;
}
/*
* Helper function to verify triggers | not needed in disk logstream!
*/
public function CreateMissingTrigger( $myTriggerProperty, $myCheckSumProperty )
{
return SUCCESS;
}
/*
* Helper function to create missing triggers | not needed in disk logstream!
*/
public function GetCreateMissingTriggerSQL( $myDBTriggerField, $myDBTriggerCheckSumField )
{
return SUCCESS;
}
/*
* Helper function to verify checksum field | not needed in disk logstream!
*/
public function VerifyChecksumField( )
{
return SUCCESS;
}
/*
* Helper function to correct the checksum field | not needed in disk logstream!
*/
public function ChangeChecksumFieldUnsigned( )
{
return SUCCESS;
}
/** /**
* Implementation of ConsolidateItemListByField * Implementation of ConsolidateItemListByField
* *
@ -752,7 +854,7 @@ class LogStreamDisk extends LogStream {
* *
* @return integer Error stat * @return integer Error stat
*/ */
public function ConsolidateDataByField($szConsFieldId, $nRecordLimit, $szSortFieldId, $nSortingOrder, $aIncludeCustomFields = null, $bIncludeLogStreamFields = false) public function ConsolidateDataByField($szConsFieldId, $nRecordLimit, $szSortFieldId, $nSortingOrder, $aIncludeCustomFields = null, $bIncludeLogStreamFields = false, $bIncludeMinMaxDateFields = false)
{ {
global $content, $fields; global $content, $fields;
@ -777,6 +879,11 @@ class LogStreamDisk extends LogStream {
{ {
if ( isset($logArray[$szConsFieldId]) ) if ( isset($logArray[$szConsFieldId]) )
{ {
// --- Special Case for the checksum field, we need to generate the checksum ourself!
if ( $szConsFieldId == MISC_CHECKSUM )
$logArray[$szConsFieldId] = crc32( $logArray[SYSLOG_MESSAGE] );
// ---
if ( $nConsFieldType == FILTER_TYPE_DATE ) if ( $nConsFieldType == FILTER_TYPE_DATE )
{ {
// Convert to FULL Day Date for now! // Convert to FULL Day Date for now!
@ -790,7 +897,10 @@ class LogStreamDisk extends LogStream {
$myFieldData = $content['LN_STATS_OTHERS']; $myFieldData = $content['LN_STATS_OTHERS'];
if ( isset($aResult[ $myFieldData ]) ) if ( isset($aResult[ $myFieldData ]) )
{
$aResult[ $myFieldData ]['ItemCount']++; $aResult[ $myFieldData ]['ItemCount']++;
$aResult[ $myFieldData ]['LastOccurrence_Date'] = $logArray[SYSLOG_DATE];
}
else else
{ {
// Initialize entry if we haven't exceeded the RecordLImit yet! // Initialize entry if we haven't exceeded the RecordLImit yet!
@ -811,6 +921,9 @@ class LogStreamDisk extends LogStream {
$aResult[ $myFieldData ][$szSortFieldId] = $logArray[$szSortFieldId]; $aResult[ $myFieldData ][$szSortFieldId] = $logArray[$szSortFieldId];
$aResult[ $myFieldData ]['ItemCount'] = 1; $aResult[ $myFieldData ]['ItemCount'] = 1;
$aResult[ $myFieldData ]['FirstOccurrence_Date'] = $logArray[SYSLOG_DATE];
$aResult[ $myFieldData ]['LastOccurrence_Date'] = $logArray[SYSLOG_DATE];
} }
else else
{ {

View File

@ -118,6 +118,15 @@ class LogStreamPDO extends LogStream {
return SUCCESS; return SUCCESS;
} }
/*
* Helper function to clear the current querystring!
*/
public function ResetFilters()
{
// Clear _SQLwhereClause variable!
$this->_SQLwhereClause = "";
}
/** /**
* Close the database connection. * Close the database connection.
* *
@ -128,8 +137,7 @@ class LogStreamPDO extends LogStream {
// trigger closing database query! // trigger closing database query!
$this->DestroyMainSQLQuery(); $this->DestroyMainSQLQuery();
// TODO CLOSE DB CONN?! // TODO CLOSE DB CONN?!
return true; return true;
} }
@ -219,6 +227,397 @@ class LogStreamPDO extends LogStream {
return SUCCESS; return SUCCESS;
} }
/*
* Implementation of VerifyFields: Checks if fields exist in table
*/
public function VerifyFields( $arrProperitesIn )
{
global $dbmapping, $fields;
// Get List of Indexes as Array
$arrFieldKeys = $this->GetFieldsAsArray();
$szTableType = $this->_logStreamConfigObj->DBTableType;
// FIELD Listing failed! Nothing we can do in this case!
if ( $arrFieldKeys == null )
return SUCCESS;
// Loop through all fields to see which one is missing!
foreach ( $arrProperitesIn as $myproperty )
{
// echo $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "<br>";
if ( isset($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty]) && in_array($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty], $arrFieldKeys) )
{
OutputDebugMessage("LogStreamPDO|VerifyFields: Found Field for '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "'", DEBUG_ULTRADEBUG);
continue;
}
else
{
// Index is missing for this field!
OutputDebugMessage("LogStreamPDO|VerifyFields: Missing Field for '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "'", DEBUG_WARN);
return ERROR_DB_DBFIELDNOTFOUND;
}
}
// Successfull
return SUCCESS;
}
/*
* Implementation of VerifyIndexes: Checks if indexes exist for desired fields
*/
public function VerifyIndexes( $arrProperitesIn )
{
global $dbmapping, $fields;
// Get List of Indexes as Array
$arrIndexKeys = $this->GetIndexesAsArray();
$szTableType = $this->_logStreamConfigObj->DBTableType;
// INDEX Listing failed! Nothing we can do in this case!
if ( !isset($arrIndexKeys) )// == null )
return SUCCESS;
// Loop through all fields to see which one is missing!
foreach ( $arrProperitesIn as $myproperty )
{
if ( count($arrIndexKeys) <= 0 )
{
// NO INDEXES at all!
OutputDebugMessage("LogStreamPDO|VerifyIndexes: NO INDEXES found !", DEBUG_WARN);
return ERROR_DB_INDEXESMISSING;
}
if ( isset($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty]) && in_array($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty], $arrIndexKeys) )
{
OutputDebugMessage("LogStreamPDO|VerifyIndexes: Found INDEX for '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "'", DEBUG_ULTRADEBUG);
continue;
}
else
{
// Index is missing for this field!
OutputDebugMessage("LogStreamPDO|VerifyIndexes: Missing INDEX for '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "'", DEBUG_WARN);
return ERROR_DB_INDEXESMISSING;
}
}
// Successfull
return SUCCESS;
}
/*
* Implementation of VerifyChecksumTrigger: Checks if checksum trigger exists
*/
public function VerifyChecksumTrigger( $myTriggerProperty )
{
global $dbmapping, $fields;
// Avoid Check if TRIGGERS are not supported!
if ( $this->_logStreamConfigObj->GetPDOTriggersSupported() == false )
return SUCCESS;
// Get List of Triggers as Array
$arrIndexTriggers = $this->GetTriggersAsArray();
// TRIGGER Listing failed! Nothing we can do in this case!
if ( !isset($arrIndexTriggers) )// == null )
// if ( $arrIndexTriggers == null )
return SUCCESS;
$szTableType = $this->_logStreamConfigObj->DBTableType;
$szDBName = $this->_logStreamConfigObj->DBName;
$szTableName = $this->_logStreamConfigObj->DBTableName;
$szDBTriggerField = $dbmapping[$szTableType]['DBMAPPINGS'][$myTriggerProperty];
// Create Triggername
$szTriggerName = strtolower($szDBName . "_" . $szTableName . "_" . $szDBTriggerField);
// Try to find logstream trigger
if ( count($arrIndexTriggers) > 0 )
{
if ( in_array($szTriggerName, $arrIndexTriggers) )
{
OutputDebugMessage("LogStreamPDO|VerifyChecksumTrigger: Found TRIGGER '" . $szTriggerName. "' for table '" . $szTableName . "'", DEBUG_ULTRADEBUG);
return SUCCESS;
}
else
{
// Index is missing for this field!
OutputDebugMessage("LogStreamPDO|VerifyChecksumTrigger: Missing TRIGGER '" . $szTriggerName . "' for Table '" . $szTableName . "'", DEBUG_WARN);
return ERROR_DB_TRIGGERMISSING;
}
}
else
{
// Index is missing for this field!
OutputDebugMessage("LogStreamPDO|VerifyChecksumTrigger: No TRIGGERS found in your database", DEBUG_WARN);
return ERROR_DB_TRIGGERMISSING;
}
}
/*
* Implementation of CreateMissingIndexes: Checks if indexes exist for desired fields
*/
public function CreateMissingIndexes( $arrProperitesIn )
{
global $dbmapping, $fields, $querycount;
// Get List of Indexes as Array
$arrIndexKeys = $this->GetIndexesAsArray();
$szTableType = $this->_logStreamConfigObj->DBTableType;
// Loop through all fields to see which one is missing!
foreach ( $arrProperitesIn as $myproperty )
{
if ( isset($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty]) && in_array($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty], $arrIndexKeys) )
continue;
else
{
// Update Table schema now!
if ( $this->_logStreamConfigObj->DBType == DB_MYSQL )
$szSql = "ALTER TABLE " . $this->_logStreamConfigObj->DBTableName . " ADD INDEX ( " . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . " )";
else if ( $this->_logStreamConfigObj->DBType == DB_PGSQL )
$szSql = "CREATE INDEX " . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "_idx ON " . $this->_logStreamConfigObj->DBTableName . " (" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . ");";
else if ( $this->_logStreamConfigObj->DBType == DB_MSSQL )
$szSql = "CREATE INDEX " . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "_idx ON " . $this->_logStreamConfigObj->DBTableName . " (" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . ");";
else
// Not supported in this case!
return ERROR_DB_INDEXFAILED;
// Index is missing for this field!
OutputDebugMessage("LogStreamPDO|CreateMissingIndexes: Createing missing INDEX for '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "' - " . $szSql, DEBUG_INFO);
// Add missing INDEX now!
$myQuery = $this->_dbhandle->query($szSql);
if (!$myQuery)
{
// Return failure!
$this->PrintDebugError("Dynamically Adding INDEX for '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "' failed with Statement: '" . $szSql . "'");
return ERROR_DB_INDEXFAILED;
}
else // Free query now
$myQuery->closeCursor();
}
}
// Successfull
return SUCCESS;
}
/*
* Implementation of CreateMissingFields: Checks if indexes exist for desired fields
*/
public function CreateMissingFields( $arrProperitesIn )
{
global $dbmapping, $fields, $querycount;
// Get List of Indexes as Array
$arrFieldKeys = $this->GetFieldsAsArray();
$szTableType = $this->_logStreamConfigObj->DBTableType;
// Loop through all fields to see which one is missing!
foreach ( $arrProperitesIn as $myproperty )
{
if ( isset($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty]) && in_array($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty], $arrFieldKeys) )
continue;
else
{
if ( $this->HandleMissingField( $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty], $arrProperitesIn ) == SUCCESS )
{
// Index is missing for this field!
OutputDebugMessage("LogStreamPDO|CreateMissingFields: Createing missing FIELD for '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty], DEBUG_INFO);
}
else
{
// Return failure!
$this->PrintDebugError("Dynamically Adding FIELD for '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "' failed!");
return ERROR_DB_ADDDBFIELDFAILED;
}
}
}
// Successfull
return SUCCESS;
}
/*
* Implementation of GetCreateMissingTriggerSQL: Creates SQL needed to create a TRIGGER
*/
public function GetCreateMissingTriggerSQL( $myDBTriggerField, $myDBTriggerCheckSumField )
{
global $dbmapping, $fields, $querycount;
// Get List of Triggers as Array
$szDBName = $this->_logStreamConfigObj->DBName;
$szTableName = $this->_logStreamConfigObj->DBTableName;
// Create Triggername
$szTriggerName = strtolower($szDBName . "_" . $szTableName . "_" . $myDBTriggerField);
// Create TRIGGER SQL!
if ( $this->_logStreamConfigObj->DBType == DB_MYSQL )
$szSql ="CREATE TRIGGER " . $szTriggerName . " BEFORE INSERT ON `" . $szTableName . "`
FOR EACH ROW
BEGIN
SET NEW." . $myDBTriggerCheckSumField . " = crc32(NEW." . $myDBTriggerField . ");
END
;";
else if ( $this->_logStreamConfigObj->DBType == DB_PGSQL )
// Experimental Trigger Support for POSTGRESQL
$szSql ="
CREATE LANGUAGE plpgsql ;
CREATE FUNCTION " . $szTriggerName . "() RETURNS trigger AS $" . $szTriggerName . "$
BEGIN
NEW." . $myDBTriggerCheckSumField . " := hashtext(NEW." . $myDBTriggerField . ");
RETURN NEW;
END;
$" . $szTriggerName . "$ LANGUAGE plpgsql;
CREATE TRIGGER " . $szTriggerName . " BEFORE INSERT OR UPDATE ON \"" . $szTableName . "\"
FOR EACH ROW EXECUTE PROCEDURE " . $szTriggerName . "();
";
else if ( $this->_logStreamConfigObj->DBType == DB_MSSQL )
{
// Trigger code for MSSQL!
$szSql ="CREATE TRIGGER " . $szTriggerName . " ON " . $szTableName . " AFTER INSERT AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for trigger here
UPDATE " . $szTableName . "
SET " . $myDBTriggerCheckSumField . " = checksum(I." . $myDBTriggerField . ")
FROM systemevents JOIN inserted I on " . $szTableName . "." . $dbmapping[$szTableType]['DBMAPPINGS']['SYSLOG_UID'] . " = I." . $dbmapping[$szTableType]['DBMAPPINGS']['SYSLOG_UID'] . "
END
";
}
else
// NOT SUPPORTED
return null;
return $szSql;
}
/*
* Implementation of CreateMissingTrigger: Creates missing triggers !
*/
public function CreateMissingTrigger( $myTriggerProperty, $myCheckSumProperty )
{
global $dbmapping, $fields, $querycount;
// Avoid if TRIGGERS are not supported!
if ( $this->_logStreamConfigObj->GetPDOTriggersSupported() == false )
return SUCCESS;
// Get List of Triggers as Array
$szTableName = $this->_logStreamConfigObj->DBTableName;
$szTableType = $this->_logStreamConfigObj->DBTableType;
$szDBTriggerField = $dbmapping[$szTableType]['DBMAPPINGS'][$myTriggerProperty];
$szDBTriggerCheckSumField = $dbmapping[$szTableType]['DBMAPPINGS'][$myCheckSumProperty];
// Get SQL Code to create the trigger!
$szSql = $this->GetCreateMissingTriggerSQL( $szDBTriggerField, $szDBTriggerCheckSumField );
// Index is missing for this field!
OutputDebugMessage("LogStreamPDO|CreateMissingTrigger: Creating missing TRIGGER for '" . $szTableName . "' - $szDBTriggerCheckSumField = crc32(NEW.$szDBTriggerField)" . $szSql, DEBUG_INFO);
// Add missing INDEX now!
$myQuery = $this->_dbhandle->query($szSql);
if (!$myQuery)
{
// Return failure!
$this->PrintDebugError("Dynamically Adding TRIGGER for '" . $szTableName . "' failed!<br/><br/>If you want to manually add the TRIGGER, use the following SQL Command:<br/> " . str_replace("\n", "<br/>", $szSql) . "<br/>");
return ERROR_DB_TRIGGERFAILED;
}
else // Free query now
$myQuery->closeCursor();
// Successfull
return SUCCESS;
}
/*
* Implementation of ChangeChecksumFieldUnsigned: Changes the Checkusm field to unsigned!
*/
public function ChangeChecksumFieldUnsigned()
{
global $dbmapping, $fields, $querycount;
// Get variables
$szTableType = $this->_logStreamConfigObj->DBTableType;
// TODO if ( $this->_logStreamConfigObj->DBType == DB_MYSQL )
// Change Checksumfield to use UNSIGNED!
$szUpdateSql = "ALTER TABLE `" . $this->_logStreamConfigObj->DBTableName . "` CHANGE `" .
$dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . "` `" .
$dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . "` INT(11) UNSIGNED NOT NULL DEFAULT '0'";
// Update Table schema now!
$myQuery = $this->_dbhandle->query($szUpdateSql);
if (!$myQuery)
{
// Return failure!
$this->PrintDebugError("ER_BAD_FIELD_ERROR - Failed to Change field '" . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . "' from signed to unsigned with sql statement: '" . $szUpdateSql . "'");
return ERROR_DB_CHECKSUMCHANGEFAILED;
}
else // Free query now
$myQuery->closeCursor();
// return results
return SUCCESS;
}
/*
* Implementation of VerifyChecksumField: Verifies if the checkusm field is signed or unsigned!
*/
public function VerifyChecksumField()
{
global $dbmapping, $fields, $querycount;
// Get variables
$szTableType = $this->_logStreamConfigObj->DBTableType;
// Create SQL and Get INDEXES for table!
if ( $this->_logStreamConfigObj->DBType == DB_MYSQL )
$szSql = "SHOW COLUMNS FROM " . $this->_logStreamConfigObj->DBTableName . " WHERE Field = '" . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . "'";
else
// NOT SUPPORTED or NEEDED
return SUCCESS;
// Run Query to check the Checksum field!
$myQuery = $this->_dbhandle->query($szSql);
if ($myQuery)
{
// Get result!
$myRow = $myQuery->fetch(PDO::FETCH_ASSOC);
if (strpos( strtolower($myRow['Type']), "unsigned") === false )
{
// return error code!
return ERROR_DB_CHECKSUMERROR;
}
// Free query now
$myQuery->closeCursor();
// Increment for the Footer Stats
$querycount++;
}
// return results
return SUCCESS;
}
/** /**
* Read the data from a specific uID which means in this * Read the data from a specific uID which means in this
* case beginning with from the Database ID * case beginning with from the Database ID
@ -703,6 +1102,69 @@ class LogStreamPDO extends LogStream {
} }
/*
* Implementation of the UpdateAllMessageChecksum
*
* Update all missing checksum properties in the current database
*/
public function UpdateAllMessageChecksum( )
{
global $querycount, $dbmapping;
$szTableType = $this->_logStreamConfigObj->DBTableType;
// UPDATE DATA NOW!
if ( $this->_logStreamConfigObj->DBType == DB_MYSQL )
{
$szSql = "UPDATE " . $this->_logStreamConfigObj->DBTableName .
" SET " . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . " = crc32(" . $dbmapping[$szTableType]['DBMAPPINGS'][SYSLOG_MESSAGE] . ") " .
" WHERE " . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . " IS NULL OR " . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . " = 0";
}
elseif ($this->_logStreamConfigObj->DBType == DB_PGSQL )
{
$szSql = "UPDATE " . $this->_logStreamConfigObj->DBTableName .
" SET " . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . " = hashtext(" . $dbmapping[$szTableType]['DBMAPPINGS'][SYSLOG_MESSAGE] . ") " .
" WHERE " . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . " IS NULL OR " . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . " = 0";
}
elseif ($this->_logStreamConfigObj->DBType == DB_MSSQL )
{
$szSql = "UPDATE " . $this->_logStreamConfigObj->DBTableName .
" SET " . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . " = checksum(" . $dbmapping[$szTableType]['DBMAPPINGS'][SYSLOG_MESSAGE] . ") " .
" WHERE " . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . " IS NULL OR " . $dbmapping[$szTableType]['DBMAPPINGS'][MISC_CHECKSUM] . " = 0";
}
else
{
// Failed | Checksum function not supported!
$this->PrintDebugError("UpdateAllMessageChecksum failed, PDO LogStream does not support CRC32 Checksums in SQL Statements!");
return ERROR;
}
// Output Debug Informations
OutputDebugMessage("LogStreamPDO|UpdateAllMessageChecksum: Running Created SQL Query:<br>" . $szSql, DEBUG_ULTRADEBUG);
// Running SQL Query
$myQuery = $this->_dbhandle->query($szSql);
if ( $myQuery )
{
// Output Debug Informations
OutputDebugMessage("LogStreamPDO|UpdateAllMessageChecksum: Successfully updated Checksum of '" . $myQuery->rowCount() . "' datarecords", DEBUG_INFO);
// Free query now
$myQuery->closeCursor();
// Return success
return SUCCESS;
}
else
{
// error occured, output DEBUG message
$this->PrintDebugError("UpdateAllMessageChecksum failed with SQL Statement ' " . $szSql . " '");
// Failed
return ERROR;
}
}
/* /*
* Implementation of the SaveMessageChecksum * Implementation of the SaveMessageChecksum
* *
@ -777,7 +1239,7 @@ class LogStreamPDO extends LogStream {
// Set Sorted Field // Set Sorted Field
if ( $szConsFieldId == $szSortFieldId ) if ( $szConsFieldId == $szSortFieldId )
$myDBSortedFieldName = "ItemCount"; $myDBSortedFieldName = "itemcount";
else else
$myDBSortedFieldName = $szSortFieldId; $myDBSortedFieldName = $szSortFieldId;
// --- // ---
@ -823,7 +1285,7 @@ class LogStreamPDO extends LogStream {
// Create SQL String now! // Create SQL String now!
$szSql = "SELECT " . $szSql = "SELECT " .
$myDBQueryFields . $myDBQueryFields .
"count(" . $myDBConsFieldName . ") as ItemCount " . "count(" . $myDBConsFieldName . ") as itemcount " .
" FROM " . $this->_logStreamConfigObj->DBTableName . " FROM " . $this->_logStreamConfigObj->DBTableName .
$this->_SQLwhereClause . $this->_SQLwhereClause .
" GROUP BY " . $myDBGroupByFieldName . " GROUP BY " . $myDBGroupByFieldName .
@ -886,7 +1348,7 @@ class LogStreamPDO extends LogStream {
* *
* @return integer Error stat * @return integer Error stat
*/ */
public function ConsolidateDataByField($szConsFieldId, $nRecordLimit, $szSortFieldId, $nSortingOrder, $aIncludeCustomFields = null, $bIncludeLogStreamFields = false) public function ConsolidateDataByField($szConsFieldId, $nRecordLimit, $szSortFieldId, $nSortingOrder, $aIncludeCustomFields = null, $bIncludeLogStreamFields = false, $bIncludeMinMaxDateFields = false)
{ {
global $content, $dbmapping, $fields;; global $content, $dbmapping, $fields;;
@ -917,12 +1379,26 @@ class LogStreamPDO extends LogStream {
foreach ( $aIncludeCustomFields as $myFieldName ) foreach ( $aIncludeCustomFields as $myFieldName )
{ {
if ( isset($dbmapping[$szTableType]['DBMAPPINGS'][$myFieldName]) ) if ( isset($dbmapping[$szTableType]['DBMAPPINGS'][$myFieldName]) )
$myDBQueryFields .= $dbmapping[$szTableType]['DBMAPPINGS'][$myFieldName] . ", "; {
if ( $this->_logStreamConfigObj->DBType == DB_PGSQL ||
$this->_logStreamConfigObj->DBType == DB_MSSQL )
$myDBQueryFields .= "Max(" . $dbmapping[$szTableType]['DBMAPPINGS'][$myFieldName] . ") AS " . $dbmapping[$szTableType]['DBMAPPINGS'][$myFieldName] . ", ";
else
// Default for other PDO Engines
$myDBQueryFields .= $dbmapping[$szTableType]['DBMAPPINGS'][$myFieldName] . ", ";
}
} }
// Append Sortingfield // Append Sortingfield
if ( !in_array($szConsFieldId, $aIncludeCustomFields) ) if ( !in_array($szConsFieldId, $aIncludeCustomFields) )
$myDBQueryFields .= $myDBConsFieldName . ", "; {
if ( $this->_logStreamConfigObj->DBType == DB_PGSQL ||
$this->_logStreamConfigObj->DBType == DB_MSSQL )
$myDBQueryFields .= "Max(" . $myDBConsFieldName . ") AS " . $dbmapping[$szTableType]['DBMAPPINGS'][$myFieldName] . ", ";
else
// Default for other PDO Engines
$myDBQueryFields .= $myDBConsFieldName . ", ";
}
} }
else if ( $bIncludeLogStreamFields ) else if ( $bIncludeLogStreamFields )
{ {
@ -930,14 +1406,35 @@ class LogStreamPDO extends LogStream {
foreach ( $this->_arrProperties as $myFieldName ) foreach ( $this->_arrProperties as $myFieldName )
{ {
if ( isset($dbmapping[$szTableType]['DBMAPPINGS'][$myFieldName]) ) if ( isset($dbmapping[$szTableType]['DBMAPPINGS'][$myFieldName]) )
$myDBQueryFields .= $dbmapping[$szTableType]['DBMAPPINGS'][$myFieldName] . ", "; {
if ( $this->_logStreamConfigObj->DBType == DB_PGSQL ||
$this->_logStreamConfigObj->DBType == DB_MSSQL )
$myDBQueryFields .= "Max(" . $dbmapping[$szTableType]['DBMAPPINGS'][$myFieldName] . ") AS " . $dbmapping[$szTableType]['DBMAPPINGS'][$myFieldName] . ", ";
else
// Default for other PDO Engines
$myDBQueryFields .= $dbmapping[$szTableType]['DBMAPPINGS'][$myFieldName] . ", ";
}
} }
} }
else // Only Include ConsolidateField else // Only Include ConsolidateField
$myDBQueryFields = $myDBConsFieldName . ", "; {
if ( $this->_logStreamConfigObj->DBType == DB_PGSQL ||
$this->_logStreamConfigObj->DBType == DB_MSSQL )
$myDBQueryFields = "Max(" . $myDBConsFieldName . ") as " . $myDBConsFieldName. ", ";
else
// Default for other PDO Engines
$myDBQueryFields = $myDBConsFieldName . ", ";
}
// Add Min and Max fields for DATE if desired
if ( $bIncludeMinMaxDateFields )
{
$myDBQueryFields .= "Min(" . $dbmapping[$szTableType]['DBMAPPINGS'][SYSLOG_DATE] . ") as firstoccurrence_date, ";
$myDBQueryFields .= "Max(" . $dbmapping[$szTableType]['DBMAPPINGS'][SYSLOG_DATE] . ") as lastoccurrence_date, ";
}
if ( $szConsFieldId == $szSortFieldId ) if ( $szConsFieldId == $szSortFieldId )
$myDBSortedFieldName = "ItemCount"; $myDBSortedFieldName = "itemcount";
else else
$myDBSortedFieldName = $szSortFieldId; $myDBSortedFieldName = $szSortFieldId;
// --- // ---
@ -955,6 +1452,9 @@ class LogStreamPDO extends LogStream {
else if($this->_logStreamConfigObj->DBType == DB_MSSQL ) else if($this->_logStreamConfigObj->DBType == DB_MSSQL )
{ {
// TODO FIND A WAY FOR MSSQL! // TODO FIND A WAY FOR MSSQL!
// Helper variable for the select statement
$mySelectFieldName = $myDBGroupByFieldName . "Grouped";
$myDBQueryFieldName = "DATE( " . $myDBConsFieldName . ") AS " . $myDBGroupByFieldName ;
} }
} }
@ -964,23 +1464,40 @@ class LogStreamPDO extends LogStream {
// Append LIMIT in this case! // Append LIMIT in this case!
if ( $this->_logStreamConfigObj->DBType == DB_MYSQL || if ( $this->_logStreamConfigObj->DBType == DB_MYSQL ||
$this->_logStreamConfigObj->DBType == DB_PGSQL ) $this->_logStreamConfigObj->DBType == DB_PGSQL )
$szLimitSql = " LIMIT " . $nRecordLimit; {
$szLimitSqlBefore = "";
$szLimitSqlAfter = " LIMIT " . $nRecordLimit;
}
else if( $this->_logStreamConfigObj->DBType == DB_MSSQL )
{
$szLimitSqlBefore = " TOP(" . $nRecordLimit . ") ";
$szLimitSqlAfter = "";
}
else else
$szLimitSql = ""; {
// TODO FIND A WAY FOR MSSQL! $szLimitSqlBefore = "";
$szLimitSqlAfter = "";
}
} }
else else
$szLimitSql = ""; {
$szLimitSqlBefore = "";
$szLimitSqlAfter = "";
}
// Create SQL String now! // Create SQL String now!
$szSql = "SELECT " . $szSql = "SELECT " .
$szLimitSqlBefore .
$myDBQueryFields . $myDBQueryFields .
"count(" . $myDBConsFieldName . ") as ItemCount " . "count(" . $myDBConsFieldName . ") as itemcount " .
" FROM " . $this->_logStreamConfigObj->DBTableName . " FROM " . $this->_logStreamConfigObj->DBTableName .
$this->_SQLwhereClause . $this->_SQLwhereClause .
" GROUP BY " . $myDBGroupByFieldName . " GROUP BY " . $myDBGroupByFieldName .
" ORDER BY " . $myDBSortedFieldName . " " . $szSortingOrder . " ORDER BY " . $myDBSortedFieldName . " " . $szSortingOrder .
$szLimitSql ; $szLimitSqlAfter ;
// Output Debug Informations
OutputDebugMessage("LogStreamPDO|ConsolidateDataByField: Running Created SQL Query:<br>" . $szSql, DEBUG_DEBUG);
// Perform Database Query // Perform Database Query
$this->_myDBQuery = $this->_dbhandle->query($szSql); $this->_myDBQuery = $this->_dbhandle->query($szSql);
@ -1006,10 +1523,14 @@ class LogStreamPDO extends LogStream {
foreach ( $myRow as $myFieldName => $myFieldValue ) foreach ( $myRow as $myFieldName => $myFieldValue )
{ {
$myFieldID = $this->GetFieldIDbyDatabaseMapping($szTableType, $myFieldName);
$aNewRow[ $myFieldID ] = $myFieldValue;
/*
if ( $myFieldName == $dbmapping[$szTableType]['DBMAPPINGS'][$szConsFieldId] ) if ( $myFieldName == $dbmapping[$szTableType]['DBMAPPINGS'][$szConsFieldId] )
$aNewRow[$szConsFieldId] = $myFieldValue; $aNewRow[$szConsFieldId] = $myFieldValue;
else else
$aNewRow[$myFieldName] = $myFieldValue; $aNewRow[$myFieldName] = $myFieldValue;
*/
} }
// Add new row to result // Add new row to result
@ -1690,77 +2211,259 @@ class LogStreamPDO extends LogStream {
/* /*
* Function handles missing database fields automatically! * Function handles missing database fields automatically!
*/ */
private function HandleMissingField() private function HandleMissingField( $szMissingField = null, $arrProperties = null )
{ {
global $dbmapping, $fields; global $dbmapping, $fields;
// Get Err description // Get Err description
$errdesc = $this->_dbhandle->errorInfo(); $errdesc = $this->_dbhandle->errorInfo();
// check matching of error msg! // Try to get missing field from SQL Error of not specified as argument
if ( if ( $szMissingField == null )
preg_match("/Unknown column '(.*?)' in '(.*?)'$/", $errdesc[2], $errOutArr ) || // MySQL
preg_match("/column \"(.*?)\" does not exist/", $errdesc[2], $errOutArr ) // PostgreSQL
// ERROR: column "checksum" does not exist LINE 1: ... eventsource, eventcategory, eventuser, systemid, checksum, ... ^
)
{ {
$szTableType = $this->_logStreamConfigObj->DBTableType; // check matching of error msg!
if (
// Loop through all fields to see which one is missing! preg_match("/Unknown column '(.*?)' in '(.*?)'$/", $errdesc[2], $errOutArr ) || // MySQL
foreach ( $this->_arrProperties as $myproperty ) preg_match("/column \"(.*?)\" does not exist/", $errdesc[2], $errOutArr ) || // PostgreSQL
preg_match("/Invalid column name '(.*?)'/", $errdesc[2], $errOutArr ) // MSSQL
// ERROR: column "checksum" does not exist LINE 1: ... eventsource, eventcategory, eventuser, systemid, checksum, ... ^
)
{ {
if ( isset($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty]) && $errOutArr[1] == $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] ) $szMissingField = $errOutArr[1];
{ }
$szUpdateSql = ""; else
if ( $this->_logStreamConfigObj->DBType == DB_MYSQL ) {
{ $this->PrintDebugError("ER_BAD_FIELD_ERROR - SQL Statement: ". $errdesc[2]);
// MYSQL Statements return ERROR_DB_DBFIELDNOTFOUND;
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_NUMBER ) }
$szUpdateSql = "ALTER TABLE `" . $this->_logStreamConfigObj->DBTableName . "` ADD `" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "` int(11) NOT NULL DEFAULT '0'"; }
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_STRING )
$szUpdateSql = "ALTER TABLE `" . $this->_logStreamConfigObj->DBTableName . "` ADD `" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "` varchar(60) NULL";
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_DATE )
$szUpdateSql = "ALTER TABLE `" . $this->_logStreamConfigObj->DBTableName . "` ADD `" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "` datetime NOT NULL DEFAULT '0000-00-00 00:00:00'";
}
else if ( $this->_logStreamConfigObj->DBType == DB_PGSQL )
{
// MYSQL Statements
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_NUMBER )
$szUpdateSql = "ALTER TABLE " . $this->_logStreamConfigObj->DBTableName . " ADD " . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . " int NOT NULL DEFAULT '0'";
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_STRING )
$szUpdateSql = "ALTER TABLE " . $this->_logStreamConfigObj->DBTableName . " ADD " . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . " varchar(60) NULL";
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_DATE )
$szUpdateSql = "ALTER TABLE " . $this->_logStreamConfigObj->DBTableName . " ADD " . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . " timestamp without time zone NULL";
}
if ( strlen($szUpdateSql) > 0 ) // Set Properties to default if NULL
{ if ( $arrProperties == null )
// Update Table schema now! $arrProperties = $this->_arrProperties;
$myQuery = $this->_dbhandle->query($szUpdateSql);
if (!$myQuery) // Get Tabletype
{ $szTableType = $this->_logStreamConfigObj->DBTableType;
// Return failure!
$this->PrintDebugError("ER_BAD_FIELD_ERROR - Dynamically Adding field '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "' with Statement failed: '" . $szUpdateSql . "'"); // Loop through all fields to see which one is missing!
return ERROR_DB_DBFIELDNOTFOUND; foreach ( $arrProperties as $myproperty )
} {
else // Free query now if ( isset($dbmapping[$szTableType]['DBMAPPINGS'][$myproperty]) && $szMissingField == $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] )
$myQuery->closeCursor(); {
} $szUpdateSql = "";
else if ( $this->_logStreamConfigObj->DBType == DB_MYSQL )
{
// MYSQL Statements
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_NUMBER )
$szUpdateSql = "ALTER TABLE `" . $this->_logStreamConfigObj->DBTableName . "` ADD `" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "` int(11) NOT NULL DEFAULT '0'";
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_STRING )
$szUpdateSql = "ALTER TABLE `" . $this->_logStreamConfigObj->DBTableName . "` ADD `" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "` varchar(60) NULL";
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_DATE )
$szUpdateSql = "ALTER TABLE `" . $this->_logStreamConfigObj->DBTableName . "` ADD `" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "` datetime NOT NULL DEFAULT '0000-00-00 00:00:00'";
}
else if ( $this->_logStreamConfigObj->DBType == DB_PGSQL )
{
// MYSQL Statements
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_NUMBER )
$szUpdateSql = "ALTER TABLE " . $this->_logStreamConfigObj->DBTableName . " ADD " . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . " int NOT NULL DEFAULT '0'";
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_STRING )
$szUpdateSql = "ALTER TABLE " . $this->_logStreamConfigObj->DBTableName . " ADD " . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . " varchar(60) NULL";
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_DATE )
$szUpdateSql = "ALTER TABLE " . $this->_logStreamConfigObj->DBTableName . " ADD " . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . " timestamp without time zone NULL";
}
else if ( $this->_logStreamConfigObj->DBType == DB_MSSQL )
{
// MYSQL Statements
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_NUMBER )
$szUpdateSql = "ALTER TABLE " . $this->_logStreamConfigObj->DBTableName . " ADD " . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . " INT NOT NULL DEFAULT '0'";
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_STRING )
$szUpdateSql = "ALTER TABLE " . $this->_logStreamConfigObj->DBTableName . " ADD " . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . " VARCHAR(60) NULL";
if ( $fields[$myproperty]['FieldType'] == FILTER_TYPE_DATE )
$szUpdateSql = "ALTER TABLE " . $this->_logStreamConfigObj->DBTableName . " ADD " . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . " DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'";
}
// Run SQL Command to add the missing field!
if ( strlen($szUpdateSql) > 0 )
{
// Update Table schema now!
$myQuery = $this->_dbhandle->query($szUpdateSql);
if (!$myQuery)
{ {
// Return failure! // Return failure!
$this->PrintDebugError("ER_BAD_FIELD_ERROR - Field '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "' is missing has to be added manually to the database layout!'"); $this->PrintDebugError("ER_BAD_FIELD_ERROR - Dynamically Adding field '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "' with Statement failed: '" . $szUpdateSql . "'");
return ERROR_DB_DBFIELDNOTFOUND; return ERROR_DB_DBFIELDNOTFOUND;
} }
else // Free query now
$myQuery->closeCursor();
}
else
{
// Return failure!
$this->PrintDebugError("ER_BAD_FIELD_ERROR - Field '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "' is missing and failed to be added automatically! The fields has to be added manually to the database layout!'");
global $extraErrorDescription;
$extraErrorDescription = "Field '" . $dbmapping[$szTableType]['DBMAPPINGS'][$myproperty] . "' was missing and has been automatically added to the database layout.";
return ERROR_DB_DBFIELDNOTFOUND;
} }
} }
}
// Reached this point means success! // Reached this point means success!
return SUCCESS; return SUCCESS;
}
/*
* Helper function to return a list of Indexes for the logstream table
*/
private function GetIndexesAsArray()
{
global $querycount;
// Verify database connection (This also opens the database!)
$res = $this->Verify();
if ( $res != SUCCESS )
return $res;
// Init Array
$arrIndexKeys = array();
// Create SQL and Get INDEXES for table!
if ( $this->_logStreamConfigObj->DBType == DB_MYSQL )
$szSql = "SHOW INDEX FROM " . $this->_logStreamConfigObj->DBTableName;
else if ( $this->_logStreamConfigObj->DBType == DB_PGSQL )
$szSql = "SELECT c.relname AS \"Key_name\" FROM pg_catalog.pg_class c JOIN pg_catalog.pg_index i ON i.indexrelid = c.oid JOIN pg_catalog.pg_class t ON i.indrelid = t.oid WHERE c.relkind = 'i' AND t.relname = 'systemevents' AND c.relname LIKE '%idx%'";
else if ( $this->_logStreamConfigObj->DBType == DB_MSSQL )
$szSql = "SELECT sysindexes.name AS Key_name FROM sysobjects, sysindexes WHERE sysobjects.xtype='U' AND sysindexes.id=object_id(sysobjects.name) and sysobjects.name='" . $this->_logStreamConfigObj->DBTableName . "' ORDER BY sysobjects.name ASC";
else
// Not supported in this case!
return null;
OutputDebugMessage("LogStreamPDO|GetIndexesAsArray: List Indexes for '" . $this->_logStreamConfigObj->DBTableName . "' - " . $szSql, DEBUG_ULTRADEBUG);
$myQuery = $this->_dbhandle->query($szSql);
if ($myQuery)
{
// Loop through results
while ( $myRow = $myQuery->fetch(PDO::FETCH_ASSOC) )
{
// Add to index keys
if ( $this->_logStreamConfigObj->DBType == DB_PGSQL || $this->_logStreamConfigObj->DBType == DB_MSSQL )
$arrIndexKeys[] = str_replace( "_idx", "", strtolower($myRow['Key_name']) );
else
$arrIndexKeys[] = strtolower($myRow['Key_name']);
}
// Free query now
$myQuery->closeCursor();
// Increment for the Footer Stats
$querycount++;
}
// return Array
return $arrIndexKeys;
}
/*
* Helper function to return a list of Fields from the logstream table
*/
private function GetFieldsAsArray()
{
global $querycount;
// Verify database connection (This also opens the database!)
$res = $this->Verify();
if ( $res != SUCCESS )
return $res;
// Init Array
$arrFieldKeys = array();
// Create SQL and Get FIELDS for table!
if ( $this->_logStreamConfigObj->DBType == DB_MYSQL )
$szSql = "SHOW FIELDS FROM " . $this->_logStreamConfigObj->DBTableName;
else if ( $this->_logStreamConfigObj->DBType == DB_PGSQL )
$szSql = "SELECT column_name as \"Field\" FROM information_schema.COLUMNS WHERE table_name = '" . $this->_logStreamConfigObj->DBTableName . "'";
else if ( $this->_logStreamConfigObj->DBType == DB_MSSQL )
$szSql = "SELECT syscolumns.name AS Field FROM sysobjects JOIN syscolumns ON sysobjects.id = syscolumns.id WHERE sysobjects.xtype='U' AND sysobjects.name='" . $this->_logStreamConfigObj->DBTableName . "'";
else
// Not supported in this case!
return null;
OutputDebugMessage("LogStreamPDO|GetFieldsAsArray: List Columns for '" . $this->_logStreamConfigObj->DBTableName . "' - " . $szSql, DEBUG_ULTRADEBUG);
$myQuery = $this->_dbhandle->query($szSql);
if ($myQuery)
{
// Loop through results
while ( $myRow = $myQuery->fetch(PDO::FETCH_ASSOC) )
{
// Add to index keys
$arrFieldKeys[] = strtolower($myRow['Field']);
}
// Free query now
$myQuery->closeCursor();
// Increment for the Footer Stats
$querycount++;
} }
else else
$this->PrintDebugError("ER_BAD_FIELD_ERROR - SQL Statement: ". $errdesc[2]); $this->PrintDebugError("ERROR_DB_QUERYFAILED - GetFieldsAsArray SQL '" . $szSql . "' failed!");
return ERROR_DB_DBFIELDNOTFOUND;
// return Array
return $arrFieldKeys;
}
/*
* Helper function to return a list of Indexes for the logstream table
*/
private function GetTriggersAsArray()
{
global $querycount;
// Verify database connection (This also opens the database!)
$res = $this->Verify();
if ( $res != SUCCESS )
return $res;
// Init Array
$arrIndexTriggers = array();
// Create SQL and Get INDEXES for table!
if ( $this->_logStreamConfigObj->DBType == DB_MYSQL )
$szSql = "SHOW TRIGGERS";
else if ( $this->_logStreamConfigObj->DBType == DB_PGSQL )
$szSql = "SELECT tgname as \"Trigger\" from pg_trigger;";
else if ( $this->_logStreamConfigObj->DBType == DB_MSSQL )
$szSql = "SELECT B.Name as TableName,A.name AS 'Trigger' FROM sysobjects A,sysobjects B WHERE A.xtype='TR' AND A.parent_obj = B.id"; // AND B.Name='systemevents'";
else
// Not supported in this case!
return null;
OutputDebugMessage("LogStreamPDO|GetTriggersAsArray: List Triggers for '" . $this->_logStreamConfigObj->DBTableName . "' - " . $szSql, DEBUG_ULTRADEBUG);
$myQuery = $this->_dbhandle->query($szSql);
if ($myQuery)
{
// Loop through results
while ( $myRow = $myQuery->fetch(PDO::FETCH_ASSOC) )
{
// Add to index keys
$arrIndexTriggers[] = strtolower($myRow['Trigger']);
}
// Free query now
$myQuery->closeCursor();
// Increment for the Footer Stats
$querycount++;
}
// return Array
return $arrIndexTriggers;
} }

View File

@ -117,6 +117,25 @@ abstract class Report {
*/ */
public abstract function InitAdvancedSettings(); public abstract function InitAdvancedSettings();
/**
* If the reports needs to optimize the logstream, it is checked and verified by this function
*/
public abstract function CheckLogStreamSource( $mySourceID );
/**
* If the reports needs INDEXES, these are created by this function
*/
public abstract function CreateLogStreamIndexes( $mySourceID );
/**
* If the reports needs a TRIGGER, these are created by this function
*/
public abstract function CreateLogStreamTrigger( $mySourceID );
/** /**
* verifyDataSource, verifies if data is accessable and * verifyDataSource, verifies if data is accessable and
* contains what we need * contains what we need
@ -637,5 +656,241 @@ abstract class Report {
return $res; return $res;
} }
/**
* If the reports needs to optimize the logstream, it is checked and verified by this function
*/
public function CheckLogStreamSourceByPropertyArray( $mySourceID, $arrProperties, $myTriggerProperty )
{
global $content, $fields;
$res = SUCCESS;
if ( $this->_streamCfgObj == null )
{
if ( isset($content['Sources'][$mySourceID]) )
{
// Obtain and get the Config Object
$this->_streamCfgObj = $content['Sources'][$mySourceID]['ObjRef'];
// Return success if logstream is FILE based!
if ( $content['Sources'][$mySourceID]['SourceType'] == SOURCE_DISK )
return SUCCESS;
}
else
return ERROR_SOURCENOTFOUND;
}
if ( $this->_streamObj == null )
{
// Create LogStream Object
$this->_streamObj = $this->_streamCfgObj->LogStreamFactory($this->_streamCfgObj);
}
// Check datasource and return result
$res = $this->_streamObj->Verify();
if ( $res == SUCCESS )
{
// Will check if all necessary fields are available!
$res = $this->_streamObj->VerifyFields( $this->_arrProperties );
if ($res != SUCCESS )
return $res;
// Will check if certain INDEXES do exists for database logstream!
$res = $this->_streamObj->VerifyIndexes( $arrProperties );
if ($res != SUCCESS )
return $res;
// Will check if checksum field is correctly configured for database logstream!
$res = $this->_streamObj->VerifyChecksumField( );
if ($res != SUCCESS )
return $res;
// Will check if TRIGGERS are installed! Requires SUPER access in database logstream!
$res = $this->_streamObj->VerifyChecksumTrigger( $myTriggerProperty );
if ($res != SUCCESS )
return $res;
}
// return results!
return $res;
}
/**
* If the reports needs extra FIELDS, they are created by this function
*/
public function CreateMissingLogStreamFields( $mySourceID )
{
global $content, $fields;
$res = SUCCESS;
if ( $this->_streamCfgObj == null )
{
if ( isset($content['Sources'][$mySourceID]) )
{
// Obtain and get the Config Object
$this->_streamCfgObj = $content['Sources'][$mySourceID]['ObjRef'];
// Return success if logstream is FILE based!
if ( $content['Sources'][$mySourceID]['SourceType'] == SOURCE_DISK )
return SUCCESS;
}
else
return ERROR_SOURCENOTFOUND;
}
if ( $this->_streamObj == null )
{
// Create LogStream Object
$this->_streamObj = $this->_streamCfgObj->LogStreamFactory($this->_streamCfgObj);
}
// Check datasource and return result
$res = $this->_streamObj->Verify();
if ( $res == SUCCESS )
{
// Will add missing fields for this database logstream !
$res = $this->_streamObj->CreateMissingFields( $this->_arrProperties );
if ($res != SUCCESS )
return $res;
}
// return results!
return $res;
}
/**
* If the reports needs INDEXES, they are created by this function
*/
public function CreateLogStreamIndexesByPropertyArray( $mySourceID, $arrProperties )
{
global $content, $fields;
$res = SUCCESS;
if ( $this->_streamCfgObj == null )
{
if ( isset($content['Sources'][$mySourceID]) )
{
// Obtain and get the Config Object
$this->_streamCfgObj = $content['Sources'][$mySourceID]['ObjRef'];
// Return success if logstream is FILE based!
if ( $content['Sources'][$mySourceID]['SourceType'] == SOURCE_DISK )
return SUCCESS;
}
else
return ERROR_SOURCENOTFOUND;
}
if ( $this->_streamObj == null )
{
// Create LogStream Object
$this->_streamObj = $this->_streamCfgObj->LogStreamFactory($this->_streamCfgObj);
}
// Check datasource and return result
$res = $this->_streamObj->Verify();
if ( $res == SUCCESS )
{
// Will check if certain INDEXES do exists for database logstream classes!
$res = $this->_streamObj->CreateMissingIndexes( $arrProperties );
if ($res != SUCCESS )
return $res;
}
// return results!
return $res;
}
/**
* If the reports needs INDEXES, these are created by this function
*/
public function CreateLogStreamTriggerByPropertyArray( $mySourceID, $myTriggerProperty, $myChecksumProperty )
{
global $content, $fields;
$res = SUCCESS;
if ( $this->_streamCfgObj == null )
{
if ( isset($content['Sources'][$mySourceID]) )
{
// Obtain and get the Config Object
$this->_streamCfgObj = $content['Sources'][$mySourceID]['ObjRef'];
// Return success if logstream is FILE based!
if ( $content['Sources'][$mySourceID]['SourceType'] == SOURCE_DISK )
return SUCCESS;
}
else
return ERROR_SOURCENOTFOUND;
}
if ( $this->_streamObj == null )
{
// Create LogStream Object
$this->_streamObj = $this->_streamCfgObj->LogStreamFactory($this->_streamCfgObj);
}
// Check datasource and return result
$res = $this->_streamObj->Verify();
if ( $res == SUCCESS )
{
// Will check if certain INDEXES do exists for database logstream classes!
$res = $this->_streamObj->CreateMissingTrigger( $myTriggerProperty, $myChecksumProperty );
if ($res != SUCCESS )
return $res;
}
// return results!
return $res;
}
/**
* If the reports needs INDEXES, these are created by this function
*/
public function ChangeChecksumFieldUnsigned( $mySourceID )
{
global $content, $fields;
$res = SUCCESS;
if ( $this->_streamCfgObj == null )
{
if ( isset($content['Sources'][$mySourceID]) )
{
// Obtain and get the Config Object
$this->_streamCfgObj = $content['Sources'][$mySourceID]['ObjRef'];
// Return success if logstream is FILE based!
if ( $content['Sources'][$mySourceID]['SourceType'] == SOURCE_DISK )
return SUCCESS;
}
else
return ERROR_SOURCENOTFOUND;
}
if ( $this->_streamObj == null )
{
// Create LogStream Object
$this->_streamObj = $this->_streamCfgObj->LogStreamFactory($this->_streamCfgObj);
}
// Check datasource and return result
$res = $this->_streamObj->Verify();
if ( $res == SUCCESS )
{
// Will change the Checksum Field to UNSIGNED INT
$res = $this->_streamObj->ChangeChecksumFieldUnsigned( );
if ($res != SUCCESS )
return $res;
}
// return results!
return $res;
}
} }
?> ?>

View File

@ -160,13 +160,13 @@ class Report_eventsummary extends Report {
$tmpReportData['DisplayName'] = GetSeverityDisplayName( $tmpReportData[SYSLOG_SEVERITY] ); $tmpReportData['DisplayName'] = GetSeverityDisplayName( $tmpReportData[SYSLOG_SEVERITY] );
$tmpReportData['bgcolor'] = $severity_colors[ $tmpReportData[SYSLOG_SEVERITY] ]; $tmpReportData['bgcolor'] = $severity_colors[ $tmpReportData[SYSLOG_SEVERITY] ];
$iTotalEvents += $tmpReportData['ItemCount']; $iTotalEvents += $tmpReportData['itemcount'];
} }
// Prepent Item with totalevents count // Prepent Item with totalevents count
$totalItem['DisplayName'] = "Total Events"; $totalItem['DisplayName'] = "Total Events";
$totalItem['bgcolor'] = "#999999"; $totalItem['bgcolor'] = "#999999";
$totalItem['ItemCount'] = $iTotalEvents; $totalItem['itemcount'] = $iTotalEvents;
// Prepent to array // Prepent to array
array_unshift( $content["report_summary"], $totalItem ); array_unshift( $content["report_summary"], $totalItem );
@ -289,6 +289,44 @@ class Report_eventsummary extends Report {
} }
/*
* Implementation of CheckLogStreamSource
*/
public function CheckLogStreamSource( $mySourceID )
{
// Call basic report Check function
$res = $this->CheckLogStreamSourceByPropertyArray( $mySourceID, array(SYSLOG_HOST, MISC_CHECKSUM, SYSLOG_DATE, SYSLOG_SEVERITY, SYSLOG_MESSAGETYPE), SYSLOG_MESSAGE );
// return results!
return $res;
}
/*
* Implementation of CreateLogStreamIndexes | Will create missing INDEXES
*/
public function CreateLogStreamIndexes( $mySourceID )
{
// Call basic report Check function
$res = $this->CreateLogStreamIndexesByPropertyArray( $mySourceID, array(SYSLOG_HOST, MISC_CHECKSUM, SYSLOG_DATE, SYSLOG_SEVERITY, SYSLOG_MESSAGETYPE) );
// return results!
return $res;
}
/*
* Implementation of CreateLogStreamIndexes | Will create missing TRIGGER
*/
public function CreateLogStreamTrigger( $mySourceID )
{
// Call basic report Check function
$res = $this->CreateLogStreamTriggerByPropertyArray( $mySourceID, SYSLOG_MESSAGE, MISC_CHECKSUM );
// return results!
return $res;
}
// --- Private functions... // --- Private functions...
/** /**
@ -296,15 +334,50 @@ class Report_eventsummary extends Report {
*/ */
private function ConsolidateEventsPerHost( $arrHosts ) private function ConsolidateEventsPerHost( $arrHosts )
{ {
global $content, $gl_starttime; global $content, $gl_starttime, $fields;
// Now open the stream for data processing // Now open the stream for data processing
$res = $this->_streamObj->Open( $this->_arrProperties, true ); $res = $this->_streamObj->Open( $this->_arrProperties, true );
if ( $res == SUCCESS ) if ( $res == SUCCESS )
{ {
// Set reading direction // --- New Method to consolidate data!
// $this->_streamObj->SetReadDirection( EnumReadDirection::Backward ); // TimeStats
$nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
// Update all Checksums first!
$this->_streamObj->UpdateAllMessageChecksum();
// TimeStats
$nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
foreach ( $arrHosts as $myHost )
{
// Set custom filters
$this->_streamObj->ResetFilters();
$this->_streamObj->SetFilter( $this->_filterString . " " . $fields[SYSLOG_MESSAGETYPE]['SearchField'] . ":=" . IUT_NT_EventReport . ",=" . IUT_WEVTMONV2 . " " . $fields[SYSLOG_HOST]['SearchField'] . ":=" . $myHost );
// Set Host Item Basics if not set yet
$content["report_consdata"][ $myHost ][SYSLOG_HOST] = $myHost;
// Get Data for single host
$content["report_consdata"][ $myHost ]['cons_events'] = $this->_streamObj->ConsolidateDataByField( MISC_CHECKSUM, $this->_maxEventsPerHost, MISC_CHECKSUM, SORTING_ORDER_DESC, null, true, true );
//print_r ($fields[SYSLOG_MESSAGE]);
foreach ( $content["report_consdata"][ $myHost ]['cons_events'] as &$myConsData )
{
// Set Basic data entries
if (!isset( $content['filter_severity_list'][$myConsData[SYSLOG_SEVERITY]] ))
$myConsData[SYSLOG_SEVERITY] = SYSLOG_NOTICE; // Set default in this case
}
}
// TimeStats
$nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
// ---
/* OLD CODE
// Init uid helper // Init uid helper
$uID = UID_UNKNOWN; $uID = UID_UNKNOWN;
@ -349,7 +422,7 @@ class Report_eventsummary extends Report {
if ( isset($content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_events'][ $strChecksum ]) ) if ( isset($content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_events'][ $strChecksum ]) )
{ {
// Increment counter and set First/Last Event date // Increment counter and set First/Last Event date
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_events'][ $strChecksum ]['ItemCount']++; $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_events'][ $strChecksum ]['itemcount']++;
// Set FirstEvent date if necessary! // Set FirstEvent date if necessary!
if ( $logArray[SYSLOG_DATE][EVTIME_TIMESTAMP] < $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_events'][ $strChecksum ]['FirstEvent_Date'][EVTIME_TIMESTAMP] ) if ( $logArray[SYSLOG_DATE][EVTIME_TIMESTAMP] < $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_events'][ $strChecksum ]['FirstEvent_Date'][EVTIME_TIMESTAMP] )
@ -368,7 +441,7 @@ class Report_eventsummary extends Report {
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_events'][ $strChecksum ][SYSLOG_MESSAGE] = $logArray[SYSLOG_MESSAGE]; $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_events'][ $strChecksum ][SYSLOG_MESSAGE] = $logArray[SYSLOG_MESSAGE];
// Set Counter and First/Last Event date // Set Counter and First/Last Event date
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_events'][ $strChecksum ]['ItemCount'] = 1; $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_events'][ $strChecksum ]['itemcount'] = 1;
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_events'][ $strChecksum ]['FirstEvent_Date'] = $logArray[SYSLOG_DATE]; $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_events'][ $strChecksum ]['FirstEvent_Date'] = $logArray[SYSLOG_DATE];
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_events'][ $strChecksum ]['LastEvent_Date'] = $logArray[SYSLOG_DATE]; $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_events'][ $strChecksum ]['LastEvent_Date'] = $logArray[SYSLOG_DATE];
} }
@ -381,59 +454,74 @@ class Report_eventsummary extends Report {
// TimeStats // TimeStats
$nowtime = microtime_float(); $nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s "; $content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
}
*/
// Start Postprocessing // Start Postprocessing
foreach( $content["report_consdata"] as &$tmpConsolidatedComputer ) foreach( $content["report_consdata"] as &$tmpConsolidatedComputer )
{
// First use callback function to sort array
uasort($tmpConsolidatedComputer['cons_events'], "MultiSortArrayByItemCountDesc");
// Remove entries according to _maxEventsPerHost
if ( count($tmpConsolidatedComputer['cons_events']) > $this->_maxEventsPerHost )
{ {
// First use callback function to sort array $iDropCount = 0;
uasort($tmpConsolidatedComputer['cons_events'], "MultiSortArrayByItemCountDesc");
// Remove entries according to _maxEventsPerHost do
if ( count($tmpConsolidatedComputer['cons_events']) > $this->_maxEventsPerHost )
{ {
$iDropCount = 0; array_pop($tmpConsolidatedComputer['cons_events']);
$iDropCount++;
} while ( count($tmpConsolidatedComputer['cons_events']) > $this->_maxEventsPerHost );
do // Append a dummy entry which shows count of all other events
{ if ( $iDropCount > 0 )
array_pop($tmpConsolidatedComputer['cons_events']);
$iDropCount++;
} while ( count($tmpConsolidatedComputer['cons_events']) > $this->_maxEventsPerHost );
// Append a dummy entry which shows count of all other events
if ( $iDropCount > 0 )
{
$lastEntry[SYSLOG_SEVERITY] = SYSLOG_NOTICE;
$lastEntry[SYSLOG_EVENT_ID] = "-";
$lastEntry[SYSLOG_EVENT_SOURCE] = $content['LN_GEN_ALL_OTHER_EVENTS'];
$lastEntry[SYSLOG_MESSAGE] = $content['LN_GEN_ALL_OTHER_EVENTS'];
$lastEntry['ItemCount'] = $iDropCount;
$lastEntry['FirstEvent_Date'] = "-";
$lastEntry['LastEvent_Date'] = "-";
$tmpConsolidatedComputer['cons_events'][] = $lastEntry;
}
}
// TimeStats
$nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
// PostProcess Events!
foreach( $tmpConsolidatedComputer["cons_events"] as &$tmpMyEvent )
{ {
$tmpMyEvent['FirstEvent_Date_Formatted'] = GetFormatedDate( $tmpMyEvent['FirstEvent_Date'] ); $lastEntry[SYSLOG_SEVERITY] = SYSLOG_NOTICE;
$tmpMyEvent['LastEvent_Date_Formatted'] = GetFormatedDate( $tmpMyEvent['LastEvent_Date'] ); $lastEntry[SYSLOG_EVENT_ID] = "-";
$tmpMyEvent['syslogseverity_text'] = $content['filter_severity_list'][ $tmpMyEvent['syslogseverity'] ]["DisplayName"]; $lastEntry[SYSLOG_EVENT_SOURCE] = $content['LN_GEN_ALL_OTHER_EVENTS'];
$lastEntry[SYSLOG_MESSAGE] = $content['LN_GEN_ALL_OTHER_EVENTS'];
$lastEntry['itemcount'] = $iDropCount;
$lastEntry['FirstEvent_Date'] = "-";
$lastEntry['LastEvent_Date'] = "-";
$tmpConsolidatedComputer['cons_events'][] = $lastEntry;
} }
} }
// TimeStats
$nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
// PostProcess Events!
foreach( $tmpConsolidatedComputer["cons_events"] as &$tmpMyEvent )
{
$tmpMyEvent['FirstEvent_Date_Formatted'] = GetFormatedDate( $tmpMyEvent['firstoccurrence_date'] );
$tmpMyEvent['LastEvent_Date_Formatted'] = GetFormatedDate( $tmpMyEvent['lastoccurrence_date'] );
$tmpMyEvent['syslogseverity_text'] = $content['filter_severity_list'][ $tmpMyEvent['syslogseverity'] ]["DisplayName"];
$tmpMyEvent['syslogseverity_bgcolor'] = $this->GetSeverityBGColor($tmpMyEvent['syslogseverity']);
}
} }
else // ---
return $ret;
} }
// Work done! // Work done!
return SUCCESS; return SUCCESS;
} }
/*
* Helper function to obtain Severity background color
*/
private function GetSeverityBGColor( $nSeverity )
{
global $severity_colors;
if ( isset( $severity_colors[$nSeverity] ) )
return $severity_colors[$nSeverity];
else
return $severity_colors[SYSLOG_INFO]; //Default
}
} }
?> ?>

View File

@ -56,7 +56,7 @@
<!-- BEGIN report_summary --> <!-- BEGIN report_summary -->
<tr> <tr>
<td class="cellmenu2">{DisplayName}</td> <td class="cellmenu2">{DisplayName}</td>
<td class="lineColouredWhite" bgcolor="{bgcolor}" align="right"><b>{ItemCount}</b></td> <td class="lineColouredWhite" bgcolor="{bgcolor}" align="right"><b>{itemcount}</b></td>
</tr> </tr>
<!-- END report_summary --> <!-- END report_summary -->
</table> </table>
@ -68,7 +68,7 @@
<tr> <tr>
<td class="line1"> <td class="line1">
<!-- BEGIN report_computers --> <!-- BEGIN report_computers -->
<a href="#{FROMHOST}">{FROMHOST}</a>({ItemCount}), <a href="#{FROMHOST}">{FROMHOST}</a>({itemcount}),
<!-- END report_computers --> <!-- END report_computers -->
</td> </td>
</tr> </tr>
@ -91,33 +91,32 @@
<!-- BEGIN report_consdata --> <!-- BEGIN report_consdata -->
<h3><a name="{FROMHOST}">{FROMHOST}</a></h3> <h3><a name="{FROMHOST}">{FROMHOST}</a></h3>
<table width="100%" cellpadding="0" cellspacing="1" border="0" align="center" class="with_border_alternate"> <table width="100%" cellpadding="2" cellspacing="1" border="0" align="center" class="with_border_alternate">
<tr> <tr>
<td class="cellmenu1" align="center" width="50" nowrap>{ln_report_number}</td> <td class="cellmenu1" align="center" width="50" nowrap>{ln_report_number}</td>
<td class="cellmenu1" align="center" width="50" nowrap>{ln_report_count}</td>
<td class="cellmenu1" align="center" width="100" nowrap>{ln_report_firstevent}</td> <td class="cellmenu1" align="center" width="100" nowrap>{ln_report_firstevent}</td>
<td class="cellmenu1" align="center" width="100" nowrap>{ln_report_lastevent}</td> <td class="cellmenu1" align="center" width="100" nowrap>{ln_report_lastevent}</td>
<td class="cellmenu1" align="center" width="150" nowrap>{ln_report_process}</td> <td class="cellmenu1" align="center" width="150" nowrap>{ln_report_process}</td>
<td class="cellmenu1" align="center" width="100" nowrap>{ln_report_severity}</td> <td class="cellmenu1" align="center" width="100" nowrap>{ln_report_severity}</td>
<td class="cellmenu1" align="center" width="80" nowrap>{ln_report_eventid}</td> <td class="cellmenu1" align="center" width="80" nowrap>{ln_report_eventid}</td>
<td class="cellmenu1" align="center" width="100%" nowrap>{ln_report_description}</td> <td class="cellmenu1" align="center" width="100%" nowrap>{ln_report_description}</td>
<td class="cellmenu1" align="center" width="50" nowrap>{ln_report_count}</td>
</tr> </tr>
<!-- BEGIN cons_events --> <!-- BEGIN cons_events -->
<tr> <tr>
<td class="line1" valign="top" align="center">{ZAEHLER}</td> <td class="line1" valign="top" align="center">{ZAEHLER}</td>
<!-- IF itemcount>=$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#990000"><b>{itemcount}</b></td>
<!-- ENDIF itemcount>=$_colorThreshold -->
<!-- IF itemcount<$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#AAAAAA"><b>{itemcount}</b></td>
<!-- ENDIF itemcount<$_colorThreshold -->
<td class="line1" valign="top" align="center">{FirstEvent_Date_Formatted}</td> <td class="line1" valign="top" align="center">{FirstEvent_Date_Formatted}</td>
<td class="line1" valign="top" align="center">{LastEvent_Date_Formatted}</td> <td class="line1" valign="top" align="center">{LastEvent_Date_Formatted}</td>
<td class="line1" valign="top" align="center"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=sourceproc&q={sourceproc}" target="_blank">{sourceproc}</a></td> <td class="line1" valign="top" align="center"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=sourceproc&q={sourceproc}" target="_blank">{sourceproc}</a></td>
<td class="line1" valign="top" align="center">{syslogseverity_text}</td> <td class="lineColouredWhite" valign="top" align="center" bgcolor="{syslogseverity_bgcolor}"><b>{syslogseverity_text}</b></td>
<td class="line1" valign="top" align="center"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=id&q={id}" target="_blank">{id}</a></td> <td class="line1" valign="top" align="center"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=id&q={id}" target="_blank">{id}</a></td>
<td class="line1" valign="top" align="left">{msg}</td> <td class="line1" valign="top" align="left">{msg}</td>
<!-- IF ItemCount>=$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#990000"><b>{ItemCount}</b></td>
<!-- ENDIF ItemCount>=$_colorThreshold -->
<!-- IF ItemCount<$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#AAAAAA"><b>{ItemCount}</b></td>
<!-- ENDIF ItemCount<$_colorThreshold -->
</tr> </tr>
<!-- END cons_events --> <!-- END cons_events -->

View File

@ -38,7 +38,7 @@
<!-- BEGIN report_summary --> <!-- BEGIN report_summary -->
<tr> <tr>
<td class="cellmenu2">{DisplayName}</td> <td class="cellmenu2">{DisplayName}</td>
<td class="lineColouredWhite" bgcolor="{bgcolor}" align="right"><b>{ItemCount}</b></td> <td class="lineColouredWhite" bgcolor="{bgcolor}" align="right"><b>{itemcount}</b></td>
</tr> </tr>
<!-- END report_summary --> <!-- END report_summary -->
</table> </table>
@ -52,7 +52,7 @@
<tr> <tr>
<td class="line1"> <td class="line1">
<!-- BEGIN report_computers --> <!-- BEGIN report_computers -->
<a href="#{FROMHOST}">{FROMHOST}</a>({ItemCount}), <a href="#{FROMHOST}">{FROMHOST}</a>({itemcount}),
<!-- END report_computers --> <!-- END report_computers -->
</td> </td>
</tr> </tr>
@ -68,27 +68,27 @@
<table width="100%" cellpadding="0" cellspacing="1" border="1" align="center" class="with_border_alternate"> <table width="100%" cellpadding="0" cellspacing="1" border="1" align="center" class="with_border_alternate">
<tr> <tr>
<td class="cellmenu1" bgcolor="#9FDAF1" align="center" width="50" nowrap>{ln_report_number}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="center" width="50" nowrap>{ln_report_number}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="center" width="50" nowrap>{ln_report_count}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_firstevent}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_firstevent}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_lastevent}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_lastevent}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_process}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_process}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="50" nowrap>{ln_report_severity}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="50" nowrap>{ln_report_severity}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="50" nowrap>{ln_report_eventid}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="50" nowrap>{ln_report_eventid}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="center" width="50" nowrap>{ln_report_count}</td>
</tr> </tr>
<!-- BEGIN cons_events --> <!-- BEGIN cons_events -->
<tr> <tr>
<td class="line1" valign="top" align="center" rowspan="2">{ZAEHLER}</td> <td class="line1" valign="top" align="center" rowspan="2">{ZAEHLER}</td>
<!-- IF itemcount>=$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#DD0000"><b>{itemcount}</b></td>
<!-- ENDIF itemcount>=$_colorThreshold -->
<!-- IF itemcount<$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#CCCCCC"><b>{itemcount}</b></td>
<!-- ENDIF itemcount<$_colorThreshold -->
<td class="line1" valign="top" align="left">{FirstEvent_Date_Formatted}</td> <td class="line1" valign="top" align="left">{FirstEvent_Date_Formatted}</td>
<td class="line1" valign="top" align="left">{LastEvent_Date_Formatted}</td> <td class="line1" valign="top" align="left">{LastEvent_Date_Formatted}</td>
<td class="line1" valign="top" align="left"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=sourceproc&q={sourceproc}" target="_blank">{sourceproc}</a></td> <td class="line1" valign="top" align="left"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=sourceproc&q={sourceproc}" target="_blank">{sourceproc}</a></td>
<td class="line1" valign="top" align="left">{syslogseverity_text}</td> <td class="line1" valign="top" align="left">{syslogseverity_text}</td>
<td class="line1" valign="top" align="left"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=id&q={id}" target="_blank">{id}</a></td> <td class="line1" valign="top" align="left"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=id&q={id}" target="_blank">{id}</a></td>
<!-- IF ItemCount>=$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#DD0000"><b>{ItemCount}</b></td>
<!-- ENDIF ItemCount>=$_colorThreshold -->
<!-- IF ItemCount<$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#CCCCCC"><b>{ItemCount}</b></td>
<!-- ENDIF ItemCount<$_colorThreshold -->
</tr> </tr>
<tr> <tr>
<td class="cellmenu1" align="center" valign="top" nowrap colspan="2" width="200">{ln_report_description}</td> <td class="cellmenu1" align="center" valign="top" nowrap colspan="2" width="200">{ln_report_description}</td>

View File

@ -157,13 +157,13 @@ class Report_syslogsummary extends Report {
$tmpReportData['DisplayName'] = $this->GetSeverityDisplayName( $tmpReportData[SYSLOG_SEVERITY] ); $tmpReportData['DisplayName'] = $this->GetSeverityDisplayName( $tmpReportData[SYSLOG_SEVERITY] );
$tmpReportData['bgcolor'] = $this->GetSeverityBGColor( $tmpReportData[SYSLOG_SEVERITY] ); // $severity_colors[ $tmpReportData[SYSLOG_SEVERITY] ]; $tmpReportData['bgcolor'] = $this->GetSeverityBGColor( $tmpReportData[SYSLOG_SEVERITY] ); // $severity_colors[ $tmpReportData[SYSLOG_SEVERITY] ];
$iTotalEvents += $tmpReportData['ItemCount']; $iTotalEvents += $tmpReportData['itemcount'];
} }
// Prepent Item with totalevents count // Prepent Item with totalevents count
$totalItem['DisplayName'] = "Total Events"; $totalItem['DisplayName'] = "Total Events";
$totalItem['bgcolor'] = "#999999"; $totalItem['bgcolor'] = "#999999";
$totalItem['ItemCount'] = $iTotalEvents; $totalItem['itemcount'] = $iTotalEvents;
// Prepent to array // Prepent to array
array_unshift( $content["report_summary"], $totalItem ); array_unshift( $content["report_summary"], $totalItem );
@ -286,6 +286,44 @@ class Report_syslogsummary extends Report {
} }
/*
* Implementation of CheckLogStreamSource
*/
public function CheckLogStreamSource( $mySourceID )
{
// Call basic report Check function
$res = $this->CheckLogStreamSourceByPropertyArray( $mySourceID, array(SYSLOG_HOST, MISC_CHECKSUM, SYSLOG_DATE, SYSLOG_SEVERITY, SYSLOG_MESSAGETYPE), SYSLOG_MESSAGE );
// return results!
return $res;
}
/*
* Implementation of CreateLogStreamIndexes | Will create missing INDEXES
*/
public function CreateLogStreamIndexes( $mySourceID )
{
// Call basic report Check function
$res = $this->CreateLogStreamIndexesByPropertyArray( $mySourceID, array(SYSLOG_HOST, MISC_CHECKSUM, SYSLOG_DATE, SYSLOG_SEVERITY, SYSLOG_MESSAGETYPE) );
// return results!
return $res;
}
/*
* Implementation of CreateLogStreamIndexes | Will create missing INDEXES
*/
public function CreateLogStreamTrigger( $mySourceID )
{
// Call basic report Check function
$res = $this->CreateLogStreamTriggerByPropertyArray( $mySourceID, SYSLOG_MESSAGE, MISC_CHECKSUM );
// return results!
return $res;
}
// --- Private functions... // --- Private functions...
/** /**
@ -293,15 +331,54 @@ class Report_syslogsummary extends Report {
*/ */
private function ConsolidateSyslogmessagesPerHost( $arrHosts ) private function ConsolidateSyslogmessagesPerHost( $arrHosts )
{ {
global $content, $gl_starttime; global $content, $gl_starttime, $fields;
// Now open the stream for data processing // Now open the stream for data processing
$res = $this->_streamObj->Open( $this->_arrProperties, true ); $res = $this->_streamObj->Open( $this->_arrProperties, true );
if ( $res == SUCCESS ) if ( $res == SUCCESS )
{ {
// Set reading direction // --- New Method to consolidate data!
// $this->_streamObj->SetReadDirection( EnumReadDirection::Backward ); // TimeStats
$nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
// Update all Checksums first!
$this->_streamObj->UpdateAllMessageChecksum();
// TimeStats
$nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
foreach ( $arrHosts as $myHost )
{
// Set custom filters
$this->_streamObj->ResetFilters();
$this->_streamObj->SetFilter( $this->_filterString . " " . $fields[SYSLOG_MESSAGETYPE]['SearchField'] . ":=" . IUT_Syslog . " " . $fields[SYSLOG_HOST]['SearchField'] . ":=" . $myHost );
// Set Host Item Basics if not set yet
$content["report_consdata"][ $myHost ][SYSLOG_HOST] = $myHost;
// Get Data for single host
$content["report_consdata"][ $myHost ]['cons_msgs'] = $this->_streamObj->ConsolidateDataByField( MISC_CHECKSUM, $this->_maxMsgsPerHost, MISC_CHECKSUM, SORTING_ORDER_DESC, null, true, true );
//print_r ($fields[SYSLOG_MESSAGE]);
foreach ( $content["report_consdata"][ $myHost ]['cons_msgs'] as &$myConsData )
{
// Set Basic data entries
if (!isset( $content['filter_facility_list'][$myConsData[SYSLOG_FACILITY]] ))
$myConsData[SYSLOG_FACILITY] = SYSLOG_LOCAL0; // Set default in this case
if (!isset( $content['filter_severity_list'][$myConsData[SYSLOG_SEVERITY]] ))
$myConsData[SYSLOG_SEVERITY] = SYSLOG_NOTICE; // Set default in this case
}
}
// TimeStats
$nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
// ---
/*
// --- Old Method!
// Init uid helper // Init uid helper
$uID = UID_UNKNOWN; $uID = UID_UNKNOWN;
@ -346,15 +423,15 @@ class Report_syslogsummary extends Report {
if ( isset($content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]) ) if ( isset($content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]) )
{ {
// Increment counter and set First/Last Event date // Increment counter and set First/Last Event date
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['ItemCount']++; $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['itemcount']++;
// Set FirstEvent date if necessary! // Set FirstEvent date if necessary!
if ( $logArray[SYSLOG_DATE][EVTIME_TIMESTAMP] < $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['FirstOccurrence_Date'][EVTIME_TIMESTAMP] ) if ( $logArray[SYSLOG_DATE][EVTIME_TIMESTAMP] < $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['firstoccurrence_date'][EVTIME_TIMESTAMP] )
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['FirstOccurrence_Date'] = $logArray[SYSLOG_DATE]; $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['firstoccurrence_date'] = $logArray[SYSLOG_DATE];
// Set LastEvent date if necessary! // Set LastEvent date if necessary!
if ( $logArray[SYSLOG_DATE][EVTIME_TIMESTAMP] > $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['LastOccurrence_Date'][EVTIME_TIMESTAMP] ) if ( $logArray[SYSLOG_DATE][EVTIME_TIMESTAMP] > $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['lastoccurrence_date'][EVTIME_TIMESTAMP] )
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['LastOccurrence_Date'] = $logArray[SYSLOG_DATE]; $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['lastoccurrence_date'] = $logArray[SYSLOG_DATE];
} }
else else
{ {
@ -371,9 +448,9 @@ class Report_syslogsummary extends Report {
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ][SYSLOG_MESSAGE] = $logArray[SYSLOG_MESSAGE]; $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ][SYSLOG_MESSAGE] = $logArray[SYSLOG_MESSAGE];
// Set Counter and First/Last Event date // Set Counter and First/Last Event date
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['ItemCount'] = 1; $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['itemcount'] = 1;
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['FirstOccurrence_Date'] = $logArray[SYSLOG_DATE]; $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['firstoccurrence_date'] = $logArray[SYSLOG_DATE];
$content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['LastOccurrence_Date'] = $logArray[SYSLOG_DATE]; $content["report_consdata"][ $logArray[SYSLOG_HOST] ]['cons_msgs'][ $strChecksum ]['lastoccurrence_date'] = $logArray[SYSLOG_DATE];
} }
} }
@ -384,57 +461,59 @@ class Report_syslogsummary extends Report {
// TimeStats // TimeStats
$nowtime = microtime_float(); $nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s "; $content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
// Start Postprocessing
foreach( $content["report_consdata"] as &$tmpConsolidatedComputer )
{
// First use callback function to sort array
uasort($tmpConsolidatedComputer['cons_msgs'], "MultiSortArrayByItemCountDesc");
// Remove entries according to _maxMsgsPerHost
if ( count($tmpConsolidatedComputer['cons_msgs']) > $this->_maxMsgsPerHost )
{
$iDropCount = 0;
do
{
array_pop($tmpConsolidatedComputer['cons_msgs']);
$iDropCount++;
} while ( count($tmpConsolidatedComputer['cons_msgs']) > $this->_maxMsgsPerHost );
// Append a dummy entry which shows count of all other events
if ( $iDropCount > 0 )
{
$lastEntry[SYSLOG_SEVERITY] = SYSLOG_NOTICE;
$lastEntry[SYSLOG_FACILITY] = SYSLOG_LOCAL0;
$lastEntry[SYSLOG_SYSLOGTAG] = $content['LN_GEN_ALL_OTHER_EVENTS'];
$lastEntry[SYSLOG_MESSAGE] = $content['LN_GEN_ALL_OTHER_EVENTS'];
$lastEntry['ItemCount'] = $iDropCount;
$lastEntry['FirstOccurrence_Date'] = "-";
$lastEntry['LastOccurrence_Date'] = "-";
$tmpConsolidatedComputer['cons_msgs'][] = $lastEntry;
}
}
// TimeStats
$nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
// PostProcess Events!
foreach( $tmpConsolidatedComputer["cons_msgs"] as &$tmpMyEvent )
{
$tmpMyEvent['FirstOccurrence_Date_Formatted'] = GetFormatedDate( $tmpMyEvent['FirstOccurrence_Date'] );
$tmpMyEvent['LastOccurrence_Date_Formatted'] = GetFormatedDate( $tmpMyEvent['LastOccurrence_Date'] );
$tmpMyEvent['syslogseverity_text'] = $this->GetSeverityDisplayName($tmpMyEvent['syslogseverity']); //$content['filter_severity_list'][ $tmpMyEvent['syslogseverity'] ]["DisplayName"];
$tmpMyEvent['syslogfacility_text'] = $this->GetFacilityDisplayName($tmpMyEvent['syslogfacility']); //$content['filter_facility_list'][ $tmpMyEvent['syslogfacility'] ]["DisplayName"];
$tmpMyEvent['syslogseverity_bgcolor'] = $this->GetSeverityBGColor($tmpMyEvent['syslogseverity']);
$tmpMyEvent['syslogfacility_bgcolor'] = $this->GetSeverityBGColor($tmpMyEvent['syslogfacility']);
}
}
} }
else else
return $ret; return $ret;
*/
// --- Start Postprocessing
foreach( $content["report_consdata"] as &$tmpConsolidatedComputer )
{
// First use callback function to sort array
uasort($tmpConsolidatedComputer['cons_msgs'], "MultiSortArrayByItemCountDesc");
// Remove entries according to _maxMsgsPerHost
if ( count($tmpConsolidatedComputer['cons_msgs']) > $this->_maxMsgsPerHost )
{
$iDropCount = 0;
do
{
array_pop($tmpConsolidatedComputer['cons_msgs']);
$iDropCount++;
} while ( count($tmpConsolidatedComputer['cons_msgs']) > $this->_maxMsgsPerHost );
// Append a dummy entry which shows count of all other events
if ( $iDropCount > 0 )
{
$lastEntry[SYSLOG_SEVERITY] = SYSLOG_NOTICE;
$lastEntry[SYSLOG_FACILITY] = SYSLOG_LOCAL0;
$lastEntry[SYSLOG_SYSLOGTAG] = $content['LN_GEN_ALL_OTHER_EVENTS'];
$lastEntry[SYSLOG_MESSAGE] = $content['LN_GEN_ALL_OTHER_EVENTS'];
$lastEntry['itemcount'] = $iDropCount;
$lastEntry['firstoccurrence_date'] = "-";
$lastEntry['lastoccurrence_date'] = "-";
$tmpConsolidatedComputer['cons_msgs'][] = $lastEntry;
}
}
// TimeStats
$nowtime = microtime_float();
$content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s ";
// PostProcess Events!
foreach( $tmpConsolidatedComputer["cons_msgs"] as &$tmpMyEvent )
{
$tmpMyEvent['FirstOccurrence_Date_Formatted'] = GetFormatedDate( $tmpMyEvent['firstoccurrence_date'] );
$tmpMyEvent['LastOccurrence_Date_Formatted'] = GetFormatedDate( $tmpMyEvent['lastoccurrence_date'] );
$tmpMyEvent['syslogseverity_text'] = $this->GetSeverityDisplayName($tmpMyEvent['syslogseverity']); //$content['filter_severity_list'][ $tmpMyEvent['syslogseverity'] ]["DisplayName"];
$tmpMyEvent['syslogfacility_text'] = $this->GetFacilityDisplayName($tmpMyEvent['syslogfacility']); //$content['filter_facility_list'][ $tmpMyEvent['syslogfacility'] ]["DisplayName"];
$tmpMyEvent['syslogseverity_bgcolor'] = $this->GetSeverityBGColor($tmpMyEvent['syslogseverity']);
$tmpMyEvent['syslogfacility_bgcolor'] = $this->GetSeverityBGColor($tmpMyEvent['syslogfacility']);
}
}
// ---
} }
// Work done! // Work done!

View File

@ -57,7 +57,7 @@
<!-- BEGIN report_summary --> <!-- BEGIN report_summary -->
<tr> <tr>
<td class="cellmenu2">{DisplayName}</td> <td class="cellmenu2">{DisplayName}</td>
<td class="lineColouredWhite" bgcolor="{bgcolor}" align="right"><b>{ItemCount}</b></td> <td class="lineColouredWhite" bgcolor="{bgcolor}" align="right"><b>{itemcount}</b></td>
</tr> </tr>
<!-- END report_summary --> <!-- END report_summary -->
</table> </table>
@ -69,7 +69,7 @@
<tr> <tr>
<td class="line1"> <td class="line1">
<!-- BEGIN report_computers --> <!-- BEGIN report_computers -->
<a href="#{FROMHOST}">{FROMHOST}</a>({ItemCount}), <a href="#{FROMHOST}">{FROMHOST}</a>({itemcount}),
<!-- END report_computers --> <!-- END report_computers -->
</td> </td>
</tr> </tr>
@ -92,33 +92,32 @@
<!-- BEGIN report_consdata --> <!-- BEGIN report_consdata -->
<h3><a name="{FROMHOST}">{FROMHOST}</a></h3> <h3><a name="{FROMHOST}">{FROMHOST}</a></h3>
<table width="100%" cellpadding="0" cellspacing="1" border="0" align="center" class="with_border_alternate"> <table width="100%" cellpadding="2" cellspacing="1" border="0" align="center" class="with_border_alternate">
<tr> <tr>
<td class="cellmenu1" align="center" width="50" nowrap>{ln_report_number}</td> <td class="cellmenu1" align="center" width="50" nowrap>{ln_report_number}</td>
<td class="cellmenu1" align="center" width="50" nowrap>{ln_report_count}</td>
<td class="cellmenu1" align="center" width="100" nowrap>{ln_report_firstoccurrence}</td> <td class="cellmenu1" align="center" width="100" nowrap>{ln_report_firstoccurrence}</td>
<td class="cellmenu1" align="center" width="100" nowrap>{ln_report_lastoccurrence}</td> <td class="cellmenu1" align="center" width="100" nowrap>{ln_report_lastoccurrence}</td>
<td class="cellmenu1" align="center" width="100" nowrap>{ln_report_severity}</td> <td class="cellmenu1" align="center" width="100" nowrap>{ln_report_severity}</td>
<td class="cellmenu1" align="center" width="150" nowrap>{ln_report_facility}</td> <td class="cellmenu1" align="center" width="150" nowrap>{ln_report_facility}</td>
<td class="cellmenu1" align="center" width="80" nowrap>{ln_report_syslogtag}</td> <td class="cellmenu1" align="center" width="80" nowrap>{ln_report_syslogtag}</td>
<td class="cellmenu1" align="center" width="100%" nowrap>{ln_report_description}</td> <td class="cellmenu1" align="center" width="100%" nowrap>{ln_report_description}</td>
<td class="cellmenu1" align="center" width="50" nowrap>{ln_report_count}</td>
</tr> </tr>
<!-- BEGIN cons_msgs --> <!-- BEGIN cons_msgs -->
<tr> <tr>
<td class="line1" valign="top" align="center">{ZAEHLER}</td> <td class="line1" valign="top" align="center">{ZAEHLER}</td>
<!-- IF itemcount>=$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#990000"><b>{itemcount}</b></td>
<!-- ENDIF itemcount>=$_colorThreshold -->
<!-- IF itemcount<$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#AAAAAA"><b>{itemcount}</b></td>
<!-- ENDIF itemcount<$_colorThreshold -->
<td class="line1" valign="top" align="center">{FirstOccurrence_Date_Formatted}</td> <td class="line1" valign="top" align="center">{FirstOccurrence_Date_Formatted}</td>
<td class="line1" valign="top" align="center">{LastOccurrence_Date_Formatted}</td> <td class="line1" valign="top" align="center">{LastOccurrence_Date_Formatted}</td>
<td class="lineColouredWhite" valign="top" align="center" bgcolor="{syslogseverity_bgcolor}"><b>{syslogseverity_text}</b></td> <td class="lineColouredWhite" valign="top" align="center" bgcolor="{syslogseverity_bgcolor}"><b>{syslogseverity_text}</b></td>
<td class="lineColouredWhite" valign="top" align="center" bgcolor="{syslogfacility_bgcolor}"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=syslogfacility&q={syslogfacility_text}" target="_blank">{syslogfacility_text}</a></td> <td class="lineColouredWhite" valign="top" align="center" bgcolor="{syslogfacility_bgcolor}"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=syslogfacility&q={syslogfacility_text}" target="_blank">{syslogfacility_text}</a></td>
<td class="line1" valign="top" align="center"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=syslogtag&q={syslogtag}" target="_blank">{syslogtag}</a></td> <td class="line1" valign="top" align="center"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=syslogtag&q={syslogtag}" target="_blank">{syslogtag}</a></td>
<td class="line1" valign="top" align="left">{msg}</td> <td class="line1" valign="top" align="left">{msg}</td>
<!-- IF ItemCount>=$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#990000"><b>{ItemCount}</b></td>
<!-- ENDIF ItemCount>=$_colorThreshold -->
<!-- IF ItemCount<$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#AAAAAA"><b>{ItemCount}</b></td>
<!-- ENDIF ItemCount<$_colorThreshold -->
</tr> </tr>
<!-- END cons_msgs --> <!-- END cons_msgs -->

View File

@ -38,7 +38,7 @@
<!-- BEGIN report_summary --> <!-- BEGIN report_summary -->
<tr> <tr>
<td class="cellmenu2">{DisplayName}</td> <td class="cellmenu2">{DisplayName}</td>
<td class="lineColouredWhite" bgcolor="{bgcolor}" align="right"><b>{ItemCount}</b></td> <td class="lineColouredWhite" bgcolor="{bgcolor}" align="right"><b>{itemcount}</b></td>
</tr> </tr>
<!-- END report_summary --> <!-- END report_summary -->
</table> </table>
@ -52,7 +52,7 @@
<tr> <tr>
<td class="line1"> <td class="line1">
<!-- BEGIN report_computers --> <!-- BEGIN report_computers -->
<a href="#{FROMHOST}">{FROMHOST}</a>({ItemCount}), <a href="#{FROMHOST}">{FROMHOST}</a>({itemcount}),
<!-- END report_computers --> <!-- END report_computers -->
</td> </td>
</tr> </tr>
@ -68,27 +68,27 @@
<table width="100%" cellpadding="0" cellspacing="1" border="1" align="center" class="with_border_alternate"> <table width="100%" cellpadding="0" cellspacing="1" border="1" align="center" class="with_border_alternate">
<tr> <tr>
<td class="cellmenu1" bgcolor="#9FDAF1" align="center" width="50" nowrap>{ln_report_number}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="center" width="50" nowrap>{ln_report_number}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="center" width="50" nowrap>{ln_report_count}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_firstoccurrence}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_firstoccurrence}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_lastoccurrence}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_lastoccurrence}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_severity}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="100" nowrap>{ln_report_severity}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="50" nowrap>{ln_report_facility}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="50" nowrap>{ln_report_facility}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="50" nowrap>{ln_report_syslogtag}</td> <td class="cellmenu1" bgcolor="#9FDAF1" align="left" width="50" nowrap>{ln_report_syslogtag}</td>
<td class="cellmenu1" bgcolor="#9FDAF1" align="center" width="50" nowrap>{ln_report_count}</td>
</tr> </tr>
<!-- BEGIN cons_msgs --> <!-- BEGIN cons_msgs -->
<tr> <tr>
<td class="line1" valign="top" align="center" rowspan="2">{ZAEHLER}</td> <td class="line1" valign="top" align="center" rowspan="2">{ZAEHLER}</td>
<!-- IF itemcount>=$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#DD0000"><b>{itemcount}</b></td>
<!-- ENDIF itemcount>=$_colorThreshold -->
<!-- IF itemcount<$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#CCCCCC"><b>{itemcount}</b></td>
<!-- ENDIF itemcount<$_colorThreshold -->
<td class="line1" valign="top" align="left">{FirstOccurrence_Date_Formatted}</td> <td class="line1" valign="top" align="left">{FirstOccurrence_Date_Formatted}</td>
<td class="line1" valign="top" align="left">{LastOccurrence_Date_Formatted}</td> <td class="line1" valign="top" align="left">{LastOccurrence_Date_Formatted}</td>
<td class="line1" valign="top" align="left">{syslogseverity_text}</td> <td class="line1" valign="top" align="left">{syslogseverity_text}</td>
<td class="line1" valign="top" align="left"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=syslogfacility&q={syslogfacility_text}" target="_blank">{syslogfacility_text}</a></td> <td class="line1" valign="top" align="left"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=syslogfacility&q={syslogfacility_text}" target="_blank">{syslogfacility_text}</a></td>
<td class="line1" valign="top" align="left"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=syslogtag&q={syslogtag}" target="_blank">{syslogtag}</a></td> <td class="line1" valign="top" align="left"><a href="http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=syslogtag&q={syslogtag}" target="_blank">{syslogtag}</a></td>
<!-- IF ItemCount>=$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#DD0000"><b>{ItemCount}</b></td>
<!-- ENDIF ItemCount>=$_colorThreshold -->
<!-- IF ItemCount<$_colorThreshold -->
<td class="lineColouredWhite" valign="top" align="right" bgcolor="#CCCCCC"><b>{ItemCount}</b></td>
<!-- ENDIF ItemCount<$_colorThreshold -->
</tr> </tr>
<tr> <tr>
<td class="cellmenu1" align="center" valign="top" nowrap colspan="2" width="200">{ln_report_description}</td> <td class="cellmenu1" align="center" valign="top" nowrap colspan="2" width="200">{ln_report_description}</td>

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

View File

@ -67,5 +67,12 @@ define('ERROR_CHARTS_NOTCONFIGURED', 20);
define('ERROR_MSG_SKIPMESSAGE', 21); define('ERROR_MSG_SKIPMESSAGE', 21);
define('ERROR_MSG_SCANABORTED', 23); define('ERROR_MSG_SCANABORTED', 23);
define('ERROR_REPORT_NODATA', 25); define('ERROR_REPORT_NODATA', 25);
define('ERROR_DB_INDEXESMISSING', 26);
define('ERROR_DB_TRIGGERMISSING', 27);
define('ERROR_DB_INDEXFAILED', 28);
define('ERROR_DB_TRIGGERFAILED', 29);
define('ERROR_DB_CHECKSUMERROR', 30);
define('ERROR_DB_CHECKSUMCHANGEFAILED', 31);
define('ERROR_DB_ADDDBFIELDFAILED', 32);
?> ?>

View File

@ -66,12 +66,15 @@ $LANG_EN = "en"; // Used for fallback
$LANG = "en"; // Default language $LANG = "en"; // Default language
// Default Template vars // Default Template vars
$content['BUILDNUMBER'] = "3.2.3"; $content['BUILDNUMBER'] = "3.3.0";
$content['UPDATEURL'] = "http://loganalyzer.adiscon.com/files/version.txt"; $content['UPDATEURL'] = "http://loganalyzer.adiscon.com/files/version.txt";
$content['TITLE'] = "Adiscon LogAnalyzer :: Release " . $content['BUILDNUMBER']; // Default page title $content['TITLE'] = "Adiscon LogAnalyzer :: Release " . $content['BUILDNUMBER']; // Default page title
$content['BASEPATH'] = $gl_root_path; $content['BASEPATH'] = $gl_root_path;
$content['SHOW_DONATEBUTTON'] = true; // Default = true! $content['SHOW_DONATEBUTTON'] = true; // Default = true!
// Hardcoded DEFINES
define('URL_ONLINEREPORTS', 'http://tools.adiscon.net/listreports.php');
// PreInit overall user variables // PreInit overall user variables
$content['EXTRA_PHPLOGCON_LOGO'] = $content['BASEPATH'] . "images/main/Header-Logo.png"; $content['EXTRA_PHPLOGCON_LOGO'] = $content['BASEPATH'] . "images/main/Header-Logo.png";
$content['EXTRA_METATAGS'] = ""; $content['EXTRA_METATAGS'] = "";
@ -563,11 +566,10 @@ function CheckAndSetRunMode()
// Define and Inits Syslog variables now! // Define and Inits Syslog variables now!
// DEPRECIATED! define_syslog_variables(); // DEPRECIATED! define_syslog_variables();
// Syslog Constants are defined by default anyway! // Syslog Constants are defined by default anyway!
openlog("LogAnalyzer", LOG_PID, LOG_USER); $syslogOpened = openlog("LogAnalyzer", LOG_PID, LOG_USER);
// --- Check necessary PHP Extensions! // --- Check necessary PHP Extensions!
$loadedExtensions = get_loaded_extensions(); $loadedExtensions = get_loaded_extensions();
// Check for GD libary // Check for GD libary
if ( in_array("gd", $loadedExtensions) ) if ( in_array("gd", $loadedExtensions) )
$content['GD_IS_ENABLED'] = true; $content['GD_IS_ENABLED'] = true;
@ -578,6 +580,8 @@ function CheckAndSetRunMode()
if ( in_array("mysql", $loadedExtensions) ) { $content['MYSQL_IS_ENABLED'] = true; } else { $content['MYSQL_IS_ENABLED'] = false; } if ( in_array("mysql", $loadedExtensions) ) { $content['MYSQL_IS_ENABLED'] = true; } else { $content['MYSQL_IS_ENABLED'] = false; }
// Check PDO Extension // Check PDO Extension
if ( in_array("PDO", $loadedExtensions) ) { $content['PDO_IS_ENABLED'] = true; } else { $content['PDO_IS_ENABLED'] = false; } if ( in_array("PDO", $loadedExtensions) ) { $content['PDO_IS_ENABLED'] = true; } else { $content['PDO_IS_ENABLED'] = false; }
// Check sockets Extension
if ( in_array("sockets", $loadedExtensions) ) { $content['SOCKETS_IS_ENABLED'] = true; } else { $content['SOCKETS_IS_ENABLED'] = false; }
// --- // ---
} }
@ -733,6 +737,7 @@ function InitFrontEndVariables()
$content['MENU_WINDOWLIST'] = $content['BASEPATH'] . "images/icons/windows.png"; $content['MENU_WINDOWLIST'] = $content['BASEPATH'] . "images/icons/windows.png";
$content['MENU_CHECKED'] = $content['BASEPATH'] . "images/icons/check.png"; $content['MENU_CHECKED'] = $content['BASEPATH'] . "images/icons/check.png";
$content['MENU_PLAY_GREEN'] = $content['BASEPATH'] . "images/icons/bullet_triangle_green.png"; $content['MENU_PLAY_GREEN'] = $content['BASEPATH'] . "images/icons/bullet_triangle_green.png";
$content['MENU_PLAY_GREEN_WINDOW'] = $content['BASEPATH'] . "images/icons/table_sql_run.png";
$content['MENU_PAGER_BEGIN'] = $content['BASEPATH'] . "images/icons/media_beginning.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_PREVIOUS'] = $content['BASEPATH'] . "images/icons/media_rewind.png";
@ -1034,7 +1039,8 @@ function DieWithErrorMsg( $szerrmsg )
} }
else if ( $RUNMODE == RUNMODE_WEBSERVER ) else if ( $RUNMODE == RUNMODE_WEBSERVER )
{ {
print( // Print main error!
print (
"<html><title>Adiscon LogAnalyzer :: Critical Error occured</title><head>" . "<html><title>Adiscon LogAnalyzer :: Critical Error occured</title><head>" .
"<link rel=\"stylesheet\" href=\"" . $gl_root_path . "themes/default/main.css\" type=\"text/css\"></head><body><br><br>" . "<link rel=\"stylesheet\" href=\"" . $gl_root_path . "themes/default/main.css\" type=\"text/css\"></head><body><br><br>" .
"<table width=\"600\" align=\"center\" class=\"with_border_alternate ErrorMsg\" cellpadding=\"2\"><tr>". "<table width=\"600\" align=\"center\" class=\"with_border_alternate ErrorMsg\" cellpadding=\"2\"><tr>".
@ -1044,7 +1050,20 @@ function DieWithErrorMsg( $szerrmsg )
"<tr><td class=\"cellmenu1_naked\" align=\"left\">Errordetails:</td>" . "<tr><td class=\"cellmenu1_naked\" align=\"left\">Errordetails:</td>" .
"<td class=\"tableBackground\" align=\"left\"><br>" . "<td class=\"tableBackground\" align=\"left\"><br>" .
$szerrmsg . $szerrmsg .
"<br><br></td></tr></table>" . "<br><br></td></tr></table>");
// Print Detail error's if available
if ( isset($content['detailederror']) )
{
print ("<table width=\"600\" align=\"center\" class=\"with_border_alternate ErrorMsg\" cellpadding=\"2\"><tr>".
"<tr><td class=\"cellmenu1_naked\" align=\"left\">Additional Errordetails:</td>" .
"<td class=\"tableBackground\" align=\"left\"><br>" .
$content['detailederror'] .
"<br><br></td></tr></table>");
}
// End HTML Body
print(
"</body></html>" "</body></html>"
); );
} }
@ -1329,7 +1348,31 @@ function OutputDebugMessage($szDbg, $szDbgLevel = DEBUG_INFO)
// Check if the user wants to syslog the error! // Check if the user wants to syslog the error!
if ( GetConfigSetting("MiscDebugToSyslog", 0, CFGLEVEL_GLOBAL) == 1 ) if ( GetConfigSetting("MiscDebugToSyslog", 0, CFGLEVEL_GLOBAL) == 1 )
{ {
syslog(GetPriorityFromDebugLevel($szDbgLevel), $szDbg); if ( $content['SOCKETS_IS_ENABLED'] )
{
// Send using UDP ourself!
$sock = @socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
$stprifac = (SYSLOG_LOCAL0 << 3);
if ( $szDbgLevel == DEBUG_ERROR_WTF )
$stprifac += SYSLOG_CRIT;
else if ( $szDbgLevel == DEBUG_ERROR )
$stprifac += SYSLOG_ERR;
else if ( $szDbgLevel == DEBUG_WARN )
$stprifac += SYSLOG_WARNING;
else if ( $szDbgLevel == DEBUG_INFO )
$stprifac += SYSLOG_NOTICE;
else if ( $szDbgLevel == DEBUG_DEBUG )
$stprifac += SYSLOG_INFO;
else if ( $szDbgLevel == DEBUG_ULTRADEBUG )
$stprifac += SYSLOG_DEBUG;
// Generate RFC5424 Syslog MSG
$szsyslogmsg = "<" . $stprifac . ">" . date("c") . " " . php_uname ("n") . " " . "loganalyzer - - - " . $szDbg ;
@socket_sendto($sock, $szsyslogmsg, strlen($szsyslogmsg), 0, '127.0.0.1', 514);
@socket_close($sock);
}
else // Use PHP System function to send via syslog
$syslogSend = syslog(GetPriorityFromDebugLevel($szDbgLevel), $szDbg);
} }
} }
@ -1892,11 +1935,11 @@ function GetErrorMessage($errorCode)
function MultiSortArrayByItemCountDesc( $arrayFirst, $arraySecond ) function MultiSortArrayByItemCountDesc( $arrayFirst, $arraySecond )
{ {
// Do not sort in this case // Do not sort in this case
if ($arrayFirst['ItemCount'] == $arraySecond['ItemCount']) if ($arrayFirst['itemcount'] == $arraySecond['itemcount'])
return 0; return 0;
// Move up or down // Move up or down
return ($arrayFirst['ItemCount'] < $arraySecond['ItemCount']) ? 1 : -1; return ($arrayFirst['itemcount'] < $arraySecond['itemcount']) ? 1 : -1;
} }
/** /**
@ -1905,11 +1948,11 @@ function MultiSortArrayByItemCountDesc( $arrayFirst, $arraySecond )
function MultiSortArrayByItemCountAsc( $arrayFirst, $arraySecond ) function MultiSortArrayByItemCountAsc( $arrayFirst, $arraySecond )
{ {
// Do not sort in this case // Do not sort in this case
if ($arrayFirst['ItemCount'] == $arraySecond['ItemCount']) if ($arrayFirst['itemcount'] == $arraySecond['itemcount'])
return 0; return 0;
// Move up or down // Move up or down
return ($arrayFirst['ItemCount'] < $arraySecond['ItemCount']) ? -1 : 1; return ($arrayFirst['itemcount'] < $arraySecond['itemcount']) ? -1 : 1;
} }
// --- // ---

View File

@ -211,13 +211,14 @@ function DB_ReturnSimpleErrorMsg()
function DB_PrintError($MyErrorMsg, $DieOrNot) function DB_PrintError($MyErrorMsg, $DieOrNot)
{ {
global $n,$HTTP_COOKIE_VARS, $errdesc, $errno, $linesep; global $content, $n,$HTTP_COOKIE_VARS, $errdesc, $errno, $linesep;
$errdesc = mysql_error(); $errdesc = mysql_error();
$errno = mysql_errno(); $errno = mysql_errno();
// Define global variable so we know an error has occured! // Define global variable so we know an error has occured!
define('PHPLOGCON_INERROR', true); if ( !defined('PHPLOGCON_INERROR') )
define('PHPLOGCON_INERROR', true);
$errormsg="Database error: $MyErrorMsg $linesep"; $errormsg="Database error: $MyErrorMsg $linesep";
$errormsg.="mysql error: $errdesc $linesep"; $errormsg.="mysql error: $errdesc $linesep";
@ -229,7 +230,20 @@ function DB_PrintError($MyErrorMsg, $DieOrNot)
if ($DieOrNot == true) if ($DieOrNot == true)
DieWithErrorMsg( "$linesep" . $errormsg ); DieWithErrorMsg( "$linesep" . $errormsg );
else else
{
OutputDebugMessage("DB_PrintError: $errormsg", DEBUG_ERROR); OutputDebugMessage("DB_PrintError: $errormsg", DEBUG_ERROR);
if ( !isset($content['detailederror']) )
{
$content['detailederror_code'] = ERROR_DB_QUERYFAILED;
$content['detailederror'] = GetErrorMessage(ERROR_DB_QUERYFAILED);
}
else
$content['detailederror'] .= "<br><br>" . GetErrorMessage(ERROR_DB_QUERYFAILED);
// Append SQL Detail Error
$content['detailederror'] .= "<br><br>" . $errormsg;
}
} }
function DB_RemoveParserSpecialBadChars($myString) function DB_RemoveParserSpecialBadChars($myString)

View File

@ -213,23 +213,32 @@ function GetFormatedDate($evttimearray)
{ {
global $content; global $content;
if ( !is_array($evttimearray) ) if ( is_array($evttimearray) )
return $evttimearray;
if (
GetConfigSetting("ViewUseTodayYesterday", 0, CFGLEVEL_USER) == 1
&&
( date('m', $evttimearray[EVTIME_TIMESTAMP]) == date('m') && date('Y', $evttimearray[EVTIME_TIMESTAMP]) == date('Y') )
)
{ {
if ( date('d', $evttimearray[EVTIME_TIMESTAMP]) == date('d') ) if (
return "Today " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] ); GetConfigSetting("ViewUseTodayYesterday", 0, CFGLEVEL_USER) == 1
else if ( date('d', $evttimearray[EVTIME_TIMESTAMP] + 86400) == date('d') ) &&
return "Yesterday " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] ); ( date('m', $evttimearray[EVTIME_TIMESTAMP]) == date('m') && date('Y', $evttimearray[EVTIME_TIMESTAMP]) == date('Y') )
)
{
if ( date('d', $evttimearray[EVTIME_TIMESTAMP]) == date('d') )
return "Today " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] );
else if ( date('d', $evttimearray[EVTIME_TIMESTAMP] + 86400) == date('d') )
return "Yesterday " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] );
}
// Copy to local variable
$nMyTimeStamp = $evttimearray[EVTIME_TIMESTAMP];
}
else
{
$nMyTimeStamp = strtotime($evttimearray);
if ( $nMyTimeStamp === FALSE ) // Could not convert into timestamp so return original!
return $evttimearray;
} }
// Reach return normal format! // Reach return normal format!
return $szDateFormatted = date("Y-m-d H:i:s", $evttimearray[EVTIME_TIMESTAMP] ); return $szDateFormatted = date("Y-m-d H:i:s", $nMyTimeStamp );
} }
function GetDebugBgColor( $szDebugMode ) function GetDebugBgColor( $szDebugMode )

View File

@ -0,0 +1,264 @@
<?php
/*
*********************************************************************
* LogAnalyzer - http://loganalyzer.adiscon.com
* ----------------------------------------------------------------- *
* Report Helper functions *
* *
* -> *
* *
* All directives are explained within this file *
*
* Copyright (C) 2008-2011 Adiscon GmbH.
*
* This file is part of LogAnalyzer.
*
* LogAnalyzer 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.
*
* LogAnalyzer 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 LogAnalyzer. 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;
}
// ---
// ---
// --- BEGIN Helper functions
// ---
function CreateCronCommand( $myReportID, $mySavedReportID = null )
{
global $content, $gl_root_path, $myReport;
if ( isset($mySavedReportID) )
{
// Get Reference to report!
$myReport = $content['REPORTS'][ $myReportID ];
// Get reference to savedreport
$mySavedReport = $myReport['SAVEDREPORTS'][ $mySavedReportID ];
// Get configured Source for savedreport
$myReportSource = null;
if ( isset($content['Sources'][ $mySavedReport['sourceid'] ]) )
$myReportSource = $content['Sources'][ $mySavedReport['sourceid'] ];
$pos = strpos( strtoupper(PHP_OS), "WIN");
if ($pos !== false)
{
// Running on Windows
$phpCmd = PHP_BINDIR . "\\php.exe";
$phpScript = realpath($gl_root_path) . "cron\\cmdreportgen.php";
}
else
{
// Running on LINUX
$phpCmd = PHP_BINDIR . "/php";
$phpScript = realpath($gl_root_path) . "/cron/cmdreportgen.php";
}
// Enable display of report command
$content['enableCronCommand'] = true;
$szCommand = $phpCmd . " " . $phpScript . " runreport " . $myReportID . " " . $mySavedReportID;
// --- Check for user or group sources
if ( $myReportSource['userid'] != null )
{
$szCommand .= " " . "userid=" . $myReportSource['userid'];
}
else if ( $myReportSource['groupid'] != null )
{
$szCommand .= " " . "groupid=" . $myReportSource['groupid'];
}
// ---
}
else
{
// Disable display of report command
$content['enableCronCommand'] = false;
$szCommand = "";
}
// return result
return $szCommand;
}
function InitOnlineReports()
{
global $content;
$xmlArray = xml2array( URL_ONLINEREPORTS );
if ( is_array($xmlArray) && isset($xmlArray['reports']['report']) && count($xmlArray['reports']['report']) > 0 )
{
foreach( $xmlArray['reports']['report'] as $myOnlineReport )
{
// Copy to OnlineReports Array
$content['ONLINEREPORTS'][] = $myOnlineReport;
}
// Success!
return true;
}
else
// Failure
return false;
}
// Helper function from php doc
function xml2array($url, $get_attributes = 1, $priority = 'tag')
{
$contents = "";
if (!function_exists('xml_parser_create'))
{
return false;
}
$parser = xml_parser_create('');
if (!($fp = @ fopen($url, 'rb')))
{
return false;
}
while (!feof($fp))
{
$contents .= fread($fp, 8192);
}
fclose($fp);
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8");
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, trim($contents), $xml_values);
xml_parser_free($parser);
if (!$xml_values)
return; //Hmm...
$xml_array = array ();
$parents = array ();
$opened_tags = array ();
$arr = array ();
$current = & $xml_array;
$repeated_tag_index = array ();
foreach ($xml_values as $data)
{
unset ($attributes, $value);
extract($data);
$result = array ();
$attributes_data = array ();
if (isset ($value))
{
if ($priority == 'tag')
$result = $value;
else
$result['value'] = $value;
}
if (isset ($attributes) and $get_attributes)
{
foreach ($attributes as $attr => $val)
{
if ($priority == 'tag')
$attributes_data[$attr] = $val;
else
$result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr'
}
}
if ($type == "open")
{
$parent[$level -1] = & $current;
if (!is_array($current) or (!in_array($tag, array_keys($current))))
{
$current[$tag] = $result;
if ($attributes_data)
$current[$tag . '_attr'] = $attributes_data;
$repeated_tag_index[$tag . '_' . $level] = 1;
$current = & $current[$tag];
}
else
{
if (isset ($current[$tag][0]))
{
$current[$tag][$repeated_tag_index[$tag . '_' . $level]] = $result;
$repeated_tag_index[$tag . '_' . $level]++;
}
else
{
$current[$tag] = array (
$current[$tag],
$result
);
$repeated_tag_index[$tag . '_' . $level] = 2;
if (isset ($current[$tag . '_attr']))
{
$current[$tag]['0_attr'] = $current[$tag . '_attr'];
unset ($current[$tag . '_attr']);
}
}
$last_item_index = $repeated_tag_index[$tag . '_' . $level] - 1;
$current = & $current[$tag][$last_item_index];
}
}
elseif ($type == "complete")
{
if (!isset ($current[$tag]))
{
$current[$tag] = $result;
$repeated_tag_index[$tag . '_' . $level] = 1;
if ($priority == 'tag' and $attributes_data)
$current[$tag . '_attr'] = $attributes_data;
}
else
{
if (isset ($current[$tag][0]) and is_array($current[$tag]))
{
$current[$tag][$repeated_tag_index[$tag . '_' . $level]] = $result;
if ($priority == 'tag' and $get_attributes and $attributes_data)
{
$current[$tag][$repeated_tag_index[$tag . '_' . $level] . '_attr'] = $attributes_data;
}
$repeated_tag_index[$tag . '_' . $level]++;
}
else
{
$current[$tag] = array (
$current[$tag],
$result
);
$repeated_tag_index[$tag . '_' . $level] = 1;
if ($priority == 'tag' and $get_attributes)
{
if (isset ($current[$tag . '_attr']))
{
$current[$tag]['0_attr'] = $current[$tag . '_attr'];
unset ($current[$tag . '_attr']);
}
if ($attributes_data)
{
$current[$tag][$repeated_tag_index[$tag . '_' . $level] . '_attr'] = $attributes_data;
}
}
$repeated_tag_index[$tag . '_' . $level]++; //0 and 1 index is already taken
}
}
}
elseif ($type == 'close')
{
$current = & $parent[$level -1];
}
}
return ($xml_array);
}
?>

View File

@ -395,14 +395,8 @@ $content['LN_CMD_'] = "";
// Report Options // Report Options
$content['LN_REPORTS_EDIT'] = "Edit Report"; $content['LN_REPORTS_EDIT'] = "Edit Report";
$content['LN_REPORTS_DELETE'] = "Remove Report"; $content['LN_REPORTS_DELETE'] = "Remove Report";
$content['LN_REPORTS_CAT'] = "Report Category";
$content['LN_REPORTS_ID'] = "Report ID";
$content['LN_REPORTS_NAME'] = "Report Name";
$content['LN_REPORTS_DESCRIPTION'] = "Report Description";
$content['LN_REPORTS_REQUIREDFIELDS'] = "Required Fields"; $content['LN_REPORTS_REQUIREDFIELDS'] = "Required Fields";
$content['LN_REPORTS_ERROR_NOREPORTS'] = "There were no valid reports found in your installation."; $content['LN_REPORTS_ERROR_NOREPORTS'] = "There were no valid reports found in your installation.";
$content['LN_REPORTS_HELP'] = "Help";
$content['LN_REPORTS_HELP_CLICK'] = "Click here for a detailed report description";
$content['LN_REPORTS_INFO'] = "Show more Information"; $content['LN_REPORTS_INFO'] = "Show more Information";
$content['LN_REPORTS_INIT'] = "Initialize settings"; $content['LN_REPORTS_INIT'] = "Initialize settings";
$content['LN_REPORTS_REMOVE'] = "Remove settings"; $content['LN_REPORTS_REMOVE'] = "Remove settings";
@ -414,8 +408,6 @@ $content['LN_REPORTS_ERROR_HASBEENREMOVED'] = "All settings for the report '%1'
$content['LN_REPORTS_ERROR_HASBEENADDED'] = "All required settings for the report '%1' have been added."; $content['LN_REPORTS_ERROR_HASBEENADDED'] = "All required settings for the report '%1' have been added.";
$content['LN_REPORTS_ERROR_NOFIELDS'] = "The report '%1' does not have any custom settings which can be added."; $content['LN_REPORTS_ERROR_NOFIELDS'] = "The report '%1' does not have any custom settings which can be added.";
$content['LN_REPORTS_ERROR_REPORTDOESNTNEEDTOBEREMOVED'] = "The report '%1' does not need to be removed or initialized."; $content['LN_REPORTS_ERROR_REPORTDOESNTNEEDTOBEREMOVED'] = "The report '%1' does not need to be removed or initialized.";
$content['LN_REPORTS_ADDSAVEDREPORT'] = "Add Savedreport";
$content['LN_REPORTS_EDITSAVEDREPORT'] = "Edit Savedreport";
$content['LN_REPORTS_REMOVESAVEDREPORT'] = "Remove Savedreport"; $content['LN_REPORTS_REMOVESAVEDREPORT'] = "Remove Savedreport";
$content['LN_REPORTS_CUSTOMTITLE'] = "Report Title"; $content['LN_REPORTS_CUSTOMTITLE'] = "Report Title";
$content['LN_REPORTS_CUSTOMCOMMENT'] = "Comment / Description"; $content['LN_REPORTS_CUSTOMCOMMENT'] = "Comment / Description";
@ -427,7 +419,6 @@ $content['LN_REPORTS_HASBEENEDIT'] = "The Savedreport '%1' has been successfully
$content['LN_REPORTS_SOURCEID'] = "Logstream source"; $content['LN_REPORTS_SOURCEID'] = "Logstream source";
$content['LN_REPORTS_ERROR_SAVEDREPORTIDNOTFOUND'] = "There was no savedreport with ID '%1' found."; $content['LN_REPORTS_ERROR_SAVEDREPORTIDNOTFOUND'] = "There was no savedreport with ID '%1' found.";
$content['LN_REPORTS_ERROR_INVALIDSAVEDREPORTID'] = "Invalid savedreport id."; $content['LN_REPORTS_ERROR_INVALIDSAVEDREPORTID'] = "Invalid savedreport id.";
$content['LN_REPORTS_SAVEDREPORTS'] = "Saved reports";
$content['LN_REPORTS_RUNNOW'] = "Run saved report now!"; $content['LN_REPORTS_RUNNOW'] = "Run saved report now!";
$content['LN_REPORTS_WARNDELETESAVEDREPORT'] = "Are you sure that you want to delete the savedreport '%1'?"; $content['LN_REPORTS_WARNDELETESAVEDREPORT'] = "Are you sure that you want to delete the savedreport '%1'?";
$content['LN_REPORTS_ERROR_DELSAVEDREPORT'] = "Deleting of the savedreport with id '%1' failed!"; $content['LN_REPORTS_ERROR_DELSAVEDREPORT'] = "Deleting of the savedreport with id '%1' failed!";
@ -447,16 +438,36 @@ $content['LN_REPORTS_ADVANCEDFILTERLIST'] = "List of advanced report filters";
$content['LN_REPORTS_OUTPUTTARGET_DETAILS'] = "Outputtarget Options"; $content['LN_REPORTS_OUTPUTTARGET_DETAILS'] = "Outputtarget Options";
$content['LN_REPORTS_OUTPUTTARGET_FILE'] = "Output Path and Filename"; $content['LN_REPORTS_OUTPUTTARGET_FILE'] = "Output Path and Filename";
$content['LN_REPORTS_CRONCMD'] = "Local Report command"; $content['LN_REPORTS_CRONCMD'] = "Local Report command";
$content['LN_REPORTMENU_LIST'] = "List installed Reports";
$content['LN_REPORTMENU_ONLINELIST'] = "All Available Reports";
$content['LN_REPORTS_LINKS'] = "Related Links"; $content['LN_REPORTS_LINKS'] = "Related Links";
$content['LN_REPORTS_INSTALLED'] = "Installed"; $content['LN_REPORTS_INSTALLED'] = "Installed";
$content['LN_REPORTS_NOTINSTALLED'] = "Not installed"; $content['LN_REPORTS_NOTINSTALLED'] = "Not installed";
$content['LN_REPORTS_DOWNLOAD'] = "Download Link"; $content['LN_REPORTS_DOWNLOAD'] = "Download Link";
$content['LN_REPORTS_SAMPLELINK'] = "Report Sample"; $content['LN_REPORTS_SAMPLELINK'] = "Report Sample";
$content['LN_REPORTS_DETAILSFOR'] = "Details for '%1' report"; $content['LN_REPORTS_DETAILSFOR'] = "Details for '%1' report";
$content['LN_REPORTS_'] = ""; $content['LN_REPORTS_PERFORMANCE_WARNING'] = "Logstream Performance Warning";
$content['LN_REPORTS_'] = ""; $content['LN_REPORTS_OPTIMIZE_LOGSTREAMSOURCE'] = "Yes, optimize logstream source!";
$content['LN_REPORTS_OPTIMIZE_INDEXES'] = "The datasource '%1' is not optimized for this report. There is at least one INDEX missing. Creating INDEXES will speedup the report generation. <br><br>Do you want LogAnalyzer to create the necessary INDEXES now? This may take more then a few minutes, so please be patient!";
$content['LN_REPORTS_ERROR_FAILED_CREATE_INDEXES'] = "Failed to create INDEXES for datasource '%1' with error code '%2'";
$content['LN_REPORTS_INDEX_CREATED'] = "Logstream INDEXES created";
$content['LN_REPORTS_INDEX_CREATED_SUCCESS'] = "Successfully created all INDEXES for datasource '%1'.";
$content['LN_REPORTS_OPTIMIZE_TRIGGER'] = "The datasource '%1' does not have a TRIGGER installed to automatically generate the message checksum on INSERT. Creating the TRIGGER will speedup the report generation. <br><br>Do you want LogAnalyzer to create the TRIGGER now? ";
$content['LN_REPORTS_TRIGGER_CREATED'] = "Logstream TRIGGER created";
$content['LN_REPORTS_TRIGGER_CREATED_SUCCESS'] = "Successfully created TRIGGER for datasource '%1'.";
$content['LN_REPORTS_ERROR_FAILED_CREATE_TRIGGER'] = "Failed to create TRIGGER for datasource '%1' with error code '%2'";
$content['LN_REPORTS_CHANGE_CHECKSUM'] = "The Checksum field for datasource '%1' is not set to UNSIGNED INT. To get the report work properly, changing the CHECKSUM field to UNSIGNED INT is necessary! <br><br>Do you want LogAnalyzer to change the CHECKSUM field now? This may take more then a few minutes, so please be patient!";
$content['LN_REPORTS_ERROR_FAILED_CHANGE_CHECKSUM'] = "Failed to change the CHECKSUM field for datasource '%1' with error code '%2'";
$content['LN_REPORTS_CHECKSUM_CHANGED'] = "Checksum field changed";
$content['LN_REPORTS_CHECKSUM_CHANGED_SUCCESS'] = "Successfully changed the Checksum field for datasource '%1'.";
$content['LN_REPORTS_LOGSTREAM_WARNING'] = "Logstream Warning";
$content['LN_REPORTS_ADD_MISSINGFIELDS'] = "The datasource '%1' does not contain all necessary datafields There is at least one FIELD missing. <br><br>Do you want LogAnalyzer to create the missing datafields now?";
$content['LN_REPORTS_ERROR_FAILED_ADDING_FIELDS'] = "Failed adding missing datafields in datasource '%1' with error code '%2'";
$content['LN_REPORTS_FIELDS_CREATED'] = "Added missing datafields";
$content['LN_REPORTS_FIELDS_CREATED_SUCCESS'] = "Successfully added missing datafields for datasource '%1'.";
$content['LN_REPORTS_RECHECKLOGSTREAMSOURCE'] = "Do you want to check the current logstream source again?";
$content['LN_REPORTS_ADDSAVEDREPORT'] = "Add Savedreport and save changes";
$content['LN_REPORTS_EDITSAVEDREPORT'] = "Save changes";
$content['LN_REPORTS_ADDSAVEDREPORTANDRETURN'] = "Add Savedreport and return to reportlist";
$content['LN_REPORTS_EDITSAVEDREPORTANDRETURN'] = "Save changes and return to reportlist";
$content['LN_REPORTS_'] = ""; $content['LN_REPORTS_'] = "";
?> ?>

View File

@ -328,28 +328,46 @@ $content['LN_ORACLE_FIELD'] = "Feld";
$content['LN_ORACLE_ONLINESEARCH'] = "Online Suche"; $content['LN_ORACLE_ONLINESEARCH'] = "Online Suche";
$content['LN_ORACLE_WHOIS'] = "WHOIS Abfrage f&uuml;r '%1' - '%2'"; $content['LN_ORACLE_WHOIS'] = "WHOIS Abfrage f&uuml;r '%1' - '%2'";
$content['LN_GEN_ERROR_INVALIDOP'] = "Invalid or missing operation type"; $content['LN_GEN_ERROR_INVALIDOP'] = "Invalid or missing operation type";
$content['LN_GEN_ERROR_INVALIDREPORTID'] = "Invalid or missing report id"; $content['LN_GEN_ERROR_INVALIDREPORTID'] = "Invalid or missing report id";
$content['LN_GEN_ERROR_MISSINGSAVEDREPORTID'] = "Invalid or missing savedreport id"; $content['LN_GEN_ERROR_MISSINGSAVEDREPORTID'] = "Invalid or missing savedreport id";
$content['LN_GEN_ERROR_REPORTGENFAILED'] = "Failed generating report '%1' with the following error reason: %2"; $content['LN_GEN_ERROR_REPORTGENFAILED'] = "Failed generating report '%1' with the following error reason: %2";
$content['LN_GEN_ERROR_WHILEREPORTGEN'] = "Error occured while generating report"; $content['LN_GEN_ERROR_WHILEREPORTGEN'] = "Error occured while generating report";
$content['LN_GEN_ERROR_REPORT_NODATA'] = "No data found for report generation"; $content['LN_GEN_ERROR_REPORT_NODATA'] = "No data found for report generation";
$content['LN_GEN_ALL_OTHER_EVENTS'] = "All other events"; $content['LN_GEN_ALL_OTHER_EVENTS'] = "All other events";
$content['LN_REPORT_FOOTER_ENDERED'] = "Report rendered in"; $content['LN_REPORT_FOOTER_ENDERED'] = "Report rendered in";
$content['LN_REPORT_FILTERS'] = "List of used filters"; $content['LN_REPORT_FILTERS'] = "List of used filters";
$content['LN_REPORT_FILTERTYPE_DATE'] = "Date"; $content['LN_REPORT_FILTERTYPE_DATE'] = "Date";
$content['LN_REPORT_FILTERTYPE_NUMBER'] = "Number"; $content['LN_REPORT_FILTERTYPE_NUMBER'] = "Number";
$content['LN_REPORT_FILTERTYPE_STRING'] = "String"; $content['LN_REPORT_FILTERTYPE_STRING'] = "String";
$content['LN_GEN_SUCCESS_WHILEREPORTGEN'] = "Report was successfully generated"; $content['LN_GEN_SUCCESS_WHILEREPORTGEN'] = "Report was successfully generated";
$content['LN_GEN_ERROR_REPORTFAILEDTOGENERATE'] = "Failed to generate report, error details: %1"; $content['LN_GEN_ERROR_REPORTFAILEDTOGENERATE'] = "Failed to generate report, error details: %1";
$content['LN_GEN_SUCCESS_REPORTWASGENERATED_DETAILS'] = "Successfully generated report: %1"; $content['LN_GEN_SUCCESS_REPORTWASGENERATED_DETAILS'] = "Successfully generated report: %1";
$content['LN_CMD_RUNREPORT'] = "Generating saved report '%1'"; $content['LN_CMD_RUNREPORT'] = "Generating saved report '%1'";
$content['LN_CMD_REPORTIDNOTFOUND'] = "Invalid Report ID '%1'"; $content['LN_CMD_REPORTIDNOTFOUND'] = "Invalid Report ID '%1'";
$content['LN_CMD_SAVEDREPORTIDNOTFOUND'] = "Invalid SavedReport ID '%1'"; $content['LN_CMD_SAVEDREPORTIDNOTFOUND'] = "Invalid SavedReport ID '%1'";
$content['LN_CMD_NOREPORTID'] = "Missing Report ID"; $content['LN_CMD_NOREPORTID'] = "Missing Report ID";
$content['LN_CMD_NOSAVEDREPORTID'] = "Missing SavedReport ID"; $content['LN_CMD_NOSAVEDREPORTID'] = "Missing SavedReport ID";
$content['LN_CMD_NOCMDPROMPT'] = "Error, this script can only be run from the command prompt."; $content['LN_CMD_NOCMDPROMPT'] = "Error, this script can only be run from the command prompt.";
$content['LN_REPORT_GENERATEDTIME'] = "Report generated at: "; $content['LN_REPORT_GENERATEDTIME'] = "Report generated at: ";
$content['LN_REPORT_ACTIONS'] = "Run Report Actions";
$content['LN_REPORTS_CAT'] = "Report Category";
$content['LN_REPORTS_ID'] = "Report ID";
$content['LN_REPORTS_NAME'] = "Report Name";
$content['LN_REPORTS_DESCRIPTION'] = "Report Description";
$content['LN_REPORTS_HELP'] = "Help";
$content['LN_REPORTS_HELP_CLICK'] = "Click here for a detailed report description";
$content['LN_REPORTS_INFO'] = "Show more Information";
$content['LN_REPORTS_SAVEDREPORTS'] = "Saved reports";
$content['LN_REPORTS_ADMIN'] = "Administrate Reports";
$content['LN_REPORTMENU_LIST'] = "List installed Reports";
$content['LN_REPORTMENU_ONLINELIST'] = "All Available Reports";
$content['LN_REPORTS_INFORMATION'] = "This page shows a list of installed and available reports including saved report configurations.
<br/>To run a report, click on the buttons right to the Saved Reports.
<br/>Attention! Generating reports can be very time consuming depending on the size of your database.
";
$content['LN_REPORTS_CHECKLOGSTREAMSOURCE'] = "Verify Logstream optimization";
?> ?>

View File

@ -407,15 +407,8 @@ $content['LN_CMD_'] = "";
// Report Options // Report Options
$content['LN_REPORTS_EDIT'] = "Edit Report"; $content['LN_REPORTS_EDIT'] = "Edit Report";
$content['LN_REPORTS_DELETE'] = "Remove Report"; $content['LN_REPORTS_DELETE'] = "Remove Report";
$content['LN_REPORTS_CAT'] = "Report Category";
$content['LN_REPORTS_ID'] = "Report ID";
$content['LN_REPORTS_NAME'] = "Report Name";
$content['LN_REPORTS_DESCRIPTION'] = "Report Description";
$content['LN_REPORTS_REQUIREDFIELDS'] = "Required Fields"; $content['LN_REPORTS_REQUIREDFIELDS'] = "Required Fields";
$content['LN_REPORTS_ERROR_NOREPORTS'] = "There were no valid reports found in your installation."; $content['LN_REPORTS_ERROR_NOREPORTS'] = "There were no valid reports found in your installation.";
$content['LN_REPORTS_HELP'] = "Help";
$content['LN_REPORTS_HELP_CLICK'] = "Click here for a detailed report description";
$content['LN_REPORTS_INFO'] = "Show more Information";
$content['LN_REPORTS_INIT'] = "Initialize settings"; $content['LN_REPORTS_INIT'] = "Initialize settings";
$content['LN_REPORTS_REMOVE'] = "Remove settings"; $content['LN_REPORTS_REMOVE'] = "Remove settings";
$content['LN_REPORTS_ERROR_IDNOTFOUND'] = "There was no report with ID '%1' found."; $content['LN_REPORTS_ERROR_IDNOTFOUND'] = "There was no report with ID '%1' found.";
@ -426,8 +419,6 @@ $content['LN_REPORTS_ERROR_HASBEENREMOVED'] = "All settings for the report '%1'
$content['LN_REPORTS_ERROR_HASBEENADDED'] = "All required settings for the report '%1' have been added."; $content['LN_REPORTS_ERROR_HASBEENADDED'] = "All required settings for the report '%1' have been added.";
$content['LN_REPORTS_ERROR_NOFIELDS'] = "The report '%1' does not have any custom settings which can be added."; $content['LN_REPORTS_ERROR_NOFIELDS'] = "The report '%1' does not have any custom settings which can be added.";
$content['LN_REPORTS_ERROR_REPORTDOESNTNEEDTOBEREMOVED'] = "The report '%1' does not need to be removed or initialized."; $content['LN_REPORTS_ERROR_REPORTDOESNTNEEDTOBEREMOVED'] = "The report '%1' does not need to be removed or initialized.";
$content['LN_REPORTS_ADDSAVEDREPORT'] = "Add Savedreport";
$content['LN_REPORTS_EDITSAVEDREPORT'] = "Edit Savedreport";
$content['LN_REPORTS_REMOVESAVEDREPORT'] = "Remove Savedreport"; $content['LN_REPORTS_REMOVESAVEDREPORT'] = "Remove Savedreport";
$content['LN_REPORTS_CUSTOMTITLE'] = "Report Title"; $content['LN_REPORTS_CUSTOMTITLE'] = "Report Title";
$content['LN_REPORTS_CUSTOMCOMMENT'] = "Comment / Description"; $content['LN_REPORTS_CUSTOMCOMMENT'] = "Comment / Description";
@ -439,7 +430,6 @@ $content['LN_REPORTS_HASBEENEDIT'] = "The Savedreport '%1' has been successfully
$content['LN_REPORTS_SOURCEID'] = "Logstream source"; $content['LN_REPORTS_SOURCEID'] = "Logstream source";
$content['LN_REPORTS_ERROR_SAVEDREPORTIDNOTFOUND'] = "There was no savedreport with ID '%1' found."; $content['LN_REPORTS_ERROR_SAVEDREPORTIDNOTFOUND'] = "There was no savedreport with ID '%1' found.";
$content['LN_REPORTS_ERROR_INVALIDSAVEDREPORTID'] = "Invalid savedreport id."; $content['LN_REPORTS_ERROR_INVALIDSAVEDREPORTID'] = "Invalid savedreport id.";
$content['LN_REPORTS_SAVEDREPORTS'] = "Saved reports";
$content['LN_REPORTS_RUNNOW'] = "Run saved report now!"; $content['LN_REPORTS_RUNNOW'] = "Run saved report now!";
$content['LN_REPORTS_WARNDELETESAVEDREPORT'] = "Are you sure that you want to delete the savedreport '%1'?"; $content['LN_REPORTS_WARNDELETESAVEDREPORT'] = "Are you sure that you want to delete the savedreport '%1'?";
$content['LN_REPORTS_ERROR_DELSAVEDREPORT'] = "Deleting of the savedreport with id '%1' failed!"; $content['LN_REPORTS_ERROR_DELSAVEDREPORT'] = "Deleting of the savedreport with id '%1' failed!";
@ -459,16 +449,37 @@ $content['LN_REPORTS_ADVANCEDFILTERLIST'] = "List of advanced report filters";
$content['LN_REPORTS_OUTPUTTARGET_DETAILS'] = "Outputtarget Options"; $content['LN_REPORTS_OUTPUTTARGET_DETAILS'] = "Outputtarget Options";
$content['LN_REPORTS_OUTPUTTARGET_FILE'] = "Output Path and Filename"; $content['LN_REPORTS_OUTPUTTARGET_FILE'] = "Output Path and Filename";
$content['LN_REPORTS_CRONCMD'] = "Local Report command"; $content['LN_REPORTS_CRONCMD'] = "Local Report command";
$content['LN_REPORTMENU_LIST'] = "List installed Reports";
$content['LN_REPORTMENU_ONLINELIST'] = "All Available Reports";
$content['LN_REPORTS_LINKS'] = "Related Links"; $content['LN_REPORTS_LINKS'] = "Related Links";
$content['LN_REPORTS_INSTALLED'] = "Installed"; $content['LN_REPORTS_INSTALLED'] = "Installed";
$content['LN_REPORTS_NOTINSTALLED'] = "Not installed"; $content['LN_REPORTS_NOTINSTALLED'] = "Not installed";
$content['LN_REPORTS_DOWNLOAD'] = "Download Link"; $content['LN_REPORTS_DOWNLOAD'] = "Download Link";
$content['LN_REPORTS_SAMPLELINK'] = "Report Sample"; $content['LN_REPORTS_SAMPLELINK'] = "Report Sample";
$content['LN_REPORTS_DETAILSFOR'] = "Details for '%1' report"; $content['LN_REPORTS_DETAILSFOR'] = "Details for '%1' report";
$content['LN_REPORTS_'] = ""; $content['LN_REPORTS_PERFORMANCE_WARNING'] = "Logstream Performance Warning";
$content['LN_REPORTS_'] = ""; $content['LN_REPORTS_OPTIMIZE_LOGSTREAMSOURCE'] = "Yes, optimize logstream source!";
$content['LN_REPORTS_OPTIMIZE_INDEXES'] = "The datasource '%1' is not optimized for this report. There is at least one INDEX missing. Creating INDEXES will speedup the report generation. <br><br>Do you want LogAnalyzer to create the necessary INDEXES now? This may take more then a few minutes, so please be patient!";
$content['LN_REPORTS_ERROR_FAILED_CREATE_INDEXES'] = "Failed to create INDEXES for datasource '%1' with error code '%2'";
$content['LN_REPORTS_INDEX_CREATED'] = "Logstream INDEXES created";
$content['LN_REPORTS_INDEX_CREATED_SUCCESS'] = "Successfully created all INDEXES for datasource '%1'.";
$content['LN_REPORTS_OPTIMIZE_TRIGGER'] = "The datasource '%1' does not have a TRIGGER installed to automatically generate the message checksum on INSERT. Creating the TRIGGER will speedup the report generation. <br><br>Do you want LogAnalyzer to create the TRIGGER now? ";
$content['LN_REPORTS_TRIGGER_CREATED'] = "Logstream TRIGGER created";
$content['LN_REPORTS_TRIGGER_CREATED_SUCCESS'] = "Successfully created TRIGGER for datasource '%1'.";
$content['LN_REPORTS_ERROR_FAILED_CREATE_TRIGGER'] = "Failed to create TRIGGER for datasource '%1' with error code '%2'";
$content['LN_REPORTS_CHANGE_CHECKSUM'] = "The Checksum field for datasource '%1' is not set to UNSIGNED INT. To get the report work properly, changing the CHECKSUM field to UNSIGNED INT is necessary! <br><br>Do you want LogAnalyzer to change the CHECKSUM field now? This may take more then a few minutes, so please be patient!";
$content['LN_REPORTS_ERROR_FAILED_CHANGE_CHECKSUM'] = "Failed to change the CHECKSUM field for datasource '%1' with error code '%2'";
$content['LN_REPORTS_CHECKSUM_CHANGED'] = "Checksum field changed";
$content['LN_REPORTS_CHECKSUM_CHANGED_SUCCESS'] = "Successfully changed the Checksum field for datasource '%1'.";
$content['LN_REPORTS_LOGSTREAM_WARNING'] = "Logstream Warning";
$content['LN_REPORTS_ADD_MISSINGFIELDS'] = "The datasource '%1' does not contain all necessary datafields There is at least one FIELD missing. <br><br>Do you want LogAnalyzer to create the missing datafields now?";
$content['LN_REPORTS_ERROR_FAILED_ADDING_FIELDS'] = "Failed adding missing datafields in datasource '%1' with error code '%2'";
$content['LN_REPORTS_FIELDS_CREATED'] = "Added missing datafields";
$content['LN_REPORTS_FIELDS_CREATED_SUCCESS'] = "Successfully added missing datafields for datasource '%1'.";
$content['LN_REPORTS_RECHECKLOGSTREAMSOURCE'] = "Do you want to check the current logstream source again?";
$content['LN_REPORTS_ADDSAVEDREPORT'] = "Add Savedreport and save changes";
$content['LN_REPORTS_EDITSAVEDREPORT'] = "Save changes";
$content['LN_REPORTS_ADDSAVEDREPORTANDRETURN'] = "Add Savedreport and return to reportlist";
$content['LN_REPORTS_EDITSAVEDREPORTANDRETURN'] = "Save changes and return to reportlist";
$content['LN_REPORTS_'] = ""; $content['LN_REPORTS_'] = "";
?> ?>

View File

@ -124,9 +124,9 @@ $content['LN_MENU_LOGOFF'] = "Logoff";
$content['LN_MENU_LOGGEDINAS'] = "Logged in as"; $content['LN_MENU_LOGGEDINAS'] = "Logged in as";
$content['LN_MENU_MAXVIEW'] = "Maximize View"; $content['LN_MENU_MAXVIEW'] = "Maximize View";
$content['LN_MENU_NORMALVIEW'] = "Normalize View"; $content['LN_MENU_NORMALVIEW'] = "Normalize View";
$content['LN_MENU_STATISTICS'] = "Statistics"; $content['LN_MENU_STATISTICS'] = "Statistics";
$content['LN_MENU_CLICKTOEXPANDMENU'] = "Click the icon to show the menu"; $content['LN_MENU_CLICKTOEXPANDMENU'] = "Click the icon to show the menu";
$content['LN_MENU_REPORTS'] = "Reports";
// Main Index Site // Main Index Site
$content['LN_ERROR_INSTALLFILEREMINDER'] = "Warning! You still have NOT removed the 'install.php' from your LogAnalyzer main directory!"; $content['LN_ERROR_INSTALLFILEREMINDER'] = "Warning! You still have NOT removed the 'install.php' from your LogAnalyzer main directory!";
@ -339,6 +339,7 @@ $content['LN_ORACLE_FIELD'] = "Field";
$content['LN_ORACLE_ONLINESEARCH'] = "Online Search"; $content['LN_ORACLE_ONLINESEARCH'] = "Online Search";
$content['LN_ORACLE_WHOIS'] = "WHOIS Lookup for '%1' value '%2'"; $content['LN_ORACLE_WHOIS'] = "WHOIS Lookup for '%1' value '%2'";
// Report Strings
$content['LN_GEN_ERROR_INVALIDOP'] = "Invalid or missing operation type"; $content['LN_GEN_ERROR_INVALIDOP'] = "Invalid or missing operation type";
$content['LN_GEN_ERROR_INVALIDREPORTID'] = "Invalid or missing report id"; $content['LN_GEN_ERROR_INVALIDREPORTID'] = "Invalid or missing report id";
$content['LN_GEN_ERROR_MISSINGSAVEDREPORTID'] = "Invalid or missing savedreport id"; $content['LN_GEN_ERROR_MISSINGSAVEDREPORTID'] = "Invalid or missing savedreport id";
@ -363,5 +364,23 @@ $content['LN_CMD_NOSAVEDREPORTID'] = "Missing SavedReport ID";
$content['LN_CMD_NOCMDPROMPT'] = "Error, this script can only be run from the command prompt."; $content['LN_CMD_NOCMDPROMPT'] = "Error, this script can only be run from the command prompt.";
$content['LN_REPORT_GENERATEDTIME'] = "Report generated at: "; $content['LN_REPORT_GENERATEDTIME'] = "Report generated at: ";
$content['LN_REPORT_ACTIONS'] = "Run Report Actions";
$content['LN_REPORTS_CAT'] = "Report Category";
$content['LN_REPORTS_ID'] = "Report ID";
$content['LN_REPORTS_NAME'] = "Report Name";
$content['LN_REPORTS_DESCRIPTION'] = "Report Description";
$content['LN_REPORTS_HELP'] = "Help";
$content['LN_REPORTS_HELP_CLICK'] = "Click here for a detailed report description";
$content['LN_REPORTS_INFO'] = "Show more Information";
$content['LN_REPORTS_SAVEDREPORTS'] = "Saved reports";
$content['LN_REPORTS_ADMIN'] = "Administrate Reports";
$content['LN_REPORTMENU_LIST'] = "List installed Reports";
$content['LN_REPORTMENU_ONLINELIST'] = "All Available Reports";
$content['LN_REPORTS_INFORMATION'] = "This page shows a list of installed and available reports including saved report configurations.
<br/>To run a report, click on the buttons right to the Saved Reports.
<br/>Attention! Generating reports can be very time consuming depending on the size of your database.
";
$content['LN_REPORTS_CHECKLOGSTREAMSOURCE'] = "Verify Logstream optimization";
?> ?>

143
src/reports.php Normal file
View File

@ -0,0 +1,143 @@
<?php
/*
*********************************************************************
* LogAnalyzer - http://loganalyzer.adiscon.com
* -----------------------------------------------------------------
* Search Admin File
*
* -> Helps administrating report modules
*
* All directives are explained within this file
*
* Copyright (C) 2008-2010 Adiscon GmbH.
*
* This file is part of LogAnalyzer.
*
* LogAnalyzer 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.
*
* LogAnalyzer 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 LogAnalyzer. If not, see <http://www.gnu.org/licenses/>.
*
* A copy of the GPL can be found in the file "COPYING" in this
* distribution
*********************************************************************
*/
// *** Default includes and procedures *** //
define('IN_PHPLOGCON', true);
$gl_root_path = './';
// Now include necessary include files!
include($gl_root_path . 'include/functions_common.php');
include($gl_root_path . 'include/functions_frontendhelpers.php');
include($gl_root_path . 'include/functions_filters.php');
include($gl_root_path . 'include/functions_reports.php');
InitPhpLogCon();
InitSourceConfigs();
InitFrontEndDefaults(); // Only in WebFrontEnd
InitFilterHelpers(); // Helpers for frontend filtering!
// ---
// --- BEGIN Custom Code
// Firts of all init List of Reports!
InitReportModules();
if ( isset($content['REPORTS']) )
{
// This will enable to Stats View
$content['reportsenabled'] = true;
$i = 0; // Help counter!
foreach ($content['REPORTS'] as &$myReport )
{
// Set if help link is enabled
if ( strlen($myReport['ReportHelpArticle']) > 0 )
$myReport['ReportHelpEnabled'] = true;
else
$myReport['ReportHelpEnabled'] = false;
// check for custom fields
if ( $myReport['NeedsInit'] ) // && count($myReport['CustomFieldsList']) > 0 )
{
// Needs custom fields!
$myReport['EnableNeedsInit'] = true;
if ( $myReport['Initialized'] )
{
$myReport['InitEnabled'] = false;
$myReport['DeleteEnabled'] = true;
}
else
{
$myReport['InitEnabled'] = true;
$myReport['DeleteEnabled'] = false;
}
}
// --- Set CSS Class
if ( $i % 2 == 0 )
{
$myReport['cssclass'] = "line1";
$myReport['rowbegin'] = '<tr><td width="50%" valign="top">';
$myReport['rowend'] = '</td>';
}
else
{
$myReport['cssclass'] = "line2";
$myReport['rowbegin'] = '<td width="50%" valign="top">';
$myReport['rowend'] = '</td></tr>';
}
$i++;
// ---
// --- Check for saved reports!
if ( isset($myReport['SAVEDREPORTS']) && count($myReport['SAVEDREPORTS']) > 0 )
{
$myReport['HASSAVEDREPORTS'] = "true";
$myReport['SavedReportRowSpan'] = ( count($myReport['SAVEDREPORTS']) + 1);
$j = 0; // Help counter!
foreach ($myReport['SAVEDREPORTS'] as &$mySavedReport )
{
// --- Set CSS Class
if ( $j % 2 == 0 )
$mySavedReport['srcssclass'] = "line1";
else
$mySavedReport['srcssclass'] = "line2";
$j++;
// ---
}
}
// ---
}
}
else
{
$content['LISTREPORTS'] = "false";
$content['ISERROR'] = true;
$content['ERROR_MSG'] = $content['LN_REPORTS_ERROR_NOREPORTS'];
}
// --- END Custom Code
// --- BEGIN CREATE TITLE
$content['TITLE'] = InitPageTitle();
// Append custom title part!
$content['TITLE'] .= " :: " . $content['LN_MENU_REPORTS'];
// --- END CREATE TITLE
// --- Parsen and Output
InitTemplateParser();
$page -> parser($content, "reports.html");
$page -> output();
// ---
?>

View File

@ -5,7 +5,7 @@
<center> <center>
<div class="table_with_border_second ErrorMsg" style="width:600px"> <div class="table_with_border_second ErrorMsg" style="width:600px">
<div class="PriorityError">{LN_GEN_ERRORDETAILS}</div> <div class="PriorityError">{LN_GEN_ERRORDETAILS}</div>
<p>{ERROR_MSG}</p> <p align="left">{ERROR_MSG}</p>
</div> </div>
<br><br> <br><br>
<a href="javascript:history.back();" target="_top">{LN_GEN_ERRORRETURNPREV}</a> <a href="javascript:history.back();" target="_top">{LN_GEN_ERRORRETURNPREV}</a>
@ -270,6 +270,36 @@
</script> </script>
<!-- IF ISSOURCENOTOPTIMIZED="true" -->
<table width="775" cellpadding="2" cellspacing="1" border="0" align="center" class="with_border_alternate">
<tr>
<td align="center" valign="top" class="line1 ErrorMsg">
<div class="{MSG_WARNING_CLASS}">{MSG_WARNING_TITLE}</div>
<p align="left">{MSG_WARNING_DETAILS}</p>
<a href="{MSG_CHECK_URL}" target="_top">{LN_REPORTS_RECHECKLOGSTREAMSOURCE}</a>
<br>
<br>
</td>
</tr>
<!-- IF MSG_WARNING_SUBMITFORM="true" -->
<tr>
<td align="center" class="line2">
<br>
<form action="{MSG_WARNING_FORMURL}" method="post" name="confirmform">
<!-- BEGIN POST_VARIABLES -->
<input type="hidden" name="{varname}" value="{varvalue}">
<!-- END POST_VARIABLES -->
<input type="image" src="{BASEPATH}images/icons/check.png" alt="{LN_REPORTS_OPTIMIZEYES}" class="borderless" width="16">
<br>
<input type="submit" value="{LN_REPORTS_OPTIMIZE_LOGSTREAMSOURCE}" class="borderless">
</form>
</td>
</tr>
<!-- ENDIF MSG_WARNING_SUBMITFORM="true" -->
</table>
<!-- ENDIF ISSOURCENOTOPTIMIZED="true" -->
<form action="{BASEPATH}admin/reports.php{FormUrlAddOP}" method="post" id="savedreportform"> <form action="{BASEPATH}admin/reports.php{FormUrlAddOP}" method="post" id="savedreportform">
<input type="hidden" name="id" value="{ReportID}"> <input type="hidden" name="id" value="{ReportID}">
<input type="hidden" name="savedreportid" value="{SavedReportID}"> <input type="hidden" name="savedreportid" value="{SavedReportID}">
@ -434,6 +464,8 @@
<option value="{SourceID}" {sourceselected}>{Name}</option> <option value="{SourceID}" {sourceselected}>{Name}</option>
<!-- END SOURCES --> <!-- END SOURCES -->
</select> </select>
<a href="{MSG_CHECK_URL}" target="_top">{LN_REPORTS_CHECKLOGSTREAMSOURCE}</a>
<!-- <button name="forcecheckoptimize" type="true" value="{REPORT_FORMACTION}" title="{LN_REPORTS_CHECKLOGSTREAMSOURCE}">{LN_REPORTS_CHECKLOGSTREAMSOURCE}</button>-->
</td> </td>
</tr> </tr>
<tr> <tr>
@ -479,6 +511,7 @@
<tr> <tr>
<td align="center" colspan="2"> <td align="center" colspan="2">
<button name="op" type="submit" value="{REPORT_FORMACTION}" title="{REPORT_SENDBUTTON}">{REPORT_SENDBUTTON}</button> <button name="op" type="submit" value="{REPORT_FORMACTION}" title="{REPORT_SENDBUTTON}">{REPORT_SENDBUTTON}</button>
<button name="op" type="submit" value="{REPORT_FORMACTIONRETURN}" title="{REPORT_SENDBUTTON}">{REPORT_SENDANDRETURN}</button>
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -4,6 +4,7 @@
<td class="topmenu1" nowrap align="center" width="75"><a class="topmenu1_link" href="{BASEPATH}search.php" target="_top"><img align="left" src="{MENU_SEARCH}" width="16" height="16" vspace="0">{LN_MENU_SEARCH}</a></td> <td class="topmenu1" nowrap align="center" width="75"><a class="topmenu1_link" href="{BASEPATH}search.php" target="_top"><img align="left" src="{MENU_SEARCH}" width="16" height="16" vspace="0">{LN_MENU_SEARCH}</a></td>
<td class="topmenu1" nowrap align="center" width="100"><a class="topmenu1_link" href="{BASEPATH}index.php?{additional_url}" target="_top"><img align="left" src="{MENU_HOMEPAGE}" width="16" height="16" vspace="0">{LN_MENU_SHOWEVENTS}</a></td> <td class="topmenu1" nowrap align="center" width="100"><a class="topmenu1_link" href="{BASEPATH}index.php?{additional_url}" target="_top"><img align="left" src="{MENU_HOMEPAGE}" width="16" height="16" vspace="0">{LN_MENU_SHOWEVENTS}</a></td>
<td class="topmenu1" nowrap align="center" width="90"><a class="topmenu1_link" href="{BASEPATH}statistics.php" target="_top"><img align="left" src="{MENU_CHARTS}" width="16" height="16" vspace="0">{LN_MENU_STATISTICS}</a></td> <td class="topmenu1" nowrap align="center" width="90"><a class="topmenu1_link" href="{BASEPATH}statistics.php" target="_top"><img align="left" src="{MENU_CHARTS}" width="16" height="16" vspace="0">{LN_MENU_STATISTICS}</a></td>
<td class="topmenu1" nowrap align="center" width="80"><a class="topmenu1_link" href="{BASEPATH}reports.php" target="_top"><img align="left" src="{MENU_CHARTPRESENTATION}" width="16" height="16" vspace="0">{LN_MENU_REPORTS}</a></td>
<td class="topmenu1" nowrap align="left" width="60" nowrap> <td class="topmenu1" nowrap align="left" width="60" nowrap>
<img align="left" src="{MENU_HELP}" width="16" height="16" title="{LN_GEN_PREDEFINEDSEARCHES}" OnClick="ToggleDisplayTypeById('menu_help');" OnMouseOver="HoverPopupMenuHelp(event, this, '{LN_MENU_HELP}', '{LN_MENU_CLICKTOEXPANDMENU}');" OnMouseOut="FinishPopupWindowMenu();"> <img align="left" src="{MENU_HELP}" width="16" height="16" title="{LN_GEN_PREDEFINEDSEARCHES}" OnClick="ToggleDisplayTypeById('menu_help');" OnMouseOver="HoverPopupMenuHelp(event, this, '{LN_MENU_HELP}', '{LN_MENU_CLICKTOEXPANDMENU}');" OnMouseOut="FinishPopupWindowMenu();">
<div id="menu"><ul> <div id="menu"><ul>
@ -19,7 +20,7 @@
</li> </li>
</ul></div> </ul></div>
</td> </td>
<td class="topmenu1" nowrap align="center" width="200"><a class="topmenu1_link" href="http://kb.monitorware.com/search.php" target="_blank"><img align="left" src="{MENU_KB}" width="16" height="16" vspace="0">{LN_MENU_SEARCHINKB}</a></td> <td class="topmenu1" nowrap align="center" width="180"><a class="topmenu1_link" href="http://kb.monitorware.com/search.php" target="_blank"><img align="left" src="{MENU_KB}" width="16" height="16" vspace="0">{LN_MENU_SEARCHINKB}</a></td>
<!-- IF UserDBEnabled="true" --> <!-- IF UserDBEnabled="true" -->
<!-- IF SESSION_LOGGEDIN!="true" --> <!-- IF SESSION_LOGGEDIN!="true" -->
<td class="topmenu1" nowrap align="center" width="100"><a class="topmenu1_link" href="{BASEPATH}login.php" target="_top"><img align="left" src="{MENU_ADMINLOGOFF}" width="16" height="16" vspace="0">{LN_MENU_LOGIN}</a></td> <td class="topmenu1" nowrap align="center" width="100"><a class="topmenu1_link" href="{BASEPATH}login.php" target="_top"><img align="left" src="{MENU_ADMINLOGOFF}" width="16" height="16" vspace="0">{LN_MENU_LOGIN}</a></td>

221
src/templates/reports.html Normal file
View File

@ -0,0 +1,221 @@
<!-- INCLUDE include_header.html -->
<!-- IF ISERROR="true" -->
<br><br>
<center>
<div class="table_with_border_second ErrorMsg" style="width:600px">
<div class="PriorityError">{LN_GEN_ERRORDETAILS}</div>
<p align="left">{ERROR_MSG}</p>
<p>
<a href="http://kb.monitorware.com/kbeventdb-list-12-Adiscon-phpLogCon-{detailederror_code}.html" target="_blank">
<img src="{MENU_HELP_ORANGE}" width="16" height="16" title="{LN_GEN_MOREINFORMATION}">
{LN_GEN_MOREINFORMATION}
</a>
</p>
</div>
<br><br>
</center>
<br><br>
<!-- ENDIF ISERROR="true" -->
<!-- IF reportsenabled="true" -->
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="with_border">
<tr>
<td colspan="3" class="title" nowrap><B>{LN_MENU_REPORTS}</B></td>
</tr>
<tr>
<td colspan="3" class="titleSecond"><br><blockquote>{LN_REPORTS_INFORMATION}</blockquote><br></td>
</tr>
<tr>
<td align="center" class="line2">
<table border="0" cellpadding="2" cellspacing="0" bgcolor="#DDDDDD" width="100%" class="with_border_alternate">
<tr>
<td class="topmenu2begin" nowrap align="center" width="16"><img align="left" src="{MENU_BULLET_YELLOW}" width="16" height="16" vspace="0"></td>
<td class="topmenu2" nowrap align="center" width="150"><a class="topmenu1_link" href="{BASEPATH}admin/reports.php" target="_top"><img align="left" src="{MENU_DOCUMENTLIST}" width="16" height="16" vspace="0">{LN_REPORTS_ADMIN}</a></td>
<td class="topmenu2" nowrap align="center" width="150"><a class="topmenu1_link" href="http://loganalyzer.adiscon.com/plugins/reports" target="_blank"><img align="left" src="{MENU_NETDOWNLOAD}" width="16" height="16" vspace="0">{LN_REPORTMENU_ONLINELIST}</a></td>
<!-- IF ISADDSAVEDREPORT="true" -->
<td class="topmenu2" nowrap align="center" width="250"><a class="topmenu1_link" href="{BASEPATH}admin/reports.php?op=details&id={ReportID}" target="_top"><img align="left" src="{MENU_VIEW}" width="16" height="16" vspace="0">{REPORTS_DETAILSFOR}</a></td>
<!-- ENDIF ISADDSAVEDREPORT="true" -->
<td class="topmenu2end" nowrap align="center" width="max">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
<br/><br/>
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="with_border_alternative">
<!-- BEGIN REPORTS -->
{rowbegin}
<table cellpadding="2" cellspacing="0" border="0" align="center" valign="top" width="350" class="table_with_border_light">
<tr>
<td align="center" width="100" class="cellmenu1" nowrap><b>{LN_REPORTS_NAME}</b></td>
<td align="center" width="100%" class="cellmenu1"><a href="{BASEPATH}admin/reports.php?op=details&id={ID}" class="cellmenu1_link">{DisplayName}</a></td>
</tr>
<tr>
<td align="center" class="cellmenu2"><b>{LN_REPORTS_HELP}</b></td>
<td align="left" width="100%" class="line1">
<!-- IF ReportHelpEnabled="true" -->
&nbsp;&nbsp;<a href="{ReportHelpArticle}" target="_blank"><img src="{MENU_HELP}" width="16" title="{LN_REPORTS_HELP}">&nbsp;{LN_REPORTS_HELP}</a>
<!-- ENDIF ReportHelpEnabled="true" -->
&nbsp;&nbsp;<a href="{BASEPATH}admin/reports.php?op=details&id={ID}"><img src="{MENU_INFORMATION}" width="16" title="{LN_REPORTS_INFO}">&nbsp;{LN_REPORTS_INFO}</a>
</td>
</tr>
<tr>
<td align="center" class="cellmenu2_naked"><b>{LN_REPORTS_DESCRIPTION}</b></td>
<td align="left" width="100%" class="line2">{Description}</td>
</tr>
<tr>
<td align="center" class="cellmenu2_naked" valign="_top"><b>{LN_REPORTS_SAVEDREPORTS}</b></td>
<td align="center" width="100%" class="line2">
<!-- IF HASSAVEDREPORTS="true" -->
<table border="0" cellpadding="2" cellspacing="1" bgcolor="#DDDDDD" width="400" class="with_border_alternative">
<!-- BEGIN SAVEDREPORTS -->
<tr>
<td align="left" class="{srcssclass}" colspan="2">
<img src="{MENU_REPORTS}" width="16">
<a href="{BASEPATH}admin/reports.php?op=editsavedreport&id={ID}&savedreportid={SavedReportID}">{customTitle}</a>
</td>
<td align="center" class="{srcssclass}">
&nbsp;<a href="{BASEPATH}reportgenerator.php?op=runreport&id={ID}&savedreportid={SavedReportID}" target="_blank"><img src="{MENU_PLAY_GREEN}" width="16" title="{LN_REPORTS_RUNNOW}"></a>
</td>
</tr>
<!-- END SAVEDREPORTS -->
</table>
<!-- ENDIF HASSAVEDREPORTS="true" -->
</td>
</tr>
</table>
<br><br>
{rowend}
<!-- END REPORTS -->
</table>
<!-- IF LISTONLINEREPORTS="true" -->
<table border="0" cellpadding="2" cellspacing="1" bgcolor="#DDDDDD" width="775" class="with_border_alternate">
<tr>
<td align="center" width="50" class="cellmenu1"><b>{LN_REPORTS_INSTALLED}</b></td>
<td align="center" width="100" class="cellmenu1"><b>{LN_REPORTS_ID}</b></td>
<td align="center" width="200" class="cellmenu1"><b>{LN_REPORTS_NAME}</b></td>
<td align="center" width="300" class="cellmenu1"><b>{LN_REPORTS_DESCRIPTION}</b></td>
<td align="center" width="125" class="cellmenu1" nowrap><b>{LN_REPORTS_LINKS}</b></td>
</tr>
<!-- BEGIN ONLINEREPORTS -->
<tr>
<td align="center" class="{cssclass}"><img src="{installed_icon}" width="16" title="{installed_text}"></td>
<td align="left" class="{cssclass}" valign="top"><b>{reportid}</b></td>
<td align="left" class="{cssclass}" valign="top">
<!-- IF reportdownloadlink="-" -->
<b>{reportname}</b>
<!-- ENDIF reportdownloadlink="-" -->
<!-- IF reportdownloadlink!="-" -->
<a href="{reportdownloadlink}" target="_blank">{reportname}</a>
<!-- ENDIF reportdownloadlink!="-" -->
</td>
<td align="left" class="{cssclass}" valign="top">{reportdescription}</td>
<td align="center" class="{cssclass}">
<!-- IF reportdownloadlink!="-" -->
<a href="{reportdownloadlink}" target="_blank"><img src="{MENU_NETDOWNLOAD}" width="16" title="{LN_REPORTS_DOWNLOAD}"></a>&nbsp;&nbsp;
<!-- ENDIF reportdownloadlink!="-" -->
<!-- IF reporthelparticle!="-" -->
<a href="{reporthelparticle}" target="_blank"><img src="{MENU_HELP}" width="16" title="{LN_REPORTS_HELP}"></a>&nbsp;&nbsp;
<!-- ENDIF reporthelparticle!="-" -->
<!-- IF reportsamplelink!="-" -->
<a href="{reportsamplelink}" target="_blank"><img src="{MENU_CHART_PREVIEW}" width="16" title="{LN_REPORTS_SAMPLELINK}"></a>&nbsp;&nbsp;
<!-- ENDIF reportsamplelink!="-" -->
</td>
</tr>
<!-- END ONLINEREPORTS -->
</table>
<!-- ENDIF LISTONLINEREPORTS="true" -->
<!-- IF ISSHOWDETAILS="true" -->
<table border="0" cellpadding="2" cellspacing="1" bgcolor="#DDDDDD" width="775" class="with_border_alternate">
<tr>
<td align="center" class="cellmenu1" colspan="3"><b>{LN_REPORTS_DETAILS}</b></td>
</tr>
<tr>
<td align="left" class="cellmenu2" width="250"><b>{LN_REPORTS_CAT}</b></td>
<td align="left" class="line1" width="350" colspan="2">{Category}</td>
</tr>
<tr>
<td align="left" class="cellmenu2" width="250"><b>{LN_REPORTS_ID}</b></td>
<td align="left" class="line1" width="350" colspan="2">{ReportID}</td>
</tr>
<tr>
<td align="left" class="cellmenu2"><b>{LN_REPORTS_NAME}</b></td>
<td align="left" class="line2" colspan="2">{DisplayName}</td>
</tr>
<tr>
<td align="left" class="cellmenu2_naked" valign="top"><b>{LN_REPORTS_DESCRIPTION}</b></td>
<td align="left" class="line1" colspan="2">{Description}</td>
</tr>
<!-- IF EnableRequiredFields="true" -->
<tr>
<td align="left" class="cellmenu2_naked" valign="top"><b>{LN_REPORTS_REQUIREDFIELDS}</b></td>
<td align="left" class="line1" colspan="2">
<!-- BEGIN RequiredFieldsList -->
<br><B>{FieldCaption}</B> ({FieldDefine})
<!-- END RequiredFieldsList -->
<br><br>
</td>
</tr>
<!-- ENDIF EnableRequiredFields="true" -->
<!-- IF EnableHelpArticle="true" -->
<tr>
<td align="left" class="cellmenu2"><b>{LN_REPORTS_HELP}</b></td>
<td align="center" class="line2" colspan="2"><a href="{ReportHelpArticle}" target="_blank">{LN_REPORTS_HELP_CLICK}</a></td>
</tr>
<!-- ENDIF EnableHelpArticle="true" -->
<!-- IF EnableNeedsInit="true" -->
<tr>
<td align="center" class="tableBackground" colspan="2">
<!-- IF InitEnabled="true" -->
<a href="{BASEPATH}admin/reports.php?op=initreport&id={ReportID}"><img src="{MENU_PARSER_INIT}" width="16" title="{LN_REPORTS_INIT}"> {LN_REPORTS_INIT}</a>
<!-- ENDIF InitEnabled="true" -->
<!-- IF DeleteEnabled="true" -->
<a href="{BASEPATH}admin/reports.php?op=removereport&id={ReportID}"><img src="{MENU_PARSER_DELETE}" width="16" title="{LN_REPORTS_REMOVE}"> {LN_REPORTS_REMOVE}</a>
<!-- ENDIF DeleteEnabled="true" -->
</td>
</tr>
<!-- ENDIF EnableNeedsInit="true" -->
<!-- IF HASSAVEDREPORTS="true" -->
<tr>
<td align="center" rowspan="{SavedReportRowSpan}" class="cellmenu2_naked" valign="top">{LN_REPORTS_SAVEDREPORTS}</td>
<td align="left" class="line1" colspan="2">
</td>
</tr>
<!-- BEGIN SAVEDREPORTS -->
<tr>
<td align="left" class="{srcssclass}">
<img src="{MENU_REPORTS}" width="16">
<a href="{BASEPATH}admin/reports.php?op=editsavedreport&id={ReportID}&savedreportid={SavedReportID}">{customTitle}</a>
</td>
<td align="center" class="{srcssclass}">
&nbsp;<a href="{BASEPATH}reportgenerator.php?op=runreport&id={ReportID}&savedreportid={SavedReportID}" target="_blank"><img src="{MENU_CHART_PREVIEW}" width="16" title="{LN_REPORTS_RUNNOW}"></a>
&nbsp;<a href="{BASEPATH}admin/reports.php?op=editsavedreport&id={ReportID}&savedreportid={SavedReportID}"><img src="{MENU_EDIT}" width="16" title="{LN_REPORTS_EDITSAVEDREPORT}"></a>
&nbsp;<a href="{BASEPATH}admin/reports.php?op=removesavedreport&savedreportid={SavedReportID}"><img src="{MENU_DELETE}" width="16" title="{LN_REPORTS_REMOVESAVEDREPORT}"></a>
</td>
</tr>
<!-- END SAVEDREPORTS -->
<!-- ENDIF HASSAVEDREPORTS="true" -->
</table>
<br><br>
<a href="javascript:history.back();" target="_top">{LN_GEN_ERRORRETURNPREV}</a>
<!-- ENDIF ISSHOWDETAILS="true" -->
<br><br>
</td>
</tr>
</table>
<!-- ENDIF reportsenabled="true" -->
<!-- INCLUDE include_footer.html -->