From f1985040a5ef8a3ae22acef695b89edb1253b86a Mon Sep 17 00:00:00 2001 From: Vitaly X Date: Wed, 28 Dec 2022 23:59:28 +0200 Subject: [PATCH] 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; --- src/classes/logstreamdb.class.php | 7 +- src/include/constants_filters.php | 4 +- src/include/constants_general.php | 4 + src/include/functions_filters.php | 4 +- src/index.html | 375 ------------------------------ src/index.php | 11 +- src/themes/default/main.css | 48 +++- 7 files changed, 67 insertions(+), 386 deletions(-) delete mode 100644 src/index.html diff --git a/src/classes/logstreamdb.class.php b/src/classes/logstreamdb.class.php index 92aba6f..ab3fc8c 100644 --- a/src/classes/logstreamdb.class.php +++ b/src/classes/logstreamdb.class.php @@ -1496,9 +1496,10 @@ class LogStreamDB extends LogStream { if ( $myfilter[FILTER_DATEMODE] == DATEMODE_LASTX ) { // Get current timestamp - $nNowTimeStamp = time(); + + $nNowTimeStamp = time() - (60 * 60 * intval($myfilter[FILTER_VALUE])); - if ( $myfilter[FILTER_VALUE] == DATE_LASTX_HOUR ) + /*if ( $myfilter[FILTER_VALUE] == DATE_LASTX_HOUR ) $nNowTimeStamp -= 60 * 60; // One Hour! else if ( $myfilter[FILTER_VALUE] == DATE_LASTX_12HOURS ) $nNowTimeStamp -= 60 * 60 * 12; // 12 Hours! @@ -1513,7 +1514,7 @@ class LogStreamDB extends LogStream { // Set filter to unknown and Abort in this case! $tmpfilters[$propertyname][FILTER_TYPE] = FILTER_TYPE_UNKNOWN; break; - } + }*/ // Append filter $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType]['DBMAPPINGS'][$propertyname] . " > '" . date("Y-m-d H:i:s", $nNowTimeStamp) . "'"; diff --git a/src/include/constants_filters.php b/src/include/constants_filters.php index 4bb1e3b..11b74de 100644 --- a/src/include/constants_filters.php +++ b/src/include/constants_filters.php @@ -109,6 +109,8 @@ $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" => "" ); + // --- // Init MessageType LIST @@ -118,4 +120,4 @@ $content['filter_messagetype_list'][] = array( "ID" => IUT_NT_EventReport, "Disp $content['filter_messagetype_list'][] = array( "ID" => IUT_File_Monitor, "DisplayName" => "File Monitor", "selected" => "" ); $content['filter_messagetype_list'][] = array( "ID" => IUT_WEBSERVERLOG, "DisplayName" => "Webserver Logfile", "selected" => "" ); -?> \ No newline at end of file +?> diff --git a/src/include/constants_general.php b/src/include/constants_general.php index 76194d0..993432c 100644 --- a/src/include/constants_general.php +++ b/src/include/constants_general.php @@ -169,6 +169,8 @@ define('SYSLOG_WARNING', 4); define('SYSLOG_NOTICE', 5); define('SYSLOG_INFO', 6); define('SYSLOG_DEBUG', 7); +define('SYSLOG_TRACE', 8); + $severity_colors[SYSLOG_EMERG] = "#840A15"; $severity_colors[SYSLOG_ALERT] = "#BA0716"; $severity_colors[SYSLOG_CRIT] = "#CE0819"; @@ -177,6 +179,8 @@ $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"; + // --- // --- MonitorWare InfoUnit Defines | Messagetypes diff --git a/src/include/functions_filters.php b/src/include/functions_filters.php index 748186a..bb239e5 100644 --- a/src/include/functions_filters.php +++ b/src/include/functions_filters.php @@ -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 ); + $filters['filter_severity'] = array ( SYSLOG_EMERG, SYSLOG_ALERT, SYSLOG_CRIT, SYSLOG_ERR, SYSLOG_WARNING, SYSLOG_NOTICE, SYSLOG_INFO, SYSLOG_DEBUG, SYSLOG_TRACE ); $iCount = count($content['filter_severity_list']); for ( $i = 0; $i < $iCount; $i++ ) @@ -363,4 +363,4 @@ function GetDateTimeDetailsFromTimeString($szTimeString, &$second, &$minute, &$h return false; } -?> \ No newline at end of file +?> diff --git a/src/index.html b/src/index.html deleted file mode 100644 index 96ed444..0000000 --- a/src/index.html +++ /dev/null @@ -1,375 +0,0 @@ - - - - - - - Apache2 Ubuntu Default Page: It works - - - -
- - -
- - -
-
- It works! -
-
-

- This is the default welcome page used to test the correct - operation of the Apache2 server after installation on Ubuntu systems. - It is based on the equivalent page on Debian, from which the Ubuntu Apache - packaging is derived. - If you can read this page, it means that the Apache HTTP server installed at - this site is working properly. You should replace this file (located at - /var/www/html/index.html) before continuing to operate your HTTP server. -

- - -

- If you are a normal user of this web site and don't know what this page is - about, this probably means that the site is currently unavailable due to - maintenance. - If the problem persists, please contact the site's administrator. -

- -
-
-
- Configuration Overview -
-
-

- Ubuntu's Apache2 default configuration is different from the - upstream default configuration, and split into several files optimized for - interaction with Ubuntu tools. The configuration system is - fully documented in - /usr/share/doc/apache2/README.Debian.gz. Refer to this for the full - documentation. Documentation for the web server itself can be - found by accessing the manual if the apache2-doc - package was installed on this server. - -

-

- The configuration layout for an Apache2 web server installation on Ubuntu systems is as follows: -

-
-/etc/apache2/
-|-- apache2.conf
-|       `--  ports.conf
-|-- mods-enabled
-|       |-- *.load
-|       `-- *.conf
-|-- conf-enabled
-|       `-- *.conf
-|-- sites-enabled
-|       `-- *.conf
-          
-
    -
  • - apache2.conf is the main configuration - file. It puts the pieces together by including all remaining configuration - files when starting up the web server. -
  • - -
  • - ports.conf is always included from the - main configuration file. It is used to determine the listening ports for - incoming connections, and this file can be customized anytime. -
  • - -
  • - Configuration files in the mods-enabled/, - conf-enabled/ and sites-enabled/ directories contain - particular configuration snippets which manage modules, global configuration - fragments, or virtual host configurations, respectively. -
  • - -
  • - They are activated by symlinking available - configuration files from their respective - *-available/ counterparts. These should be managed - by using our helpers - - a2enmod, - a2dismod, - - - a2ensite, - a2dissite, - - and - - a2enconf, - a2disconf - . See their respective man pages for detailed information. -
  • - -
  • - The binary is called apache2. Due to the use of - environment variables, in the default configuration, apache2 needs to be - started/stopped with /etc/init.d/apache2 or apache2ctl. - Calling /usr/bin/apache2 directly will not work with the - default configuration. -
  • -
-
- -
-
- Document Roots -
- -
-

- By default, Ubuntu does not allow access through the web browser to - any file apart of those located in /var/www, - public_html - directories (when enabled) and /usr/share (for web - applications). If your site is using a web document root - located elsewhere (such as in /srv) you may need to whitelist your - document root directory in /etc/apache2/apache2.conf. -

-

- The default Ubuntu document root is /var/www/html. You - can make your own virtual hosts under /var/www. This is different - to previous releases which provides better security out of the box. -

-
- -
-
- Reporting Problems -
-
-

- Please use the ubuntu-bug tool to report bugs in the - Apache2 package with Ubuntu. However, check existing bug reports before reporting a new bug. -

-

- Please report bugs specific to modules (such as PHP and others) - to respective packages, not to the web server itself. -

-
- - - - -
-
-
-
- - - diff --git a/src/index.php b/src/index.php index 396b4b1..bcc18a2 100644 --- a/src/index.php +++ b/src/index.php @@ -122,7 +122,7 @@ $content['main_pager_last_found'] = false; // Init Sorting variables $content['sorting'] = ""; $content['searchstr'] = ""; -$content['searchstr_htmlform'] = ""; +$content['searchstr_htmlform'] = "datelastx:6"; $content['highlightstr'] = ""; $content['highlightstr_htmlform'] = ""; $content['EXPAND_HIGHLIGHT'] = "false"; @@ -202,7 +202,6 @@ if ( (isset($_POST['search']) || isset($_GET['search'])) || (isset($_POST['filte } } // --- - // --- BEGIN CREATE TITLE $content['TITLE'] = InitPageTitle(); @@ -215,6 +214,10 @@ else // --- BEGIN Custom Code +//by default limit search to some sane range +if (empty($content['searchstr'])){ + $content['searchstr'] = $content['searchstr_htmlform']; +} // Do not BLOCK other Site Calls WriteClosePHPSession(); @@ -365,9 +368,9 @@ if ( isset($content['Sources'][$currentSourceID]) ) // --- Set CSS Class if ( $counter % 2 == 0 ) - $content['syslogmessages'][$counter]['cssclass'] = "line1"; + $content['syslogmessages'][$counter]['cssclass'] = "line1_".$logArray[SYSLOG_SEVERITY]; else - $content['syslogmessages'][$counter]['cssclass'] = "line2"; + $content['syslogmessages'][$counter]['cssclass'] = "line2_".$logArray[SYSLOG_SEVERITY]; // --- // --- Copy other needed properties diff --git a/src/themes/default/main.css b/src/themes/default/main.css index 0b305f7..a9cb627 100644 --- a/src/themes/default/main.css +++ b/src/themes/default/main.css @@ -25,7 +25,7 @@ a:link,a:active,a:visited,a.postlink text-decoration:none; background-color: transparent; - color:#005989; + color:#ffffff; } a:hover { @@ -157,6 +157,52 @@ font } /* Cells for listening */ +/*emergency*/ +.line1_0 { color: #ffffff; background-color: #840A15;} +.line1_0:hover { background-color:#ed1224;} +.line2_0{ color: #ffffff; background-color: #be0e1d;} +.line2_0:hover {background-color:#f8a0a7; } +/*alert*/ +.line1_1 { color: #ffffff; background-color: #BA0716;} +.line1_1:hover { background-color:#f6091d;} +.line2_1{ color: #ffffff; background-color: #dd081a;} +.line2_1:hover {background-color:#fa6b77; } +/*critical*/ +.line1_2 { color: #ffffff; background-color: #CE0819;} +.line1_2:hover { background-color:#fa6b77;} +.line2_2{ color: #ffffff; background-color: #f83a4a;} +.line2_2:hover {background-color:#fcb5bb; } +/*error*/ +.line1_3 { color: #ffffff; background-color: #BB0A1F;} +.line1_3:hover { background-color:#fa9ea9;} +.line2_3{ color: #ffffff; background-color: #f20d28;} +.line2_3:hover {background-color:#fa9ea9; } +/*warning*/ +.line1_4 { color: #000000; background-color: #EF8200;} +.line1_4:hover { background-color:#ffa333;} +.line2_4{ color: #000000; background-color: #ff8c00;} +.line2_4:hover {background-color:#ffc680; } +/*notice*/ +.line1_5 { color: #000000; background-color: #14AD42;} +.line1_5:hover { background-color:#32e768;} +.line2_5{ color: #000000; background-color: #18cd4e;} +.line2_5:hover {background-color:#76ef9a; } +/*info*/ +.line1_6 { color: #000000; background-color: #0C9C91;} +.line1_6:hover { background-color:#2aefde;} +.line2_6{ color: #000000; background-color: #0ebeaf;} +.line2_6:hover {background-color:#2aefde; } +/*debug*/ +.line1_7 { color: #000000; background-color: #666699;} +.line1_7:hover { background-color:#a3a3c2;} +.line2_7{ color: #000000; background-color: #8585ad;} +.line2_7:hover {background-color:#a3a3c2; } +/*trace*/ +.line1_8 { color: #000000; background-color: #c2c2c0;} +.line1_8:hover { background-color:#dadad8;} +.line2_8{ color: #000000; background-color: #cdcdcb;} +.line2_8:hover {background-color:#f3f3f2; } + .line0 { color: #000000;