Custom trace; bug fixes; txt plain export; page limit; See Readme for details.

This commit is contained in:
Vitaly X 2023-01-15 01:50:06 +02:00
parent 0e1114846d
commit 4845e6fc37
19 changed files with 204 additions and 92 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
src/config.php
*.bak
src/index.html

View File

@ -2,19 +2,38 @@
# loganalyzer
Adiscon LogAnalyzer, a web frontend to log data from the same folks the created rsyslog
# changes 230114
- fix bug: WHERE ( message LIKE '%LTE%unreachable%' ) give no result on filter page, yet works for charts, i.e. input = msg:LTE%unreachable (todo# in chart records have wrong date today merged with yesterday)
- cfg[EventEmptySearchDefaultFilter] - config to use in case filter is empty (first load)
- cfg[ExportUseTodayYesterday] - allow to export date in case today/yesterday enabled
- CFG[Default_AUTORELOAD_ID] - control default autoreload mode
- cfg[SESSION_MAXIMIZED] - control maximized mode
- filter: support "limit:int" tag - disable paging and query less than configured for page (LogStreamDB->_SQLcustomLimitHaltSearchAfter)
- filter: datelastx - handle as float number
- export: allow to EXPORT_PLAIN text format
- custom bug fixes
- rename SYSLOG_TRACE to CUSTOM_TRACE;
- translations: {LN_CHART_ORDERBY, LN_CHART_FILTER, LN_GEN_EMPTYSRCHFILTR, LN_GEN_EXPORT_PLAIN, LN_GEN_EXPORT_USETODAY, LN_GEN_SESSION_MAX}
# changes
- Maximize view by default
- fix chart double adding same key into search
- fix bug: chart double adding same key into search
- allow to configure ORDER BY clause
- add custom filter to chart value redirection link if such exists
- support number ranges in filter, i.e. severity:3-6 -> where severity in (3,4,5,6)
- support quoted filters, i.e. syslogtag:-="dhcp,info",-="wireless,info",-"system%,account" -> where (syslogtag <> 'dhcp,info' AND syslogtag <> 'wireless,info' AND syslogtag NOT LIKE '%system%,account%' )
- support TRACE syslog level;
- add loglevel style colors and change color for full line;
- limit empty search to 6h;
- change datelastx behaviour - use number as hours indicator, i.e. datelastx:3 is 3 hours limit
- filter: support number ranges, i.e. severity:3-6 -> where severity in (3,4,5,6)
- filter: support quoted filters, i.e. syslogtag:-="dhcp,info",-="wireless,info",-"system%,account" -> where (syslogtag <> 'dhcp,info' AND syslogtag <> 'wireless,info' AND syslogtag NOT LIKE '%system%,account%' )
- filter: support TRACE severity level;
- gui: add loglevel style colors and change color for full line;
- filter: change datelastx behaviour - use number as hours indicator, i.e. datelastx:3 is 3 hours limit
# todo
- export: add checkbox to export full filtered history (now exports selected page only)
- export: configure columns for file export (allow to remove unnecessary columns) <- exclude list of columns
- export: place ts into export filename (range from-to)
#obsolete
- filter: allow to OR msg, i.e. key1 &key2 |key3;
- filter: date{from,to} - allow to use today/yesterday + short time, i.e. today 1h same as 1h, yesterday 2h, since/after/before/etc.
- "Maximize view" - reloads page and resets search filter, hide toolbars with js instead
- changing "Autoreload" does the same as "Max. view"
- allow to manually configure log levels (severity) instead of using constants
- cfg[ExportCSVDelimiter,ExportCSVQuoteValues] - allow to EXPORT_PLAIN text format

View File

@ -167,6 +167,8 @@ if ( isset($_POST['op']) )
if ( isset ($_POST['DefaultFontSize']) ) { $content['DefaultFontSize'] = $_POST['DefaultFontSize']; }
// Read checkboxes
if ( isset ($_POST['ExportUseTodayYesterday']) ) { $content['ExportUseTodayYesterday'] = 1; } else { $content['ExportUseTodayYesterday'] = 0; }
if ( isset ($_POST['SESSION_MAXIMIZED']) ) { $content['SESSION_MAXIMIZED'] = 1; } else { $content['SESSION_MAXIMIZED'] = 0; }
if ( isset ($_POST['ViewUseTodayYesterday']) ) { $content['ViewUseTodayYesterday'] = 1; } else { $content['ViewUseTodayYesterday'] = 0; }
if ( isset ($_POST['ViewEnableDetailPopups']) ) { $content['ViewEnableDetailPopups'] = 1; } else { $content['ViewEnableDetailPopups'] = 0; }
if ( isset ($_POST['EnableContextLinks']) ) { $content['EnableContextLinks'] = 1; } else { $content['EnableContextLinks'] = 0; }
@ -195,6 +197,7 @@ if ( isset($_POST['op']) )
if ( isset ($_POST['PrependTitle']) ) { $content['PrependTitle'] = $_POST['PrependTitle']; }
if ( isset ($_POST['SearchCustomButtonCaption']) ) { $content['SearchCustomButtonCaption'] = $_POST['SearchCustomButtonCaption']; }
if ( isset ($_POST['SearchCustomButtonSearch']) ) { $content['SearchCustomButtonSearch'] = $_POST['SearchCustomButtonSearch']; }
if ( isset ($_POST['EventEmptySearchDefaultFilter']) ) { $content['EventEmptySearchDefaultFilter'] = $_POST['EventEmptySearchDefaultFilter']; }
if ( isset ($_POST['InjectHtmlHeader']) ) { $content['InjectHtmlHeader'] = $_POST['InjectHtmlHeader']; }
if ( isset ($_POST['InjectBodyHeader']) ) { $content['InjectBodyHeader'] = $_POST['InjectBodyHeader']; }
@ -256,6 +259,8 @@ if ( isset($_POST['op']) )
if ( isset ($_POST['User_PrependTitle']) ) { $USERCFG['PrependTitle'] = $_POST['User_PrependTitle']; }
if ( isset ($_POST['User_SearchCustomButtonCaption']) ) { $USERCFG['SearchCustomButtonCaption'] = $_POST['User_SearchCustomButtonCaption']; }
if ( isset ($_POST['User_SearchCustomButtonSearch']) ) { $USERCFG['SearchCustomButtonSearch'] = $_POST['User_SearchCustomButtonSearch']; }
if ( isset ($_POST['User_EventEmptySearchDefaultFilter']) ) { $USERCFG['EventEmptySearchDefaultFilter'] = $_POST['User_EventEmptySearchDefaultFilter']; }
// Save configuration variables now
SaveUserGeneralSettingsIntoDB();
@ -273,6 +278,9 @@ if ( !isset($content['InlineOnlineSearchIcons']) ) { $content['InlineOnlineSearc
if ( !isset($content['AdminChangeWaitTime']) ) { $content['AdminChangeWaitTime'] = 2; }
// Set checkbox States
if (isset($content['ExportUseTodayYesterday']) && $content['ExportUseTodayYesterday'] == 1) { $content['ExportUseTodayYesterday_checked'] = "checked"; } else { $content['ExportUseTodayYesterday_checked'] = ""; }
if (isset($content['SESSION_MAXIMIZED']) && $content['SESSION_MAXIMIZED'] == 1) { $content['SESSION_MAXIMIZED_checked'] = "checked"; } else { $content['SESSION_MAXIMIZED_checked'] = ""; }
if (isset($content['ViewUseTodayYesterday']) && $content['ViewUseTodayYesterday'] == 1) { $content['ViewUseTodayYesterday_checked'] = "checked"; } else { $content['ViewUseTodayYesterday_checked'] = ""; }
if (isset($content['ViewEnableDetailPopups']) && $content['ViewEnableDetailPopups'] == 1) { $content['ViewEnableDetailPopups_checked'] = "checked"; } else { $content['ViewEnableDetailPopups_checked'] = ""; }
if (isset($content['EnableContextLinks']) && $content['EnableContextLinks'] == 1) { $content['EnableContextLinks_checked'] = "checked"; } else { $content['EnableContextLinks_checked'] = ""; }
@ -388,6 +396,9 @@ foreach ( $content['ENCODINGS'] as &$myEncoding)
if ( $content['ENABLEUSEROPTIONS'] )
{
// Set checkbox States
if ( GetConfigSetting('ExportUseTodayYesterday', $content['ExportUseTodayYesterday'], CFGLEVEL_USER) == 1) { $content['User_ExportUseTodayYesterday_checked'] = "checked"; } else { $content['User_ExportUseTodayYesterday_checked'] = ""; }
if ( GetConfigSetting('SESSION_MAXIMIZED', $content['SESSION_MAXIMIZED'], CFGLEVEL_USER) == 1) { $content['User_SESSION_MAXIMIZED_checked'] = "checked"; } else { $content['User_SESSION_MAXIMIZED_checked'] = ""; }
if ( GetConfigSetting('ViewUseTodayYesterday', $content['ViewUseTodayYesterday'], CFGLEVEL_USER) == 1) { $content['User_ViewUseTodayYesterday_checked'] = "checked"; } else { $content['User_ViewUseTodayYesterday_checked'] = ""; }
if ( GetConfigSetting('ViewEnableDetailPopups', $content['ViewEnableDetailPopups'], CFGLEVEL_USER) == 1) { $content['User_ViewEnableDetailPopups_checked'] = "checked"; } else { $content['User_ViewEnableDetailPopups_checked'] = ""; }
if ( GetConfigSetting('EnableContextLinks', $content['EnableContextLinks'], CFGLEVEL_USER) == 1) { $content['User_EnableContextLinks_checked'] = "checked"; } else { $content['User_EnableContextLinks_checked'] = ""; }
@ -412,6 +423,8 @@ if ( $content['ENABLEUSEROPTIONS'] )
$content['User_AdminChangeWaitTime'] = GetConfigSetting('AdminChangeWaitTime', $content['AdminChangeWaitTime'], CFGLEVEL_USER);
$content['User_SearchCustomButtonCaption'] = GetConfigSetting('SearchCustomButtonCaption', $content['SearchCustomButtonCaption'], CFGLEVEL_USER);
$content['User_SearchCustomButtonSearch'] = GetConfigSetting('SearchCustomButtonSearch', $content['SearchCustomButtonSearch'], CFGLEVEL_USER);
$content['User_EventEmptySearchDefaultFilter'] = GetConfigSetting('EventEmptySearchDefaultFilter', $content['EventEmptySearchDefaultFilter'], CFGLEVEL_USER);
// ---
// --- Init for ViewDefaultTheme field!

View File

@ -472,19 +472,21 @@ abstract class LogStream {
// Only filter if value is non zero
if ( strlen($propertyvalue) > 0 && strlen($myfilter[FILTER_VALUE]) > 0 )
{
//check for % inside keyword and handle it accordingly, i.e. "key1%key2"
$strPosLike = strpos($myfilter[FILTER_VALUE], "%");
// If Syslog message, we have AND handling!
if ( $propertyname == SYSLOG_MESSAGE )
{
// Include Filter
if ( $myfilter[FILTER_MODE] & FILTER_MODE_INCLUDE )
{
if ( stripos($propertyvalue, $myfilter[FILTER_VALUE]) === false )
if ( stripos($propertyvalue, $myfilter[FILTER_VALUE]) === false && $strPosLike === false )
$bEval = false;
}
// Exclude Filter
else if ( $myfilter[FILTER_MODE] & FILTER_MODE_EXCLUDE )
{
if ( stripos($propertyvalue, $myfilter[FILTER_VALUE]) !== false )
if ( stripos($propertyvalue, $myfilter[FILTER_VALUE]) !== false && $strPosLike !== false)
$bEval = false;
}
}
@ -566,25 +568,12 @@ abstract class LogStream {
$nLogTimeStamp = $arrProperitesOut[$propertyname][EVTIME_TIMESTAMP];
if ( $myfilter[FILTER_DATEMODE] == DATEMODE_LASTX )
{
// Get current timestamp
$nNowTimeStamp = time();
//datelastx:x handle x as hours instead of constant
//Get range timestamp
$nLastXTime = time() - (60 * 60 * floatval($myfilter[FILTER_VALUE]));
if ( $myfilter[FILTER_VALUE] == DATE_LASTX_HOUR )
$nLastXTime = 60 * 60; // One Hour!
else if ( $myfilter[FILTER_VALUE] == DATE_LASTX_12HOURS )
$nLastXTime = 60 * 60 * 12; // 12 Hours!
else if ( $myfilter[FILTER_VALUE] == DATE_LASTX_24HOURS )
$nLastXTime = 60 * 60 * 24; // 24 Hours!
else if ( $myfilter[FILTER_VALUE] == DATE_LASTX_7DAYS )
$nLastXTime = 60 * 60 * 24 * 7; // 7 days
else if ( $myfilter[FILTER_VALUE] == DATE_LASTX_31DAYS )
$nLastXTime = 60 * 60 * 24 * 31; // 31 days
else
// WTF default?
$nLastXTime = 86400;
// If Nowtime + LastX is higher then the log timestamp, the this logline is to old for us.
if ( ($nNowTimeStamp - $nLastXTime) > $nLogTimeStamp )
// If Nowtime + LastX is higher then the log timestamp, then this logline is too old for us.
if ( $nLastXTime > $nLogTimeStamp )
$bEval = false;
}
else if ( $myfilter[FILTER_DATEMODE] == DATEMODE_RANGE_FROM )
@ -768,7 +757,7 @@ abstract class LogStream {
{
// Split key and value
$tmpArray = explode(":", $myEntry, 2);
//print_r ( $tmpArray );
//echo "DEBUG: <pre>"; print_r ( $tmpArray ); echo "</pre>";
// Continue if empty filter!
if ( strlen(trim($tmpArray[FILTER_TMP_VALUE])) == 0 )
@ -792,12 +781,9 @@ abstract class LogStream {
if($numberRange){
//echo "#range#end#";
$range = $rangeStart;
for($j = $rangeStart; $j < intval($strChar); $j++){
$range .= ($j == $rangeStart)?(""):(",").$j;
for($j = $rangeStart; $j < intval($strChar)+1; $j++){
$tmpValues[] = array( FILTER_TMP_MODE => $this->SetFilterIncludeMode($j), FILTER_TMP_VALUE => $j);
}
$tmpValues[] = array( FILTER_TMP_MODE => $this->SetFilterIncludeMode($range), FILTER_TMP_VALUE => $range);
$myValueEntry = '';
$rangeStart = 0;
$numberRange = false;
@ -848,11 +834,27 @@ abstract class LogStream {
}
}
}else{
//parse severity number range, i.e. 1-8 into 1,2,3,4,5,6,7,8
if($tmpArray[FILTER_TMP_KEY] == "severity" && !isset($tmpValues) && strpos($tmpArray[FILTER_TMP_VALUE],"-")){
$rangeBounds = explode("-", $tmpArray[FILTER_TMP_VALUE]);
for($j = intval($rangeBounds[0]); $j < intval($rangeBounds[1])+1; $j++){
$tmpValues[] = array( FILTER_TMP_MODE => $this->SetFilterIncludeMode($j), FILTER_TMP_VALUE => $j);
}
}
}
// Handle filter based
switch( $tmpArray[FILTER_TMP_KEY] )
{
case "limit":
$defaultPageLimit = GetConfigSetting("ViewEntriesPerPage", 50, CFGLEVEL_USER);
if($tmpArray[FILTER_TMP_VALUE] < $defaultPageLimit){
$this->_filters["limit"][FILTER_VALUE] = $tmpArray[FILTER_TMP_VALUE];
}else
$this->_filters["limit"][FILTER_VALUE] = $defaultPageLimit;
break;
case "facility":
$tmpKeyName = SYSLOG_FACILITY;
$tmpFilterType = FILTER_TYPE_NUMBER;
@ -1285,7 +1287,7 @@ abstract class LogStream {
$pos = strpos($szValue, "+");
if ( $pos !== false && $pos == 0 )
{
//trunscate +
//truncate +
$szValue = substr( $szValue, 1);
$myBits = FILTER_MODE_INCLUDE;
}
@ -1303,7 +1305,7 @@ abstract class LogStream {
$pos = strpos($szValue, "=");
if ( $pos !== false && $pos == 0 )
{
//trunscate -
//truncate -
$szValue = substr( $szValue, 1);
// Add BIT if not NUMBER FIELD!
@ -1315,7 +1317,7 @@ abstract class LogStream {
$pos = strpos($szValue, "~");
if ( $pos !== false && $pos == 0 )
{
//trunscate -
//truncate -
$szValue = substr( $szValue, 1);
// Add BIT if not NUMBER FIELD!
if ( $myFilterType != FILTER_TYPE_NUMBER )

View File

@ -62,6 +62,7 @@ class LogStreamDB extends LogStream {
private $_SQLwhereClause = "";
private $_myDBQuery = null;
private $_SQLcustomLimitHaltSearchAfter = null; //if set, then search will stop after getting this records
// Constructor
public function __construct ($streamConfigObj) {
@ -545,6 +546,12 @@ class LogStreamDB extends LogStream {
$ret = $this->ReadNextRecordsFromDB($uID);
else
{
// Override default value if custom limit is less - act as tail without paging
// NB it won't work if custom limit gt page limit
$limit = $this->_SQLcustomLimitHaltSearchAfter;
if(isset($limit) && $this->_currentRecordNum >= $limit)
$ret = ERROR_NOMORERECORDS;
if ( !isset($this->bufferedRecords[$this->_currentRecordNum] ) )
{
// We need to load new records, so clear the old ones first!
@ -590,7 +597,6 @@ class LogStreamDB extends LogStream {
if ( isset($arrProperitesOut[SYSLOG_MESSAGE]) )
{
$retParser = $this->_logStreamConfigObj->ProcessMsgParsers($arrProperitesOut[SYSLOG_MESSAGE], $arrProperitesOut);
// Check if we have to skip the message!
if ( $retParser == ERROR_MSG_SKIPMESSAGE )
$ret = $retParser;
@ -618,7 +624,7 @@ class LogStreamDB extends LogStream {
// This additional filter check will take care on dynamic fields from the message parser!
} while ( $this->ApplyFilters($ret, $arrProperitesOut) != SUCCESS && $ret == SUCCESS );
// reached here means return result!
return $ret;
}
@ -1350,7 +1356,7 @@ class LogStreamDB extends LogStream {
/*
* ============= Beginn of private functions =============
* ============= Begin of private functions =============
*/
/*
@ -1361,6 +1367,11 @@ class LogStreamDB extends LogStream {
{
if ( $this->_filters != null )
{
//if filter limit set, then apply it to a query
if( isset($this->_filters['limit']) ){
$this->_SQLcustomLimitHaltSearchAfter= $this->_filters['limit'][FILTER_VALUE];
}
global $dbmapping;
$szTableType = $this->_logStreamConfigObj->DBTableType;
@ -1379,8 +1390,8 @@ class LogStreamDB extends LogStream {
}
}
// ---
//echo 'DEBUG <pre>'; print_r($arrayQueryProperties); echo '</pre>';
//echo 'DEBUG <pre>'; print_r($this->_filters); echo '</pre>';
//echo 'DEBUG <pre>'; print_r($arrayQueryProperties); echo '</pre>';
//echo 'DEBUG <pre>'; print_r($this->_filters); echo '</pre>';
// Loop through all available properties
foreach( $arrayQueryProperties as $propertyname )
{
@ -1502,7 +1513,7 @@ class LogStreamDB extends LogStream {
if ( $myfilter[FILTER_DATEMODE] == DATEMODE_LASTX )
{
// Get current timestamp
$nNowTimeStamp = time() - (60 * 60 * intval($myfilter[FILTER_VALUE]));
$nNowTimeStamp = time() - (60 * 60 * floatval($myfilter[FILTER_VALUE]));
// Append filter
$tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " > '" . date("Y-m-d H:i:s", $nNowTimeStamp) . "'";
@ -1573,8 +1584,11 @@ class LogStreamDB extends LogStream {
}
}
}
//echo $this->_SQLwhereClause."<br>";
// print direct debug only on search page
//if(strpos($_SERVER['REQUEST_URI'], "export.php") === false && strpos($_SERVER['REQUEST_URI'], "chartgenerator.php") === false){
// echo "DEBUG: ".$this->_SQLwhereClause."<br>";
//}
//$dbmapping[$szTableType][SYSLOG_UID]
}
else // No filters means nothing to do!
@ -1663,9 +1677,14 @@ class LogStreamDB extends LogStream {
$szSql = $this->CreateSQLStatement($uID);
// --- Append LIMIT
$szSql .= " LIMIT " . $this->_logStreamConfigObj->RecordsPerQuery;
// Override default value if custom is less - act as tail without paging
$limit = $this->_SQLcustomLimitHaltSearchAfter;
if ( isset($limit) === true && ($limit < $this->_logStreamConfigObj->RecordsPerQuery)){
$szSql .= " LIMIT " . $limit;
}else
$szSql .= " LIMIT " . $this->_logStreamConfigObj->RecordsPerQuery;
// ---
// Perform Database Query
$this->_myDBQuery = mysqli_query($this->_dbhandle, $szSql);
if ( !$this->_myDBQuery )

View File

@ -117,7 +117,7 @@ if ( isset($_GET['direction']) )
}
// Read filter property in
if ( isset($_POST['filter']) )
if ( isset($_POST['filter']) )
$myfilter = $_POST['filter'];
else if ( isset($_GET['filter']) )
$myfilter = $_GET['filter'];

View File

@ -245,7 +245,7 @@ if ( !$content['error_occured'] )
// Now handle fields types differently
if ( $content['fields'][$mycolkey]['FieldType'] == FILTER_TYPE_DATE )
{
$content['syslogmessages'][$counter][$mycolkey]['fieldvalue'] = GetFormatedDate($logArray[$mycolkey]);
$content['syslogmessages'][$counter][$mycolkey]['fieldvalue'] = GetFormatedDate($logArray[$mycolkey], true);
}
else if ( $content['fields'][$mycolkey]['FieldType'] == FILTER_TYPE_NUMBER )
{
@ -333,28 +333,33 @@ else
$szOutputFileName = "ExportMessages";
$szOutputFileExtension = ".txt";
if ( $content['exportformat'] == EXPORT_CVS )
{
$szOPFieldSeparator = " ";
$szOPFirstLineFieldNames = true;
$szOPQuoteValues = false;
if( $content['exportformat'] == EXPORT_CVS ){
// Set MIME TYPE and File Extension
$szOutputMimeType = "text/csv";
$szOutputFileExtension = ".csv";
$szOutputMimeType = "text/csv";
$szOutputFileExtension = ".csv";
$szOPFieldSeparator = ",";
$szOPQuoteValues = true;
}
// Set Column line in cvs file!
foreach($content['Columns'] as $mycolkey)
{
if ( isset($fields[$mycolkey]) )
if ( $content['exportformat'] == EXPORT_CVS || $content['exportformat'] == EXPORT_PLAIN) {
if($szOPFirstLineFieldNames === true){
foreach($content['Columns'] as $mycolkey)
{
// Prepend Comma if needed
if (strlen($szOutputContent) > 0)
$szOutputContent .= ",";
if ( isset($fields[$mycolkey]) )
{
// Prepend Comma if needed
if (strlen($szOutputContent) > 0) $szOutputContent .= $szOPFieldSeparator;
// Append column name
$szOutputContent .= $fields[$mycolkey]['FieldCaption'];
// Append column name
$szOutputContent .= $fields[$mycolkey]['FieldCaption'];
}
}
}
// Append line break
$szOutputContent .= "\n";
$szOutputContent .= "\n";
}
// Append messages into output
foreach ( $content['syslogmessages'] as $myIndex => $mySyslogMessage )
@ -364,19 +369,23 @@ else
// --- Process columns
foreach($mySyslogMessage as $myColkey => $mySyslogField)
{
// Prepend Comma if needed
if (strlen($szLine) > 0)
$szLine .= ",";
// Prepend separator if needed
if (strlen($szLine) > 0) $szLine .= $szOPFieldSeparator;
// Append field contents
$szLine .= '"' . str_replace('"', '\\"', $mySyslogField['fieldvalue']) . '"';
if($szOPQuoteValues === true) {
$szLine .= '"' . str_replace('"', '\\"', $mySyslogField['fieldvalue']) . '"';
}else{
$szLine .= $mySyslogField['fieldvalue'];
}
}
// ---
// ---
// Append line!
$szOutputContent .= $szLine . "\n";
}
}
}
else if ( $content['exportformat'] == EXPORT_XML )
{
// Set MIME TYPE and File Extension

View File

@ -80,6 +80,9 @@ $CFG['MiscMaxExecutionTime'] = 30; // LogAnalyzer will try to overwrite the de
$CFG['DebugUserLogin'] = 0; // if enabled, you will see additional informations on failed logins
// ---
// --- Default Export options
$CFG['ExportUseTodayYesterday'] = 0; // Same as ViewUseTodayYesterday. By default export normal dates
// --- Default Frontend Options
$CFG['PrependTitle'] = ""; // If set, this text will be prepended withint the title tag
$CFG['ViewUseTodayYesterday'] = 1; // If enabled, the date from today and yesterday is displayed as "today" and "yesterday"
@ -92,6 +95,9 @@ $CFG['ViewDefaultTheme'] = "default"; // This sets the default theme the user i
$CFG['ViewDefaultLanguage'] = "en"; // Sets the default display language
$CFG['ViewEnableAutoReloadSeconds'] = 0; // If "ViewEnableAutoReloadSeconds" is set to anything higher the 0 (which means disabled), this means auto reload is enabled by default.
$CFG['Default_AUTORELOAD_ID'] = 0; // By default disable autoreload (select id, 1 for user-defined)
$CFG['SESSION_MAXIMIZED'] = 0; // If enabled start session in maximized mode
$CFG['SearchCustomButtonCaption'] = "I'd like to feel sad"; // Default caption for the custom fast search button
$CFG['SearchCustomButtonSearch'] = "error"; // Default search string for the custom search button
@ -125,10 +131,10 @@ $CFG['DefaultViewsID'] = "";
$CFG['Search'][] = array ( "DisplayName" => "Syslog Warnings and Errors", "SearchQuery" => "filter=severity%3A0%2C1%2C2%2C3%2C4&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "Syslog Errors", "SearchQuery" => "filter=severity%3A0%2C1%2C2%2C3&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from the last hour", "SearchQuery" => "filter=datelastx%3A1&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 12 hours", "SearchQuery" => "filter=datelastx%3A2&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 24 hours", "SearchQuery" => "filter=datelastx%3A3&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 7 days", "SearchQuery" => "filter=datelastx%3A4&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 31 days", "SearchQuery" => "filter=datelastx%3A5&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 12 hours", "SearchQuery" => "filter=datelastx%3A12&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 24 hours", "SearchQuery" => "filter=datelastx%3A24&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 7 days", "SearchQuery" => "filter=datelastx%3A168&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 31 days", "SearchQuery" => "filter=datelastx%3A744&search=Search" );
// $CFG['Search'][] = array ( "DisplayName" => "", "SearchQuery" => "" );
// ---

View File

@ -109,7 +109,7 @@ $content['filter_severity_list'][] = array( "ID" => SYSLOG_WARNING, "DisplayName
$content['filter_severity_list'][] = array( "ID" => SYSLOG_NOTICE, "DisplayName" => "NOTICE", "selected" => "" );
$content['filter_severity_list'][] = array( "ID" => SYSLOG_INFO, "DisplayName" => "INFO", "selected" => "" );
$content['filter_severity_list'][] = array( "ID" => SYSLOG_DEBUG, "DisplayName" => "DEBUG", "selected" => "" );
$content['filter_severity_list'][] = array( "ID" => SYSLOG_TRACE, "DisplayName" => "TRACE", "selected" => "" );
$content['filter_severity_list'][] = array( "ID" => CUSTOM_TRACE, "DisplayName" => "TRACE", "selected" => "" );
// ---

View File

@ -76,6 +76,7 @@ define('SOURCE_CLICKHOUSE', '5');
// ---
// --- Exportformat defines
define('EXPORT_PLAIN', 'TXT');
define('EXPORT_CVS', 'CVS');
define('EXPORT_XML', 'XML');
// ---
@ -169,7 +170,7 @@ define('SYSLOG_WARNING', 4);
define('SYSLOG_NOTICE', 5);
define('SYSLOG_INFO', 6);
define('SYSLOG_DEBUG', 7);
define('SYSLOG_TRACE', 8);
define('CUSTOM_TRACE', 8);
$severity_colors[SYSLOG_EMERG] = "#840A15";
$severity_colors[SYSLOG_ALERT] = "#BA0716";
@ -179,7 +180,7 @@ $severity_colors[SYSLOG_WARNING] = "#EF8200";
$severity_colors[SYSLOG_NOTICE] = "#14AD42";
$severity_colors[SYSLOG_INFO] = "#0C9C91";
$severity_colors[SYSLOG_DEBUG] = "#119BDE";
$severity_colors[SYSLOG_TRACE] = "#C0C381";
$severity_colors[CUSTOM_TRACE] = "#C0C381";
// ---

View File

@ -511,7 +511,7 @@ function CreateReloadTimesList()
if ( $tmpReloadSeconds > 0 )
{
//by default select predefined value
$_SESSION['AUTORELOAD_ID'] = 1;
$_SESSION['AUTORELOAD_ID'] = GetConfigSetting("Default_AUTORELOAD_ID", 0, CFGLEVEL_USER);
$content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_PRECONFIGURED'] . " (" . $tmpReloadSeconds . " " . $content['LN_AUTORELOAD_SECONDS'] . ") ", "Value" => $tmpReloadSeconds ); $iCounter++;
}
$content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 5 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 5 ); $iCounter++;
@ -537,6 +537,7 @@ function CreateExportFormatList()
global $content;
// Add basic formats!
$content['EXPORTTYPES'][EXPORT_PLAIN] = array( "ID" => EXPORT_PLAIN, "Selected" => "", "DisplayName" => $content['LN_GEN_EXPORT_PLAIN'] );
$content['EXPORTTYPES'][EXPORT_CVS] = array( "ID" => EXPORT_CVS, "Selected" => "", "DisplayName" => $content['LN_GEN_EXPORT_CVS'] );
$content['EXPORTTYPES'][EXPORT_XML] = array( "ID" => EXPORT_XML, "Selected" => "", "DisplayName" => $content['LN_GEN_EXPORT_XML'] );
@ -1798,6 +1799,9 @@ function SaveGeneralSettingsIntoDB($bForceStripSlahes = false)
WriteConfigValue( "ViewDefaultLanguage", true, null, null,$bForceStripSlahes );
WriteConfigValue( "ViewDefaultTheme", true, null, null,$bForceStripSlahes );
WriteConfigValue( "ExportUseTodayYesterday", true, null, null,$bForceStripSlahes );
WriteConfigValue( "SESSION_MAXIMIZED", true, null, null,$bForceStripSlahes );
WriteConfigValue( "ViewUseTodayYesterday", true, null, null,$bForceStripSlahes );
WriteConfigValue( "ViewEnableDetailPopups", true, null, null,$bForceStripSlahes );
WriteConfigValue( "EnableContextLinks", true, null, null,$bForceStripSlahes );
@ -1820,6 +1824,7 @@ function SaveGeneralSettingsIntoDB($bForceStripSlahes = false)
WriteConfigValue( "PrependTitle", true, null, null,$bForceStripSlahes );
WriteConfigValue( "SearchCustomButtonCaption", true, null, null,$bForceStripSlahes );
WriteConfigValue( "SearchCustomButtonSearch", true, null, null,$bForceStripSlahes );
WriteConfigValue( "EventEmptySearchDefaultFilter", true, null, null,$bForceStripSlahes );
// Extra Fields
WriteConfigValue( "DefaultViewsID", true, null, null,$bForceStripSlahes );
@ -1849,6 +1854,9 @@ function SaveUserGeneralSettingsIntoDB()
WriteConfigValue( "ViewDefaultLanguage", false, $content['SESSION_USERID']);
WriteConfigValue( "ViewDefaultTheme", false, $content['SESSION_USERID'] );
WriteConfigValue( "ExportUseTodayYesterday", false, $content['SESSION_USERID']);
WriteConfigValue( "SESSION_MAXIMIZED", false, $content['SESSION_USERID']);
WriteConfigValue( "ViewUseTodayYesterday", false, $content['SESSION_USERID'] );
WriteConfigValue( "ViewEnableDetailPopups", false, $content['SESSION_USERID'] );
WriteConfigValue( "EnableContextLinks", false, $content['SESSION_USERID'] );
@ -1871,7 +1879,8 @@ function SaveUserGeneralSettingsIntoDB()
WriteConfigValue( "PrependTitle", false, $content['SESSION_USERID'] );
WriteConfigValue( "SearchCustomButtonCaption", false, $content['SESSION_USERID'] );
WriteConfigValue( "SearchCustomButtonSearch", false, $content['SESSION_USERID'] );
WriteConfigValue( "EventEmptySearchDefaultFilter", false, $content['SESSION_USERID'] );
// Extra Fields
WriteConfigValue( "DefaultViewsID", false, $content['SESSION_USERID'] );
WriteConfigValue( "DefaultSourceID", false, $content['SESSION_USERID'] );

View File

@ -237,7 +237,7 @@ function InitFilterHelpers()
if ( isset($_SESSION['filter_severity']) )
$filters['filter_severity'] = intval($_SESSION['filter_severity']);
else
$filters['filter_severity'] = array ( SYSLOG_EMERG, SYSLOG_ALERT, SYSLOG_CRIT, SYSLOG_ERR, SYSLOG_WARNING, SYSLOG_NOTICE, SYSLOG_INFO, SYSLOG_DEBUG, SYSLOG_TRACE );
$filters['filter_severity'] = array ( SYSLOG_EMERG, SYSLOG_ALERT, SYSLOG_CRIT, SYSLOG_ERR, SYSLOG_WARNING, SYSLOG_NOTICE, SYSLOG_INFO, SYSLOG_DEBUG, CUSTOM_TRACE );
$iCount = count($content['filter_severity_list']);
for ( $i = 0; $i < $iCount; $i++ )

View File

@ -220,17 +220,19 @@ function CreateCurrentUrl()
// done
}
function GetFormatedDate($evttimearray)
function GetFormatedDate($evttimearray, $onExport = false)
{
global $content;
if ( is_array($evttimearray) )
{
if (
GetConfigSetting("ViewUseTodayYesterday", 0, CFGLEVEL_USER) == 1
&&
( date('m', $evttimearray[EVTIME_TIMESTAMP]) == date('m') && date('Y', $evttimearray[EVTIME_TIMESTAMP]) == date('Y') )
)
($onExport == true && GetConfigSetting("ExportUseTodayYesterday", 0, CFGLEVEL_USER) == 1)
|| (
$onExport == false && 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') )
return "Today " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] );

View File

@ -122,13 +122,13 @@ $content['main_pager_last_found'] = false;
// Init Sorting variables
$content['sorting'] = "";
$content['searchstr'] = "";
$content['searchstr_htmlform'] = "datelastx:6 severity:-8";
$content['searchstr_htmlform'] = GetConfigSetting("EventEmptySearchDefaultFilter", "", CFGLEVEL_USER);
$content['highlightstr'] = "";
$content['highlightstr_htmlform'] = "";
$content['EXPAND_HIGHLIGHT'] = "false";
// hide header by default
$_SESSION['SESSION_MAXIMIZED'] = true;
// Control header visibility
$_SESSION['SESSION_MAXIMIZED'] = GetConfigSetting("SESSION_MAXIMIZED", 0, CFGLEVEL_USER);
// --- Read and process filters from search dialog!
if ( (isset($_POST['search']) || isset($_GET['search'])) || (isset($_POST['filter']) || isset($_GET['filter'])) )

View File

@ -87,6 +87,7 @@ $content['LN_GEN_ADMINCHANGEWAITTIME'] = "Reloadtime in Adminpanel";
$content['LN_GEN_IPADRRESOLVE'] = "Resolve IP Addresses using DNS";
$content['LN_GEN_CUSTBTNCAPT'] = "Custom search caption";
$content['LN_GEN_CUSTBTNSRCH'] = "Custom search string";
$content['LN_GEN_EMPTYSRCHFILTR'] = "Override empty search filter";
$content['LN_GEN_SUCCESSFULLYSAVED'] = "The configuration Values have been successfully saved";
$content['LN_GEN_INTERNAL'] = "Internal";
$content['LN_GEN_DISABLED'] = "Function disabled";
@ -104,6 +105,7 @@ $content['LN_GEN_GLOBALVALUE'] = "Global value";
$content['LN_GEN_PERSONALVALUE'] = "Personal (User)value";
$content['LN_GEN_DISABLEUSEROPTIONS'] = "Click here to disable personal options";
$content['LN_GEN_ENABLEUSEROPTIONS'] = "Click here to enable personal options";
$content['LN_GEN_EXPORT_USETODAY'] = "Use Today and Yesterday in timefields of export";
$content['LN_ADMIN_GLOBALONLY'] = "Global Options Only";
$content['LN_GEN_DEBUGTOSYSLOG'] = "Send Debug to local syslog server";
$content['LN_GEN_POPUPMENUTIMEOUT'] = "Popupmenu Timeout in milli seconds";
@ -118,6 +120,7 @@ $content['LN_ADMIN_USEPROXYSERVER'] = "Leave empty if you do not want to use a p
$content['LN_ADMIN_DEFAULTENCODING'] = "Default character encoding";
$content['LN_GEN_CONTEXTLINKS'] = "Enable Contextlinks (Question marks)";
$content['LN_GEN_DISABLEADMINUSERS'] = "Disable Adminpanel for normal users";
$content['LN_GEN_SESSION_MAX'] = "Load page in maximized mode";
// User Center
$content['LN_USER_CENTER'] = "User Options";

View File

@ -86,6 +86,7 @@ $content['LN_GEN_SELECTEXPORT'] = "&gt; Select Exportformat &lt;";
$content['LN_GEN_EXPORT_CVS'] = "CSV (Comma separated)";
$content['LN_GEN_EXPORT_XML'] = "XML";
$content['LN_GEN_EXPORT_PDF'] = "PDF";
$content['LN_GEN_EXPORT_PLAIN'] = "Plain TXT";
$content['LN_GEN_ERROR_EXPORING'] = "Error exporting data";
$content['LN_GEN_ERROR_INVALIDEXPORTTYPE'] = "Invalid Export format selected, or other parameters were wrong.";
$content['LN_GEN_ERROR_SOURCENOTFOUND'] = "The Source with ID '%1' could not be found.";
@ -337,6 +338,8 @@ $content['LN_CONVERT_ERROR_SOURCEIMPORT'] = "Critical Error while importing the
$content['LN_CHART_TYPE'] = "Chart type";
$content['LN_CHART_WIDTH'] = "Chart width";
$content['LN_CHART_FIELD'] = "Chart field";
$content['LN_CHART_FILTER'] = "SQL Query filter";
$content['LN_CHART_ORDERBY'] = "SQL ORDER BY";
$content['LN_CHART_MAXRECORDS'] = "Top records count";
$content['LN_CHART_SHOWPERCENT'] = "Show percentage data";
$content['LN_CHART_TYPE_CAKE'] = "Cake (Pie)";

View File

@ -228,6 +228,14 @@
<td align="left" class="line1" ><input type="text" name="User_SearchCustomButtonSearch" size="35" maxlength="255" value="{User_SearchCustomButtonSearch}" class="maxwidth"></td>
<!-- ENDIF ENABLEUSEROPTIONS="true" -->
</tr>
<tr>
<td align="left" class="cellmenu2" nowrap><b>{LN_GEN_EMPTYSRCHFILTR}</b></td>
<td align="left" class="line1" ><input type="text" name="EventEmptySearchDefaultFilter" size="35" maxlength="255" value="{EventEmptySearchDefaultFilter}" {DISABLE_GLOBALEDIT_FORMCONTROL} class="maxwidth"></td>
<!-- IF ENABLEUSEROPTIONS="true" -->
<td align="left" class="line1" ><input type="text" name="User_EventEmptySearchDefaultFilter" size="35" maxlength="255" value="{User_EventEmptySearchDefaultFilter}" class="maxwidth"></td>
<!-- ENDIF ENABLEUSEROPTIONS="true" -->
</tr>
<tr>
<td align="left" class="cellmenu2" nowrap><b>{LN_GEN_USETODAY}</b></td>
<td align="left" class="line2" ><input type="checkbox" name="ViewUseTodayYesterday" value="yes" {ViewUseTodayYesterday_checked} {DISABLE_GLOBALEDIT_FORMCONTROL}></td>
@ -235,6 +243,22 @@
<td align="left" class="line2" ><input type="checkbox" name="User_ViewUseTodayYesterday" value="yes" {User_ViewUseTodayYesterday_checked}></td>
<!-- ENDIF ENABLEUSEROPTIONS="true" -->
</tr>
<tr>
<td align="left" class="cellmenu2" nowrap><b>{LN_GEN_EXPORT_USETODAY}</b></td>
<td align="left" class="line2" ><input type="checkbox" name="ExportUseTodayYesterday" value="yes" {ExportUseTodayYesterday_checked} {DISABLE_GLOBALEDIT_FORMCONTROL}></td>
<!-- IF ENABLEUSEROPTIONS="true" -->
<td align="left" class="line2" ><input type="checkbox" name="User_ExportUseTodayYesterday" value="yes" {User_ExportUseTodayYesterday_checked}></td>
<!-- ENDIF ENABLEUSEROPTIONS="true" -->
</tr>
<tr>
<td align="left" class="cellmenu2" nowrap><b>{LN_GEN_SESSION_MAX}</b></td>
<td align="left" class="line2" ><input type="checkbox" name="SESSION_MAXIMIZED" value="yes" {SESSION_MAXIMIZED_checked} {DISABLE_GLOBALEDIT_FORMCONTROL}></td>
<!-- IF ENABLEUSEROPTIONS="true" -->
<td align="left" class="line2" ><input type="checkbox" name="User_SESSION_MAXIMIZED" value="yes" {User_SESSION_MAXIMIZED_checked}></td>
<!-- ENDIF ENABLEUSEROPTIONS="true" -->
</tr>
<tr>
<td align="left" class="cellmenu2" nowrap><b>{LN_GEN_DETAILPOPUPS}</b></td>
<td align="left" class="line1" ><input type="checkbox" name="ViewEnableDetailPopups" value="yes" {ViewEnableDetailPopups_checked} {DISABLE_GLOBALEDIT_FORMCONTROL}></td>

View File

@ -41,7 +41,7 @@
<b>{DisplayName}</b>
<!-- ENDIF ActionsAllowed!="true" -->
</td>
<td align="left" class="{cssclass}"><a href="{BASEPATH}index.php?{SearchQuery}">{SearchQuery_Display}</a></td>
<td align="left" class="{cssclass}"><a href='{BASEPATH}index.php?{SearchQuery}'>{SearchQuery_Display}</a></td>
<td align="left" class="{cssclass}"><img src="{SearchTypeImage}" width="16" align="left"> <b>{SearchTypeText}</b></td>
<td align="center" class="{cssclass}">
@ -74,7 +74,7 @@
</tr>
<tr>
<td align="left" class="cellmenu2"><b>{LN_SEARCH_QUERY}</b></td>
<td align="left" class="line2"><input type="text" name="SearchQuery" size="55" maxlength="1024" value="{SearchQuery}" class="maxwidth"></td>
<td align="left" class="line2"><input type="text" name="SearchQuery" size="55" maxlength="1024" value='{SearchQuery}' class="maxwidth"></td>
</tr>
<tr>
<td align="left" class="cellmenu2"><b>{LN_GEN_USERONLY}</b></td>

View File

@ -15,7 +15,7 @@
<button id="openmenu_searches"><span class="ui-icon ui-icon-circle-triangle-s" title="{LN_GEN_PREDEFINEDSEARCHES}"></span></button>
<ul id="menu_searches" style="position:absolute;z-index:99;display:none;">
<!-- BEGIN Search -->
<li><a href="?{SearchQuery}{additional_url_sourceonly}" target="_top">{DisplayName}</a></li>
<li><a href='?{SearchQuery}{additional_url_sourceonly}' target="_top">{DisplayName}</a></li>
<!-- END Search -->
</ul>
<script> CreateMenuFunction( "#openmenu_searches", "#menu_searches", false );</script>