$content['fields'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $facility_colors[$logArray[SYSLOG_FACILITY]] . '" '; $content['fields'][$mycolkey]['cssclass'] = "lineColouredBlack"; // Set Human readable Facility! $content['fields'][$mycolkey]['fieldvalue'] = GetFacilityDisplayName($logArray[$mycolkey]); } else { // Use default colour! $content['fields'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $facility_colors[SYSLOG_LOCAL0] . '" '; } } else { if ($mycolkey == SYSLOG_SEVERITY) { // if ( isset($logArray[$mycolkey][SYSLOG_SEVERITY]) && strlen($logArray[$mycolkey][SYSLOG_SEVERITY]) > 0) if (isset($logArray[$mycolkey]) && is_numeric($logArray[$mycolkey])) { $content['fields'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $severity_colors[$logArray[SYSLOG_SEVERITY]] . '" '; $content['fields'][$mycolkey]['cssclass'] = "lineColouredWhite"; // Set Human readable Facility! $content['fields'][$mycolkey]['fieldvalue'] = GetSeverityDisplayName($logArray[$mycolkey]); } else { // Use default colour! $content['fields'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $severity_colors[SYSLOG_INFO] . '" '; } } else { if ($mycolkey == SYSLOG_MESSAGETYPE) { // if ( isset($logArray[$mycolkey][SYSLOG_MESSAGETYPE]) ) if (isset($logArray[$mycolkey]) && is_numeric($logArray[$mycolkey])) { $content['fields'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $msgtype_colors[$logArray[SYSLOG_MESSAGETYPE]] . '" '; $content['fields'][$mycolkey]['cssclass'] = "lineColouredBlack"; // Set Human readable Facility! $content['fields'][$mycolkey]['fieldvalue'] = GetMessageTypeDisplayName($logArray[$mycolkey]); } else { // Use default colour! $content['fields'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $msgtype_colors[IUT_Unknown] . '" ';
} // Add new filter if wanted if (isset($_POST['subop'])) { if ($_POST['subop'] == $content['LN_REPORTS_ADDFILTER'] && isset($_POST['newfilter'])) { if (isset($fields[$_POST['newfilter']])) { // Get Field Info $myNewField = $fields[$_POST['newfilter']]; if ($myNewField['FieldType'] == FILTER_TYPE_DATE) { $szFilterString .= "datelastx:" . DATE_LASTX_24HOURS; } else { if ($myNewField['FieldType'] == FILTER_TYPE_NUMBER) { // Append sample filter $szFilterString .= $myNewField['SearchField'] . ":="; if ($myNewField['FieldID'] == SYSLOG_SEVERITY) { // Append field value $szFilterString .= GetSeverityDisplayName(SYSLOG_NOTICE); } else { if ($myNewField['FieldID'] == SYSLOG_FACILITY) { // Append field value $szFilterString .= GetFacilityDisplayName(SYSLOG_LOCAL0); } else { // Append sample value $szFilterString .= "1"; } } } else { if ($myNewField['FieldType'] == FILTER_TYPE_STRING) { // Searchfield filter if (isset($myNewField['SearchField']) && strlen($myNewField['SearchField']) > 0) { $szFilterString .= $myNewField['SearchField'] . ":"; }
/** * startDataProcessing, analysing data * * @param arrProperties array in: Properties wish list. * @return integer Error stat */ public function startDataProcessing() { global $content, $severity_colors, $gl_starttime, $fields; // Create Filter string, append filter for EventLog Type msgs! $szFilters = $this->_filterString . " " . $fields[SYSLOG_MESSAGETYPE]['SearchField'] . ":=" . IUT_NT_EventReport . ",=" . IUT_WEVTMONV2; // Include EventLog v1 and v2 // Set Filter string $this->_streamObj->SetFilter($szFilters); // Need to Open stream first! $res = $this->_streamObj->Open($this->_arrProperties, true); if ($res == SUCCESS) { // Set to common content variables $this->SetCommonContentVariables(); // Set report specific content variables $content["_colorThreshold"] = $this->_colorThreshold; // --- Report logic starts here $content["report_rendertime"] = ""; // Step 1: Gather Summaries // Obtain data from the logstream! $content["report_summary"] = $this->_streamObj->ConsolidateDataByField(SYSLOG_SEVERITY, 0, SYSLOG_SEVERITY, SORTING_ORDER_DESC, null, false); // TimeStats $nowtime = microtime_float(); $content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s, "; // If data is valid, we have an array! if (is_array($content["report_summary"]) && count($content["report_summary"]) > 0) { // Count Total Events $iTotalEvents = 0; foreach ($content["report_summary"] as &$tmpReportData) { $tmpReportData['DisplayName'] = GetSeverityDisplayName($tmpReportData[SYSLOG_SEVERITY]); $tmpReportData['bgcolor'] = $severity_colors[$tmpReportData[SYSLOG_SEVERITY]]; $iTotalEvents += $tmpReportData['itemcount']; } // Prepent Item with totalevents count $totalItem['DisplayName'] = "Total Events"; $totalItem['bgcolor'] = "#999999"; $totalItem['itemcount'] = $iTotalEvents; // Prepent to array array_unshift($content["report_summary"], $totalItem); } else { return ERROR_REPORT_NODATA; } // Get List of hosts $content["report_computers"] = $this->_streamObj->ConsolidateItemListByField(SYSLOG_HOST, $this->_maxHosts, SYSLOG_HOST, SORTING_ORDER_DESC); // TimeStats $nowtime = microtime_float(); $content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s, "; if (is_array($content["report_computers"]) && count($content["report_computers"]) > 0) { // Create plain hosts list for Consolidate function foreach ($content["report_computers"] as $tmpComputer) { $arrHosts[] = $tmpComputer[SYSLOG_HOST]; } } else { return ERROR_REPORT_NODATA; } // This function will consolidate the Events based per Host! $this->ConsolidateEventsPerHost($arrHosts); // TimeStats $nowtime = microtime_float(); $content["report_rendertime"] .= number_format($nowtime - $gl_starttime, 2, '.', '') . "s "; // --- } else { return $ret; } // Return success! return SUCCESS; }
// Set Human readable Facility! $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = GetFacilityDisplayName($logArray[$mycolkey]); } else { // Use default colour! $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $facility_colors[SYSLOG_LOCAL0] . '" '; } // Add context menu AddOnClickMenu($content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_NUMBER, SYSLOG_FACILITY); } else { if ($mycolkey == SYSLOG_SEVERITY) { // if ( isset($logArray[$mycolkey][SYSLOG_SEVERITY]) && strlen($logArray[$mycolkey][SYSLOG_SEVERITY]) > 0) if (isset($logArray[$mycolkey]) && is_numeric($logArray[$mycolkey])) { $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $severity_colors[$logArray[SYSLOG_SEVERITY]] . '" '; $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldcssclass'] = "lineColouredWhite"; // Set Human readable Facility! $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = GetSeverityDisplayName($logArray[$mycolkey]); } else { // Use default colour! $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $severity_colors[SYSLOG_INFO] . '" '; } // Add context menu AddOnClickMenu($content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_NUMBER, SYSLOG_SEVERITY); } else { if ($mycolkey == SYSLOG_MESSAGETYPE) { // if ( isset($logArray[$mycolkey][SYSLOG_MESSAGETYPE]) ) if (isset($logArray[$mycolkey]) && is_numeric($logArray[$mycolkey])) { $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $msgtype_colors[$logArray[SYSLOG_MESSAGETYPE]] . '" '; $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldcssclass'] = "lineColouredBlack"; // Set Human readable Facility! $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = GetMessageTypeDisplayName($logArray[$mycolkey]); } else {