mirror of
https://github.com/rsyslog/loganalyzer.git
synced 2025-09-25 18:59:12 +02:00
Fixed a problem when adding a mysql logstream source.
Due a problem of how php mysql_connect function handels second conenctions, the Verify of a newly added logstream source could cause the first database connection to be overwritten. The following error is, that the wrong database was used for the UserDB after the new logstream was verified. Also added a check into the redirect function to STOP redirecting if an error happened in the UserDB before.
This commit is contained in:
parent
b68ecbec22
commit
3b49279a8a
@ -118,7 +118,8 @@ class LogStreamDB extends LogStream {
|
|||||||
*/
|
*/
|
||||||
public function Close()
|
public function Close()
|
||||||
{
|
{
|
||||||
mysql_close($this->_dbhandle);
|
if ($this->_dbhandle)
|
||||||
|
mysql_close($this->_dbhandle);
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +132,8 @@ class LogStreamDB extends LogStream {
|
|||||||
// Try to connect to the database
|
// Try to connect to the database
|
||||||
if ( $this->_dbhandle == null )
|
if ( $this->_dbhandle == null )
|
||||||
{
|
{
|
||||||
$this->_dbhandle = @mysql_connect($this->_logStreamConfigObj->DBServer,$this->_logStreamConfigObj->DBUser,$this->_logStreamConfigObj->DBPassword);
|
// Forces to open a new link in all cases!
|
||||||
|
$this->_dbhandle = @mysql_connect($this->_logStreamConfigObj->DBServer,$this->_logStreamConfigObj->DBUser,$this->_logStreamConfigObj->DBPassword, true);
|
||||||
if (!$this->_dbhandle)
|
if (!$this->_dbhandle)
|
||||||
{
|
{
|
||||||
if ( isset($php_errormsg) )
|
if ( isset($php_errormsg) )
|
||||||
|
@ -1,160 +1,221 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
*********************************************************************
|
*********************************************************************
|
||||||
* -> www.phplogcon.org <- *
|
* -> www.phplogcon.org <- *
|
||||||
* ----------------------------------------------------------------- *
|
* ----------------------------------------------------------------- *
|
||||||
* Apache Logfile Parser used to split WebLog fields if
|
* Apache Logfile Parser used to split WebLog fields if
|
||||||
* found in the msg.
|
* found in the msg.
|
||||||
*
|
*
|
||||||
* This Parser is for custom wireless access point logformat
|
* This Parser is for custom wireless access point logformat
|
||||||
* *
|
* *
|
||||||
* All directives are explained within this file *
|
* All directives are explained within this file *
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008 Adiscon GmbH
|
* Copyright (C) 2008 Adiscon GmbH
|
||||||
*********************************************************************
|
*********************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --- Avoid directly accessing this file!
|
// --- Avoid directly accessing this file!
|
||||||
if ( !defined('IN_PHPLOGCON') )
|
if ( !defined('IN_PHPLOGCON') )
|
||||||
{
|
{
|
||||||
die('Hacking attempt');
|
die('Hacking attempt');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
// --- Basic Includes
|
// --- Basic Includes
|
||||||
require_once($gl_root_path . 'classes/enums.class.php');
|
require_once($gl_root_path . 'classes/enums.class.php');
|
||||||
require_once($gl_root_path . 'classes/msgparser.class.php');
|
require_once($gl_root_path . 'classes/msgparser.class.php');
|
||||||
require_once($gl_root_path . 'include/constants_errors.php');
|
require_once($gl_root_path . 'include/constants_errors.php');
|
||||||
require_once($gl_root_path . 'include/constants_logstream.php');
|
require_once($gl_root_path . 'include/constants_logstream.php');
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
class MsgParser_wireless extends MsgParser {
|
class MsgParser_wireless extends MsgParser {
|
||||||
|
|
||||||
// Public Information properties
|
// Public Information properties
|
||||||
public $_ClassName = 'Custom Wireless Logfiles';
|
public $_ClassName = 'Custom Wireless Logfiles';
|
||||||
public $_ClassDescription = 'Custom logfile parser for wireless access points.';
|
public $_ClassDescription = 'Custom logfile parser for wireless access points.';
|
||||||
public $_ClassHelpArticle = "";
|
public $_ClassHelpArticle = "";
|
||||||
public $_ClassRequiredFields = array (
|
public $_ClassRequiredFields = array (
|
||||||
"net_bytesrecieved" => array ( "FieldID" => "net_bytesrecieved", "FieldDefine" => "SYSLOG_NET_BYTESRECIEVED", "FieldCaption" => "Bytes recieved", "FieldType" => 1, "FieldAlign" => "left", "SearchField" => "net_bytesrecieved", "DefaultWidth" => 80, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
"net_bytesrecieved" => array ( "FieldID" => "net_bytesrecieved", "FieldDefine" => "SYSLOG_NET_BYTESRECIEVED", "FieldCaption" => "Bytes recieved", "FieldType" => 1, "FieldAlign" => "left", "SearchField" => "net_bytesrecieved", "DefaultWidth" => 80, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
||||||
"net_bytessend" => array (", ", "FieldID" => "net_bytessend", "FieldDefine" => "SYSLOG_NET_BYTESSEND", "FieldCaption" => "Bytes send", "FieldType" => 1, "FieldAlign" => "left", "SearchField" => "net_bytessend", "DefaultWidth" => 80, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0 ),
|
"net_bytessend" => array (", ", "FieldID" => "net_bytessend", "FieldDefine" => "SYSLOG_NET_BYTESSEND", "FieldCaption" => "Bytes send", "FieldType" => 1, "FieldAlign" => "left", "SearchField" => "net_bytessend", "DefaultWidth" => 80, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0 ),
|
||||||
"net_interface" => array (", ", "FieldID" => "net_interface", "FieldDefine" => "SYSLOG_NET_INTERFACE", "FieldCaption" => "Interface", "FieldType" => 0, "FieldAlign" => "center", "SearchField" => "net_interface", "DefaultWidth" => 75, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
"net_interface" => array (", ", "FieldID" => "net_interface", "FieldDefine" => "SYSLOG_NET_INTERFACE", "FieldCaption" => "Interface", "FieldType" => 0, "FieldAlign" => "center", "SearchField" => "net_interface", "DefaultWidth" => 75, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
||||||
"net_lastactivity" => array (", ", "FieldID" => "net_lastactivity", "FieldDefine" => "SYSLOG_NET_LASTACTIVITY", "FieldCaption" => "Last Activity", "FieldType" => 0, "FieldAlign" => "center", "SearchField" => "net_lastactivity", "DefaultWidth" => 80, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
"net_lastactivity" => array (", ", "FieldID" => "net_lastactivity", "FieldDefine" => "SYSLOG_NET_LASTACTIVITY", "FieldCaption" => "Last Activity", "FieldType" => 0, "FieldAlign" => "center", "SearchField" => "net_lastactivity", "DefaultWidth" => 80, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
||||||
"net_lastip" => array (", ", "FieldID" => "net_lastip", "FieldDefine" => "SYSLOG_NET_LASTIP", "FieldCaption" => "Last IP Address", "FieldType" => 0, "FieldAlign" => "left", "SearchField" => "net_lastip", "DefaultWidth" => 100, "SearchOnline" => 1, "Trunscate" => 0, "Sortable" => 0),
|
"net_lastip" => array (", ", "FieldID" => "net_lastip", "FieldDefine" => "SYSLOG_NET_LASTIP", "FieldCaption" => "Last IP Address", "FieldType" => 0, "FieldAlign" => "left", "SearchField" => "net_lastip", "DefaultWidth" => 100, "SearchOnline" => 1, "Trunscate" => 0, "Sortable" => 0),
|
||||||
"net_mac_address" => array (", ", "FieldID" => "net_mac_address", "FieldDefine" => "SYSLOG_NET_MAC_ADDRESS", "FieldCaption" => "Mac Address", "FieldType" => 0, "FieldAlign" => "left", "SearchField" => "net_mac_address", "DefaultWidth" => 120, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
"net_mac_address" => array (", ", "FieldID" => "net_mac_address", "FieldDefine" => "SYSLOG_NET_MAC_ADDRESS", "FieldCaption" => "Mac Address", "FieldType" => 0, "FieldAlign" => "left", "SearchField" => "net_mac_address", "DefaultWidth" => 120, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
||||||
"net_packetsrecieved" => array (", ", "FieldID" => "net_packetsrecieved", "FieldDefine" => "SYSLOG_NET_PACKETSRECIEVED", "FieldCaption" => "Packets recieved", "FieldType" => 1, "FieldAlign" => "left", "SearchField" => "net_packetsrecieved", "DefaultWidth" => 100, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
"net_packetsrecieved" => array (", ", "FieldID" => "net_packetsrecieved", "FieldDefine" => "SYSLOG_NET_PACKETSRECIEVED", "FieldCaption" => "Packets recieved", "FieldType" => 1, "FieldAlign" => "left", "SearchField" => "net_packetsrecieved", "DefaultWidth" => 100, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
||||||
"net_packetssend" => array (", ", "FieldID" => "net_packetssend", "FieldDefine" => "SYSLOG_NET_PACKETSSEND", "FieldCaption" => "Packets send", "FieldType" => 1, "FieldAlign" => "left", "SearchField" => "net_packetssend", "DefaultWidth" => 100, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
"net_packetssend" => array (", ", "FieldID" => "net_packetssend", "FieldDefine" => "SYSLOG_NET_PACKETSSEND", "FieldCaption" => "Packets send", "FieldType" => 1, "FieldAlign" => "left", "SearchField" => "net_packetssend", "DefaultWidth" => 100, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
||||||
"net_rxrate" => array (", ", "FieldID" => "net_rxrate", "FieldDefine" => "SYSLOG_NET_RXRATE", "FieldCaption" => "RX Rate", "FieldType" => 0, "FieldAlign" => "left", "SearchField" => "net_rxrate", "DefaultWidth" => 65, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
"net_rxrate" => array (", ", "FieldID" => "net_rxrate", "FieldDefine" => "SYSLOG_NET_RXRATE", "FieldCaption" => "RX Rate", "FieldType" => 0, "FieldAlign" => "left", "SearchField" => "net_rxrate", "DefaultWidth" => 65, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
||||||
"net_signalstrength" => array (", ", "FieldID" => "net_signalstrength", "FieldDefine" => "SYSLOG_NET_SIGNALSTRENGTH", "FieldCaption" => "Signal strength", "FieldType" => 0, "FieldAlign" => "left", "SearchField" => "net_signalstrength", "DefaultWidth" => 110, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
"net_signalstrength" => array (", ", "FieldID" => "net_signalstrength", "FieldDefine" => "SYSLOG_NET_SIGNALSTRENGTH", "FieldCaption" => "Signal strength", "FieldType" => 0, "FieldAlign" => "left", "SearchField" => "net_signalstrength", "DefaultWidth" => 110, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
||||||
"net_signaltonoise" => array (", ", "FieldID" => "net_signaltonoise", "FieldDefine" => "SYSLOG_NET_SIGNALTONOISE", "FieldCaption" => "Signal to noise", "FieldType" => 1, "FieldAlign" => "center", "SearchField" => "net_signaltonoise", "DefaultWidth" => 85, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
"net_signaltonoise" => array (", ", "FieldID" => "net_signaltonoise", "FieldDefine" => "SYSLOG_NET_SIGNALTONOISE", "FieldCaption" => "Signal to noise", "FieldType" => 1, "FieldAlign" => "center", "SearchField" => "net_signaltonoise", "DefaultWidth" => 85, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
||||||
"net_uptime" => array (", ", "FieldID" => "net_uptime", "FieldDefine" => "SYSLOG_NET_UPTIME", "FieldCaption" => "System Uptime", "FieldType" => 0, "FieldAlign" => "center", "SearchField" => "net_uptime", "DefaultWidth" => 100, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
"net_uptime" => array (", ", "FieldID" => "net_uptime", "FieldDefine" => "SYSLOG_NET_UPTIME", "FieldCaption" => "System Uptime", "FieldType" => 0, "FieldAlign" => "center", "SearchField" => "net_uptime", "DefaultWidth" => 100, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
||||||
"net_txccq" => array (", ", "FieldID" => "net_txccq", "FieldDefine" => "SYSLOG_NET_TXCCQ", "FieldCaption" => "TX CCQ", "FieldType" => 1, "FieldAlign" => "center", "SearchField" => "net_txccq", "DefaultWidth" => 50, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
"net_txccq" => array (", ", "FieldID" => "net_txccq", "FieldDefine" => "SYSLOG_NET_TXCCQ", "FieldCaption" => "TX CCQ", "FieldType" => 1, "FieldAlign" => "center", "SearchField" => "net_txccq", "DefaultWidth" => 50, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0),
|
||||||
"net_txrate" => array (", ", "FieldID" => "net_txrate", "FieldDefine" => "SYSLOG_NET_TXRATE", "FieldCaption" => "TX Rate", "FieldType" => 0, "FieldAlign" => "left", "SearchField" => "net_txrate", "DefaultWidth" => 75, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0)
|
"net_txrate" => array (", ", "FieldID" => "net_txrate", "FieldDefine" => "SYSLOG_NET_TXRATE", "FieldCaption" => "TX Rate", "FieldType" => 0, "FieldAlign" => "left", "SearchField" => "net_txrate", "DefaultWidth" => 75, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
public function MsgParser_wireless() {
|
public function MsgParser_wireless() {
|
||||||
|
|
||||||
// TODO AUTOMATICALLY PERFORM FIELD INSERTS!
|
// TODO AUTOMATICALLY PERFORM FIELD INSERTS!
|
||||||
|
|
||||||
return; // Nothing
|
return; // Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ParseLine
|
* ParseLine
|
||||||
*
|
*
|
||||||
* @param arrArguments array in&out: properties of interest. There can be no guarantee the logstream can actually deliver them.
|
* @param arrArguments array in&out: properties of interest. There can be no guarantee the logstream can actually deliver them.
|
||||||
* @return integer Error stat
|
* @return integer Error stat
|
||||||
*/
|
*/
|
||||||
public function ParseMsg($szMsg, &$arrArguments)
|
public function ParseMsg($szMsg, &$arrArguments)
|
||||||
{
|
{
|
||||||
global $content, $fields;
|
global $content, $fields;
|
||||||
|
|
||||||
//trim the msg first to remove spaces from begin and end
|
//trim the msg first to remove spaces from begin and end
|
||||||
$szMsg = trim($szMsg);
|
$szMsg = trim($szMsg);
|
||||||
//return ERROR_MSG_NOMATCH;
|
|
||||||
|
// Sample: Oct 14 21:05:52 script,info INICIO; Madrid-arturosoria ;wlan1 ;00:1F:3A:66:70:09 ;192.168.10.117 ;24Mbps ;36Mbps ;15:50:56 ;00:00:00.080 ;-80dBm@1Mbps ;21 ;78 ;43351,126437 ;2959,377
|
||||||
// Sample: Oct 14 21:05:52 script,info INICIO; Madrid-arturosoria ;wlan1 ;00:1F:3A:66:70:09 ;192.168.10.117 ;24Mbps ;36Mbps ;15:50:56 ;00:00:00.080 ;-80dBm@1Mbps ;21 ;78 ;43351,126437 ;2959,377
|
if ( preg_match('/(.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?)$/', $szMsg, $out) )
|
||||||
if ( preg_match('/(...)(?:.|..)([0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}) (.*?),(.*?) (.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?)$/', $szMsg, $out) )
|
{
|
||||||
{
|
$arrArguments[SYSLOG_HOST] = $out[1];
|
||||||
|
|
||||||
//print_r ( $out );
|
// Set wlan log specific properties!
|
||||||
//exit;
|
$arrArguments[SYSLOG_NET_INTERFACE] = trim($out[2]);
|
||||||
|
$arrArguments[SYSLOG_NET_MAC_ADDRESS] = trim($out[3]);
|
||||||
// Set generic properties
|
$arrArguments[SYSLOG_NET_LASTIP] = trim($out[4]);
|
||||||
$arrArguments[SYSLOG_DATE] = GetEventTime($out[1] . " " . $out[2]);
|
$arrArguments[SYSLOG_NET_RXRATE] = trim($out[5]);
|
||||||
$arrArguments[SYSLOG_HOST] = $out[6];
|
$arrArguments[SYSLOG_NET_TXRATE] = trim($out[6]);
|
||||||
// $arrArguments[SYSLOG_DATE] = GetEventTime($out[4]);
|
$arrArguments[SYSLOG_NET_UPTIME] = trim($out[7]);
|
||||||
|
$arrArguments[SYSLOG_NET_LASTACTIVITY] = trim($out[8]);
|
||||||
// Set wlan log specific properties!
|
$arrArguments[SYSLOG_NET_SIGNALSTRENGTH] = trim($out[9]);
|
||||||
$arrArguments[SYSLOG_NET_INTERFACE] = trim($out[7]);
|
|
||||||
$arrArguments[SYSLOG_NET_MAC_ADDRESS] = trim($out[8]);
|
// Number based fields
|
||||||
$arrArguments[SYSLOG_NET_LASTIP] = trim($out[9]);
|
$arrArguments[SYSLOG_NET_SIGNALTONOISE] = $out[10];
|
||||||
$arrArguments[SYSLOG_NET_RXRATE] = trim($out[10]);
|
$arrArguments[SYSLOG_NET_TXCCQ] = $out[11];
|
||||||
$arrArguments[SYSLOG_NET_TXRATE] = trim($out[11]);
|
|
||||||
$arrArguments[SYSLOG_NET_UPTIME] = trim($out[12]);
|
// Set msg to whole logline
|
||||||
$arrArguments[SYSLOG_NET_LASTACTIVITY] = trim($out[13]);
|
$arrArguments[SYSLOG_MESSAGE] = $out[0];
|
||||||
$arrArguments[SYSLOG_NET_SIGNALSTRENGTH] = trim($out[14]);
|
|
||||||
|
// Get additional parameters!
|
||||||
// Number based fields
|
if ( preg_match('/(.|.*?[0-9]{1,12}.*?),(.|.*?[0-9]{1,12}.*?);(.|.*?[0-9]{1,12}.*?),(.|.*?[0-9]{1,12}.*?)$/', $out[12], $out2) )
|
||||||
$arrArguments[SYSLOG_NET_SIGNALTONOISE] = $out[15];
|
{
|
||||||
$arrArguments[SYSLOG_NET_TXCCQ] = $out[16];
|
$arrArguments[SYSLOG_NET_BYTESRECIEVED] = $out2[1];
|
||||||
|
$arrArguments[SYSLOG_NET_BYTESSEND] = $out2[2];
|
||||||
// Set msg to whole logline
|
$arrArguments[SYSLOG_NET_PACKETSRECIEVED] = $out2[3];
|
||||||
$arrArguments[SYSLOG_MESSAGE] = $out[0];
|
$arrArguments[SYSLOG_NET_PACKETSSEND] = $out2[4];
|
||||||
|
}
|
||||||
// Get additional parameters!
|
else
|
||||||
if ( preg_match('/(.|.*?[0-9]{1,12}.*?),(.|.*?[0-9]{1,12}.*?);(.|.*?[0-9]{1,12}.*?),(.|.*?[0-9]{1,12}.*?)$/', $out[17], $out2) )
|
{
|
||||||
{
|
$arrArguments[SYSLOG_NET_BYTESRECIEVED] = "";
|
||||||
$arrArguments[SYSLOG_NET_BYTESRECIEVED] = $out2[1];
|
$arrArguments[SYSLOG_NET_BYTESSEND] = "";
|
||||||
$arrArguments[SYSLOG_NET_BYTESSEND] = $out2[2];
|
$arrArguments[SYSLOG_NET_PACKETSRECIEVED] = "";
|
||||||
$arrArguments[SYSLOG_NET_PACKETSRECIEVED] = $out2[3];
|
$arrArguments[SYSLOG_NET_PACKETSSEND] = "";
|
||||||
$arrArguments[SYSLOG_NET_PACKETSSEND] = $out2[4];
|
}
|
||||||
}
|
|
||||||
else
|
if ( $this->_MsgNormalize == 1 )
|
||||||
{
|
{
|
||||||
$arrArguments[SYSLOG_NET_BYTESRECIEVED] = "";
|
//Init tmp msg
|
||||||
$arrArguments[SYSLOG_NET_BYTESSEND] = "";
|
$szTmpMsg = "";
|
||||||
$arrArguments[SYSLOG_NET_PACKETSRECIEVED] = "";
|
|
||||||
$arrArguments[SYSLOG_NET_PACKETSSEND] = "";
|
// Create Field Array to prepend into msg! Reverse Order here
|
||||||
}
|
$myFields = array( SYSLOG_NET_PACKETSSEND, SYSLOG_NET_PACKETSRECIEVED, SYSLOG_NET_BYTESSEND, SYSLOG_NET_BYTESRECIEVED, SYSLOG_NET_TXCCQ, SYSLOG_NET_SIGNALTONOISE, SYSLOG_NET_UPTIME, SYSLOG_NET_SIGNALSTRENGTH, SYSLOG_NET_LASTACTIVITY, SYSLOG_NET_TXRATE, SYSLOG_NET_RXRATE, SYSLOG_NET_LASTIP, SYSLOG_NET_MAC_ADDRESS, SYSLOG_NET_INTERFACE, SYSLOG_HOST );
|
||||||
|
|
||||||
if ( $this->_MsgNormalize == 1 )
|
foreach ( $myFields as $myField )
|
||||||
{
|
{
|
||||||
//Init tmp msg
|
// Set Field Caption
|
||||||
$szTmpMsg = "";
|
if ( isset($fields[$myField]['FieldCaption']) )
|
||||||
|
$szFieldName = $fields[$myField]['FieldCaption'];
|
||||||
// Create Field Array to prepend into msg! Reverse Order here
|
else
|
||||||
$myFields = array( SYSLOG_NET_PACKETSSEND, SYSLOG_NET_PACKETSRECIEVED, SYSLOG_NET_BYTESSEND, SYSLOG_NET_BYTESRECIEVED, SYSLOG_NET_TXCCQ, SYSLOG_NET_SIGNALTONOISE, SYSLOG_NET_UPTIME, SYSLOG_NET_SIGNALSTRENGTH, SYSLOG_NET_LASTACTIVITY, SYSLOG_NET_TXRATE, SYSLOG_NET_RXRATE, SYSLOG_NET_LASTIP, SYSLOG_NET_MAC_ADDRESS, SYSLOG_NET_INTERFACE, SYSLOG_HOST );
|
$szFieldName = $myField;
|
||||||
|
|
||||||
foreach ( $myFields as $myField )
|
// Append Field into msg
|
||||||
{
|
$szTmpMsg = $szFieldName . ": '" . $arrArguments[$myField] . "'\n" . $szTmpMsg;
|
||||||
// Set Field Caption
|
}
|
||||||
if ( isset($fields[$myField]['FieldCaption']) )
|
|
||||||
$szFieldName = $fields[$myField]['FieldCaption'];
|
// copy finished MSG back!
|
||||||
else
|
$arrArguments[SYSLOG_MESSAGE] = $szTmpMsg;
|
||||||
$szFieldName = $myField;
|
}
|
||||||
|
}
|
||||||
// Append Field into msg
|
// Sample: Madrid-arturosoria ;wlan1 ;00:1F:3A:66:70:09 ;192.168.10.117 ;24Mbps ;36Mbps ;15:50:56 ;00:00:00.080 ;-80dBm@1Mbps ;21 ;78 ;43351,126437 ;2959,377
|
||||||
$szTmpMsg = $szFieldName . ": '" . $arrArguments[$myField] . "'\n" . $szTmpMsg;
|
else if ( preg_match('/(...)(?:.|..)([0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}) (.*?),(.*?) (.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?);(.|.*?)$/', $szMsg, $out) )
|
||||||
}
|
{
|
||||||
|
|
||||||
// copy finished MSG back!
|
//print_r ( $out );
|
||||||
$arrArguments[SYSLOG_MESSAGE] = $szTmpMsg;
|
//exit;
|
||||||
}
|
|
||||||
}
|
// Set generic properties
|
||||||
else
|
$arrArguments[SYSLOG_DATE] = GetEventTime($out[1] . " " . $out[2]);
|
||||||
{
|
$arrArguments[SYSLOG_HOST] = $out[6];
|
||||||
// return no match in this case!
|
// $arrArguments[SYSLOG_DATE] = GetEventTime($out[4]);
|
||||||
return ERROR_MSG_NOMATCH;
|
|
||||||
}
|
// Set wlan log specific properties!
|
||||||
|
$arrArguments[SYSLOG_NET_INTERFACE] = trim($out[7]);
|
||||||
// Set IUT Property if success!
|
$arrArguments[SYSLOG_NET_MAC_ADDRESS] = trim($out[8]);
|
||||||
$arrArguments[SYSLOG_MESSAGETYPE] = IUT_Syslog;
|
$arrArguments[SYSLOG_NET_LASTIP] = trim($out[9]);
|
||||||
|
$arrArguments[SYSLOG_NET_RXRATE] = trim($out[10]);
|
||||||
// If we reached this position, return success!
|
$arrArguments[SYSLOG_NET_TXRATE] = trim($out[11]);
|
||||||
return SUCCESS;
|
$arrArguments[SYSLOG_NET_UPTIME] = trim($out[12]);
|
||||||
}
|
$arrArguments[SYSLOG_NET_LASTACTIVITY] = trim($out[13]);
|
||||||
}
|
$arrArguments[SYSLOG_NET_SIGNALSTRENGTH] = trim($out[14]);
|
||||||
|
|
||||||
|
// Number based fields
|
||||||
|
$arrArguments[SYSLOG_NET_SIGNALTONOISE] = $out[15];
|
||||||
|
$arrArguments[SYSLOG_NET_TXCCQ] = $out[16];
|
||||||
|
|
||||||
|
// Set msg to whole logline
|
||||||
|
$arrArguments[SYSLOG_MESSAGE] = $out[0];
|
||||||
|
|
||||||
|
// Get additional parameters!
|
||||||
|
if ( preg_match('/(.|.*?[0-9]{1,12}.*?),(.|.*?[0-9]{1,12}.*?);(.|.*?[0-9]{1,12}.*?),(.|.*?[0-9]{1,12}.*?)$/', $out[17], $out2) )
|
||||||
|
{
|
||||||
|
$arrArguments[SYSLOG_NET_BYTESRECIEVED] = $out2[1];
|
||||||
|
$arrArguments[SYSLOG_NET_BYTESSEND] = $out2[2];
|
||||||
|
$arrArguments[SYSLOG_NET_PACKETSRECIEVED] = $out2[3];
|
||||||
|
$arrArguments[SYSLOG_NET_PACKETSSEND] = $out2[4];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$arrArguments[SYSLOG_NET_BYTESRECIEVED] = "";
|
||||||
|
$arrArguments[SYSLOG_NET_BYTESSEND] = "";
|
||||||
|
$arrArguments[SYSLOG_NET_PACKETSRECIEVED] = "";
|
||||||
|
$arrArguments[SYSLOG_NET_PACKETSSEND] = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $this->_MsgNormalize == 1 )
|
||||||
|
{
|
||||||
|
//Init tmp msg
|
||||||
|
$szTmpMsg = "";
|
||||||
|
|
||||||
|
// Create Field Array to prepend into msg! Reverse Order here
|
||||||
|
$myFields = array( SYSLOG_NET_PACKETSSEND, SYSLOG_NET_PACKETSRECIEVED, SYSLOG_NET_BYTESSEND, SYSLOG_NET_BYTESRECIEVED, SYSLOG_NET_TXCCQ, SYSLOG_NET_SIGNALTONOISE, SYSLOG_NET_UPTIME, SYSLOG_NET_SIGNALSTRENGTH, SYSLOG_NET_LASTACTIVITY, SYSLOG_NET_TXRATE, SYSLOG_NET_RXRATE, SYSLOG_NET_LASTIP, SYSLOG_NET_MAC_ADDRESS, SYSLOG_NET_INTERFACE, SYSLOG_HOST );
|
||||||
|
|
||||||
|
foreach ( $myFields as $myField )
|
||||||
|
{
|
||||||
|
// Set Field Caption
|
||||||
|
if ( isset($fields[$myField]['FieldCaption']) )
|
||||||
|
$szFieldName = $fields[$myField]['FieldCaption'];
|
||||||
|
else
|
||||||
|
$szFieldName = $myField;
|
||||||
|
|
||||||
|
// Append Field into msg
|
||||||
|
$szTmpMsg = $szFieldName . ": '" . $arrArguments[$myField] . "'\n" . $szTmpMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy finished MSG back!
|
||||||
|
$arrArguments[SYSLOG_MESSAGE] = $szTmpMsg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// return no match in this case!
|
||||||
|
return ERROR_MSG_NOMATCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set IUT Property if success!
|
||||||
|
$arrArguments[SYSLOG_MESSAGETYPE] = IUT_Syslog;
|
||||||
|
|
||||||
|
// If we reached this position, return success!
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -892,14 +892,14 @@ function DieWithErrorMsg( $szerrmsg )
|
|||||||
echo
|
echo
|
||||||
"<html><title>phpLogCon :: Critical Error occured</title><head>" .
|
"<html><title>phpLogCon :: 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\"><tr>".
|
"<table width=\"600\" align=\"center\" class=\"with_border_alternate ErrorMsg\" cellpadding=\"2\"><tr>".
|
||||||
"<td class=\"PriorityError\" align=\"center\" colspan=\"2\">" .
|
"<td class=\"PriorityError\" align=\"center\" colspan=\"2\">" .
|
||||||
"<H3>Critical Error occured</H3>" .
|
"<H3>Critical Error occured</H3>" .
|
||||||
"</td></tr>" .
|
"</td></tr>" .
|
||||||
"<tr><td class=\"cellmenu1\" align=\"left\">Errordetails:</td>" .
|
"<tr><td class=\"cellmenu1_naked\" align=\"left\">Errordetails:</td>" .
|
||||||
"<td class=\"tableBackground\" align=\"left\">" .
|
"<td class=\"tableBackground\" align=\"left\"><br>" .
|
||||||
$szerrmsg .
|
$szerrmsg .
|
||||||
"</td></tr></table>" .
|
"<br><br></td></tr></table>" .
|
||||||
"</body></html>";
|
"</body></html>";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -910,14 +910,14 @@ function DieWithFriendlyErrorMsg( $szerrmsg )
|
|||||||
echo
|
echo
|
||||||
"<html><title>phpLogCon :: Error occured</title><head>" .
|
"<html><title>phpLogCon :: 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\"><tr>".
|
"<table width=\"600\" align=\"center\" class=\"with_border_alternate ErrorMsg\" cellpadding=\"2\"><tr>".
|
||||||
"<td class=\"PriorityWarning\" align=\"center\" colspan=\"2\">" .
|
"<td class=\"PriorityWarning\" align=\"center\" colspan=\"2\">" .
|
||||||
"<H3>Error occured</H3>" .
|
"<H3>Error occured</H3>" .
|
||||||
"</td></tr>" .
|
"</td></tr>" .
|
||||||
"<tr><td class=\"cellmenu1\" align=\"left\">Errordetails:</td>" .
|
"<tr><td class=\"cellmenu1_naked\" align=\"left\">Errordetails:</td>" .
|
||||||
"<td class=\"tableBackground\" align=\"left\">" .
|
"<td class=\"tableBackground\" align=\"left\"><br>" .
|
||||||
$szerrmsg .
|
$szerrmsg .
|
||||||
"</td></tr></table>" .
|
"<br><br></td></tr></table>" .
|
||||||
"</body></html>";
|
"</body></html>";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -1005,6 +1005,12 @@ function RedirectPage( $newpage )
|
|||||||
|
|
||||||
function RedirectResult( $szMsg, $newpage )
|
function RedirectResult( $szMsg, $newpage )
|
||||||
{
|
{
|
||||||
|
global $content;
|
||||||
|
|
||||||
|
if ( defined('PHPLOGCON_INERROR') )
|
||||||
|
DieWithErrorMsg( GetAndReplaceLangStr($content["LN_ERROR_REDIRECTABORTED"], $newpage) );
|
||||||
|
|
||||||
|
// Perform redirect!
|
||||||
header("Location: result.php?msg=" . urlencode($szMsg) . "&redir=" . urlencode($newpage));
|
header("Location: result.php?msg=" . urlencode($szMsg) . "&redir=" . urlencode($newpage));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -1507,6 +1513,22 @@ function list_files($directory, $failOnError = true)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Helper function to flush html output to avoid redirects if errors happen!
|
||||||
|
*/
|
||||||
|
function FlushHtmlOutput()
|
||||||
|
{
|
||||||
|
global $RUNMODE;
|
||||||
|
|
||||||
|
// not needed in console mode
|
||||||
|
if ( $RUNMODE == RUNMODE_COMMANDLINE )
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Flush php output
|
||||||
|
@flush();
|
||||||
|
@ob_flush();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Helper function to get the errorCode
|
* Helper function to get the errorCode
|
||||||
*/
|
*/
|
||||||
|
@ -216,6 +216,9 @@ function DB_PrintError($MyErrorMsg, $DieOrNot)
|
|||||||
$errdesc = mysql_error();
|
$errdesc = mysql_error();
|
||||||
$errno = mysql_errno();
|
$errno = mysql_errno();
|
||||||
|
|
||||||
|
// Define global variable so we know an error has occured!
|
||||||
|
define('PHPLOGCON_INERROR', true);
|
||||||
|
|
||||||
$errormsg="Database error: $MyErrorMsg $linesep";
|
$errormsg="Database error: $MyErrorMsg $linesep";
|
||||||
$errormsg.="mysql error: $errdesc $linesep";
|
$errormsg.="mysql error: $errdesc $linesep";
|
||||||
$errormsg.="mysql error number: $errno $linesep";
|
$errormsg.="mysql error number: $errno $linesep";
|
||||||
|
@ -97,6 +97,7 @@ $content['LN_ERROR_NORECORDS'] = "Es wurden keine syslog-Einträge gefunden.
|
|||||||
$content['LN_WARNING_LOGSTREAMDISK_TIMEOUT'] = "While reading the logstream, the php script timeout forced me to abort at this point.<br><br> If you want to avoid this, please increase the phpLogCon script timeout in your config.php. If the user system is installed, you can do that in Admin center.";
|
$content['LN_WARNING_LOGSTREAMDISK_TIMEOUT'] = "While reading the logstream, the php script timeout forced me to abort at this point.<br><br> If you want to avoid this, please increase the phpLogCon script timeout in your config.php. If the user system is installed, you can do that in Admin center.";
|
||||||
$content['LN_WARNING_DBUPGRADE'] = "Database Upgrade required";
|
$content['LN_WARNING_DBUPGRADE'] = "Database Upgrade required";
|
||||||
$content['LN_WARNING_DBUPGRADE_TEXT'] = "The current installed database version is '%1'.<br>An update to version '%2' is available.";
|
$content['LN_WARNING_DBUPGRADE_TEXT'] = "The current installed database version is '%1'.<br>An update to version '%2' is available.";
|
||||||
|
$content['LN_ERROR_REDIRECTABORTED'] = 'Automatic redirect to the <a href="%1">page</a> was aborted, as an internal error occured. Please see the error details above and contact our support forums if you need assistance.';
|
||||||
|
|
||||||
// Topmenu Entries
|
// Topmenu Entries
|
||||||
$content['LN_MENU_SEARCH'] = "Suchen";
|
$content['LN_MENU_SEARCH'] = "Suchen";
|
||||||
|
@ -99,6 +99,7 @@ $content['LN_ERROR_DB_DBFIELDNOTFOUND'] = "Database Field mapping for at least o
|
|||||||
$content['LN_ERROR_FILE_NOMORETIME'] = "No more time for processing left";
|
$content['LN_ERROR_FILE_NOMORETIME'] = "No more time for processing left";
|
||||||
$content['LN_WARNING_DBUPGRADE'] = "Database Upgrade required";
|
$content['LN_WARNING_DBUPGRADE'] = "Database Upgrade required";
|
||||||
$content['LN_WARNING_DBUPGRADE_TEXT'] = "The current installed database version is '%1'.<br>An update to version '%2' is available.";
|
$content['LN_WARNING_DBUPGRADE_TEXT'] = "The current installed database version is '%1'.<br>An update to version '%2' is available.";
|
||||||
|
$content['LN_ERROR_REDIRECTABORTED'] = 'Automatic redirect to the <a href="%1">page</a> was aborted, as an internal error occured. Please see the error details above and contact our support forums if you need assistance.';
|
||||||
|
|
||||||
// Topmenu Entries
|
// Topmenu Entries
|
||||||
$content['LN_MENU_SEARCH'] = "Search";
|
$content['LN_MENU_SEARCH'] = "Search";
|
||||||
|
@ -101,6 +101,7 @@ $content['LN_ERROR_NORECORDS'] = "Sem mensagens encontradas.";
|
|||||||
$content['LN_WARNING_LOGSTREAMDISK_TIMEOUT'] = "While reading the logstream, the php script timeout forced me to abort at this point.<br><br> If you want to avoid this, please increase the phpLogCon script timeout in your config.php. If the user system is installed, you can do that in Admin center.";
|
$content['LN_WARNING_LOGSTREAMDISK_TIMEOUT'] = "While reading the logstream, the php script timeout forced me to abort at this point.<br><br> If you want to avoid this, please increase the phpLogCon script timeout in your config.php. If the user system is installed, you can do that in Admin center.";
|
||||||
$content['LN_WARNING_DBUPGRADE'] = "Database Upgrade required";
|
$content['LN_WARNING_DBUPGRADE'] = "Database Upgrade required";
|
||||||
$content['LN_WARNING_DBUPGRADE_TEXT'] = "The current installed database version is '%1'.<br>An update to version '%2' is available.";
|
$content['LN_WARNING_DBUPGRADE_TEXT'] = "The current installed database version is '%1'.<br>An update to version '%2' is available.";
|
||||||
|
$content['LN_ERROR_REDIRECTABORTED'] = 'Automatic redirect to the <a href="%1">page</a> was aborted, as an internal error occured. Please see the error details above and contact our support forums if you need assistance.';
|
||||||
|
|
||||||
// Topmenu Entries
|
// Topmenu Entries
|
||||||
$content['LN_MENU_SEARCH'] = "Search";
|
$content['LN_MENU_SEARCH'] = "Search";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user