diff --git a/classes/eventfilter.php b/classes/eventfilter.php index 5e37ccd..a304a00 100644 --- a/classes/eventfilter.php +++ b/classes/eventfilter.php @@ -44,11 +44,13 @@ it become a reality. var $UserDefaultTimeInterval; //!< The time interval set as default in the user's options menu var $SQLWhereTime; //!< Contains the where part of the SQL statement var $OrderBy; //!< Sorting argument + var $GroupBy; //!< Grouping Argument + var $Sort; //!< Ascending/Descending var $SQLWherePart; //!< Contains the whole SQL where part var $SQLWhereInfoUnit; //!< Restriction of InfoUnit type var $SQLWherePriority; //!< Restriction of Priority - var $SQLWhereHost; //!< Restriction of ip/host - var $SQLWhereMsg; //!< Message must contain a certain string + var $SQLWhereHost; //!< Restriction of ip/host + var $SQLWhereMsg; //!< Message must contain a certain string /*! Constructor * @@ -56,13 +58,12 @@ it become a reality. * from the database. */ function EventFilter() - { - - // get the selected mode (time period) + { + // get the selected mode (time period) $this->TimeInterval = $_SESSION['ti']; - //Order argument - $this->OrderBy = $_SESSION['order']; + //Order argument + $this->OrderBy = $_SESSION['order']; if($_SESSION['change'] == 'Predefined') { @@ -295,25 +296,25 @@ it become a reality. */ function SetSQLWhereInfoUnit() { - // sl = 1, er = 3, o - // sl-er-o (matrix) - // 0-0-0 -> all InfoUnit #0 - // 0-0-1 -> only o #1 - // 0-1-0 -> only er #2 - // 0-1-1 -> not sl #3 - // 1-0-0 -> only sl #4 - // 1-0-1 -> not er #5 - // 1-1-0 -> only sl and er#6 - // 1-1-1 -> all InfoUnit #7 - $tmpSQL[0][0][0]= ''; - $tmpSQL[0][0][1]= ' AND (InfoUnitID<>1 AND InfoUnitID<>3) '; - $tmpSQL[0][1][0]= ' AND InfoUnitID=3 '; - $tmpSQL[0][1][1]= ' AND InfoUnitID<>1 '; - $tmpSQL[1][0][0]= ' AND InfoUnitID=1 '; - $tmpSQL[1][0][1]= ' AND InfoUnitID<>3 '; - $tmpSQL[1][1][0]= ' AND (InfoUnitID=1 or InfoUnitID=3) '; - $tmpSQL[1][1][1]= ''; - $this->SQLWhereInfoUnit = $tmpSQL[$_SESSION['infounit_sl']][$_SESSION['infounit_er']][$_SESSION['infounit_o']]; + // sl = 1, er = 3, o + // sl-er-o (matrix) + // 0-0-0 -> all InfoUnit #0 + // 0-0-1 -> only o #1 + // 0-1-0 -> only er #2 + // 0-1-1 -> not sl #3 + // 1-0-0 -> only sl #4 + // 1-0-1 -> not er #5 + // 1-1-0 -> only sl and er#6 + // 1-1-1 -> all InfoUnit #7 + $tmpSQL[0][0][0]= ''; + $tmpSQL[0][0][1]= ' AND (InfoUnitID<>1 AND InfoUnitID<>3) '; + $tmpSQL[0][1][0]= ' AND InfoUnitID=3 '; + $tmpSQL[0][1][1]= ' AND InfoUnitID<>1 '; + $tmpSQL[1][0][0]= ' AND InfoUnitID=1 '; + $tmpSQL[1][0][1]= ' AND InfoUnitID<>3 '; + $tmpSQL[1][1][0]= ' AND (InfoUnitID=1 or InfoUnitID=3) '; + $tmpSQL[1][1][1]= ''; + $this->SQLWhereInfoUnit = $tmpSQL[$_SESSION['infounit_sl']][$_SESSION['infounit_er']][$_SESSION['infounit_o']]; /* if ($_SESSION['infounit_sl'] == 1) @@ -517,16 +518,18 @@ it become a reality. * Use this to get a part of the sql where clause. * This is responsilbe for the limitation of the requested data by time. */ - function SetSQLWherePart($time_only) + function SetSQLWherePart($whereMode) { - if($time_only == 1) - { - $this->SQLWherePart = $this->GetSQLWhereTime(); - } - else + //Mode 0 => I.e for events-display + if($whereMode == 0) { $this->SQLWherePart = $this->GetSQLWhereTime().$this->GetSQLWhereInfoUnit().$this->GetSQLWherePriority().$this->GetSQLWhereHost().$this->GetSQLWhereMsg(); } + elseif($whereMode == 1) + { + $this->SQLWherePart = $this->GetSQLWhereTime().$this->GetSQLWherePriority().$this->GetSQLWhereHost().$this->GetSQLWhereMsg(); + } + } @@ -554,7 +557,6 @@ it become a reality. */ function GetSQLSort() { - switch ($this->OrderBy) { case "Date": @@ -580,7 +582,50 @@ it become a reality. break; } return $tmpSQL; - } + } + + function GetSysLogTagSQLSort() + { + $this->OrderBy = $_SESSION['tag_order']; + switch ($this->OrderBy) + { + case "SysLogTag": + $tmpSQL = ' ORDER BY SysLogTag ' . $_SESSION['tag_sort']; + break; + case "Occurences": + $tmpSQL = ' ORDER BY occurences ' . $_SESSION['tag_sort']; + break; + case "Host": + $tmpSQL = ' ORDER BY FromHost ' . $_SESSION['tag_sort']; + break; + default: + $tmpSQL = ' ORDER BY SysLogTag ' . $_SESSION['tag_sort']; + break; + } + return $tmpSQL; + } + + function SetSQLGroup($groupBy) + { + $this->GroupBy = $groupBy; + } + + function GetSQLGroup() + { + switch($this->GroupBy) + { + case "SysLogTag": + $tmpSQL = " GROUP BY SysLogTag"; + break; + case "SysLogTagHost": + $tmpSQL = " GROUP BY SysLogTag, FromHost"; + break; + default: + $tmpSQL = " GROUP BY SysLogTag"; + break; + } + return $tmpSQL; + } } ?> \ No newline at end of file diff --git a/classes/eventsnavigation.php b/classes/eventsnavigation.php index 2614e27..860baee 100644 --- a/classes/eventsnavigation.php +++ b/classes/eventsnavigation.php @@ -88,8 +88,8 @@ it become a reality. $page = ($this->EventCount < $this->GetPageSize()) ? 1 : ceil($this->EventCount / $this->GetPageSize()); if($this->GetPageNumber() > 1) { - $this->NavigationLeftArrow = " « "; - $this->NavigationFirstPage = " «« "; + $this->NavigationLeftArrow = " « "; + $this->NavigationFirstPage = " «« "; } else { @@ -99,8 +99,8 @@ it become a reality. if($this->GetPageNumber() < $page) { - $this->NavigationRightArrow = " » "; - $this->NavigationLastPage = " »» "; + $this->NavigationRightArrow = " » "; + $this->NavigationLastPage = " »» "; } else { @@ -116,7 +116,9 @@ it become a reality. { //query string without pagenum $url_para = RemoveArgFromURL($_SERVER['QUERY_STRING'], "pagenum"); - + if(isset($_GET['slt'])) + $url_para = "slt=" . $_GET['slt']; + $page = $this->SetNavigation($url_para); echo $this->NavigationFirstPage." ".$this->NavigationLeftArrow; for($a=$this->GetPageNumber()-3;$a<=$this->GetPageNumber()+3;$a++) @@ -126,7 +128,7 @@ it become a reality. if($a==$this->GetPageNumber()) echo " $a"; else - echo " ".$a.""; + echo " ".$a.""; } } echo $this->NavigationRightArrow." ".$this->NavigationLastPage; @@ -135,11 +137,18 @@ it become a reality. //! send a database query to get the total number of events which are available //! save the result in $EventCount function SetEventCount($db_con, $restriction) - { + { //get the counter result without limitation $result = db_exec($db_con, db_num_count($restriction)); - $result = db_fetch_array($result); - $this->EventCount = $result[0]; //so many data records were found + $row = db_fetch_array($result); + $num = db_num_rows($result); + // If you have a group clause in your query, the COUNT(*) clause doesn't + // calculates the grouped rows; you get the number of all affected rows! + // db_num_rows() gives the correct number in this case! + if($num <= 1) + $this->EventCount = $row['num']; //so many data records were foundy + else + $this->EventCount = $num; } //! returns the total number of available events @@ -154,4 +163,4 @@ it become a reality. } } -?> \ No newline at end of file +?> diff --git a/config.php b/config.php index 7af81a0..0a58e8e 100644 --- a/config.php +++ b/config.php @@ -3,7 +3,7 @@ /*#### #### #### #### #### #### #### #### #### #### phpLogCon - A Web Interface to Log Data. -Copyright (C) 2003 Adiscon GmbH +Copyright (C) 2004 Adiscon GmbH This program 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 2 of the License, or (at your option) any later version. @@ -41,16 +41,16 @@ it become a reality. define('_DBSERVER', 'localhost'); // DSN (ODBC) or database name (Mysql) - define('_DBNAME', 'phplogcon'); + define('_DBNAME', 'monitorware'); // Userid for database connection *** - define('_DBUSERID', 'root'); + define('_DBUSERID', 'user'); // Password for database connection *** - define('_DBPWD', ''); + define('_DBPWD', 'pass'); // table name - define('_DBTABLENAME', 'systemevents'); + define('_DBTABLENAME', 'SystemEvents'); // Switch for connection mode // Currently only odbc and native works diff --git a/db-drv/mysql.php b/db-drv/mysql.php index 4ffd874..a60ac9b 100644 --- a/db-drv/mysql.php +++ b/db-drv/mysql.php @@ -2,7 +2,7 @@ /*#### #### #### #### #### #### #### #### #### #### phpLogCon - A Web Interface to Log Data. -Copyright (C) 2003 Adiscon GmbH +Copyright (C) 2004 Adiscon GmbH This program 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 2 of the License, or (at your option) any later version. @@ -91,7 +91,7 @@ it become a reality. */ function db_num_rows($res) { - $result = mysql_num_rows($res) or db_die_with_error(_MSGNoRes); + $result = mysql_num_rows($res); return $result; } @@ -103,7 +103,7 @@ it become a reality. */ function db_fetch_array($res) { - $result = mysql_fetch_array($res);// or db_die_with_error(_MSGNoRes); + $result = mysql_fetch_array($res); return $result; } @@ -113,7 +113,7 @@ it become a reality. */ function db_fetch_singleresult($result) { - $result = mysql_fetch_array($result) or db_die_with_error(_MSGNoRes); + $result = mysql_fetch_array($result); return $result; } @@ -146,10 +146,10 @@ it become a reality. * the array points to the first data record you want to display * at current page. You need it for paging. */ - function db_exec_limit($db, $cmdSQLfirst_part, $cmdSQLmain_part, $cmdSQLwhere_part, $limitlower, $perpage) - { + function db_exec_limit($db, $cmdSQLfirst_part, $cmdSQLmain_part, $cmdSQLwhere_part, $limitlower, $perpage, $order) + { $cmdSQL = $cmdSQLfirst_part . $cmdSQLmain_part . $cmdSQLwhere_part . " limit ".($limitlower-1)."," . $perpage; - return db_exec($db, $cmdSQL); + return db_exec($db, $cmdSQL); } function db_free_result($result) @@ -157,6 +157,12 @@ it become a reality. return mysql_free_result($result); } + function db_get_tables($dbCon, $dbName) + { + $query = "SHOW TABLES FROM " . $dbName; + return mysql_query($query); + } + function db_errno() { return mysql_errno(); diff --git a/db-drv/odbc_mssql.php b/db-drv/odbc_mssql.php index cabef19..54d6380 100644 --- a/db-drv/odbc_mssql.php +++ b/db-drv/odbc_mssql.php @@ -2,7 +2,7 @@ /*#### #### #### #### #### #### #### #### #### #### phpLogCon - A Web Interface to Log Data. -Copyright (C) 2003 Adiscon GmbH +Copyright (C) 2004 Adiscon GmbH This program 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 2 of the License, or (at your option) any later version. @@ -78,12 +78,7 @@ SQL_CURSOR_STATIC (integer) function db_fetch_array($res) { - //odbc_fetch_into replaced odbc_fetch_array, because - //in various php version the fetch_array doesnt work - - //odbc_fetch_into($res, $myarray); - odbc_fetch_into($res, $myarray); - return $myarray; + return odbc_fetch_array($res); } function db_result($res, $res_name) @@ -98,7 +93,21 @@ SQL_CURSOR_STATIC (integer) function db_num_count($cmdSQLwhere_part) { - return 'SELECT DISTINCT COUNT(*) AS num FROM ' . _DBTABLENAME . substr($cmdSQLwhere_part, 0, strpos($cmdSQLwhere_part, 'ORDER BY')); + if(stristr($cmdSQLwhere_part, "order by") != FALSE) + return 'SELECT DISTINCT COUNT(*) AS num FROM ' . _DBTABLENAME . substr($cmdSQLwhere_part, 0, strpos($cmdSQLwhere_part, 'ORDER BY')); + else + return 'SELECT DISTINCT COUNT(*) AS num FROM ' . _DBTABLENAME . $cmdSQLwhere_part; + } + + // This function is for getting the correct row count! db_num_rows is BUGGED! >_< + // THX to 'deejay_' from PHP.net for this function! + function odbc_record_count($odbcDbId, $query) + { + $countQueryString = "SELECT COUNT(*) as results FROM (" . $query . ")"; +// echo $countQueryString; + $count = odbc_exec ($odbcDbId, $countQueryString); + $numRecords = odbc_result ($count, "results"); + return $numRecords; } /* @@ -106,21 +115,37 @@ SQL_CURSOR_STATIC (integer) * the array points to the first data record you want to display * at current page. You need it for paging. */ - function db_exec_limit($db, $cmdSQLfirst_part, $cmdSQLmain_part, $cmdSQLwhere_part, $limitlower, $perpage) + function db_exec_limit($db, $cmdSQLfirst_part, $cmdSQLmain_part, $cmdSQLwhere_part, $limitlower, $perpage, $order) { - //you must move through the recordset - //until you reach the data record you want - //***if you know a better and more efficent methode, please let us know, too! + //Because ODBC doesn't know LIMIT we have to do it with subselects + if(strtolower($order) == "date") + $order = _DATE; + elseif(strtolower($order) == "host") + $order = "[FromHost]"; + elseif(strtolower($order) == "facilitydate") + $order = "[Facility], [" . _DATE . "]"; + elseif(strtolower($order) == "prioritydate") + $order = "[Priority], [" . _DATE . "]"; + else + $order = "[" . $order . "]"; + //now we have to check in wich order the results will be listed. + //we have to fit our query to this. + if( stristr(strtolower($cmdSQLwhere_part), "desc") == FALSE) + { + $sort1 = "DESC"; + $sort2 = "ASC"; + } + else + { + $sort1 = "ASC"; + $sort2 = "DESC"; + } + //now the big statement will be created! Have fun! ;) $tmp = $perpage + $limitlower - 1; - $cmdSQL = $cmdSQLfirst_part . "TOP " . $tmp . " " . $cmdSQLmain_part . $cmdSQLwhere_part; + $cmdSQL = "SELECT * FROM ( SELECT TOP " . $perpage . " * FROM ( " . $cmdSQLfirst_part . "TOP " . $tmp . " " . $cmdSQLmain_part . $cmdSQLwhere_part . " ) AS blub ORDER BY " . $order . " " . $sort1 . " ) AS blubblub ORDER BY " . $order . " " . $sort2; +// echo $cmdSQL . "
"; return db_exec($db, $cmdSQL); -/* - for($i = 1; $i < $limitlower; $i++) - $row = odbc_fetch_row($result); - - return $result; - */ } function db_free_result($result) @@ -128,6 +153,11 @@ SQL_CURSOR_STATIC (integer) return odbc_free_result($result); } + function db_get_tables($dbCon, $dbName) + { + return odbc_tables($dbCon); + } + function db_errno() { return odbc_error(); @@ -158,4 +188,5 @@ SQL_CURSOR_STATIC (integer) { return '%'; } + ?> \ No newline at end of file diff --git a/db-drv/odbc_mysql.php b/db-drv/odbc_mysql.php index 45412ec..c5ab1a3 100644 --- a/db-drv/odbc_mysql.php +++ b/db-drv/odbc_mysql.php @@ -2,7 +2,7 @@ /*#### #### #### #### #### #### #### #### #### #### phpLogCon - A Web Interface to Log Data. -Copyright (C) 2003 Adiscon GmbH +Copyright (C) 2004 Adiscon GmbH This program 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 2 of the License, or (at your option) any later version. @@ -95,8 +95,7 @@ it become a reality. */ function db_fetch_array($res) { - odbc_fetch_into($res, $myarray); - return $myarray; + return odbc_fetch_array($res); } /* @@ -136,7 +135,7 @@ it become a reality. * the array points to the first data record you want to display * at current page. You need it for paging. */ - function db_exec_limit($db, $cmdSQLfirst_part, $cmdSQLmain_part, $cmdSQLwhere_part, $limitlower, $perpage) + function db_exec_limit($db, $cmdSQLfirst_part, $cmdSQLmain_part, $cmdSQLwhere_part, $limitlower, $perpage, $order) { $cmdSQL = $cmdSQLfirst_part . $cmdSQLmain_part . $cmdSQLwhere_part . " limit ".($limitlower-1)."," . $perpage; return db_exec($db, $cmdSQL); @@ -147,6 +146,11 @@ it become a reality. return odbc_free_result($result); } + function db_get_tables($dbCon, $dbName) + { + return odbc_tables($dbCon); + } + function db_errno() { return odbc_error(); diff --git a/details.php b/details.php index a51f7b9..0bbe771 100644 --- a/details.php +++ b/details.php @@ -2,7 +2,7 @@ /*#### #### #### #### #### #### #### #### #### #### phpLogCon - A Web Interface to Log Data. -Copyright (C) 2003 Adiscon GmbH +Copyright (C) 2004 Adiscon GmbH This program 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 2 of the License, or (at your option) any later version. @@ -22,6 +22,12 @@ it become a reality. require("include.php"); + if( !isset($_GET['lid']) ) + { + header("Location: events-display.php"); + exit; + } + WriteStandardHeader(_MSGShwEvnDet); ?> diff --git a/doc/credits.htm b/doc/credits.htm index 3754554..f0fad04 100644 --- a/doc/credits.htm +++ b/doc/credits.htm @@ -1,18 +1,46 @@ - -Credits - -

Credits

-

This project is funded by Adiscon -and initiated by Rainer Gerhards.

-

The core development team is:

- -

[Doc Home] [MonitorWare Web Site]

-

Copyright © 2003 by Adiscon. -Initiated by Rainer Gerhards. See license for details.

- + + phpLogCon Manual :: Credits + + + + + + + + + + + + +
+

phpLogCon monitoring

+
+ +

[Doc Home]

+

5. Credits

+

This project is funded by Adiscon and initiated by Rainer Gerhards.

+

The core development team is:

+ +

Additional developers:

+ + +

[Doc Home] [MonitorWare Web Site]

+
+ + + + +
+

+ phpLogCon, Copyright © 2003 - 2004 Adiscon GmbH +
+
+ diff --git a/doc/design.htm b/doc/design.htm index 4400caf..85c2de8 100644 --- a/doc/design.htm +++ b/doc/design.htm @@ -1,52 +1,67 @@ - phpLogCon Design Goals + phpLogCon Manual :: Design Goals + + + + + + -

Design Goals

-

phpLogCon enables the system administrator to quickly and easily review his - central log repository. It provides views typically used on log data. It - integrates with web resources for easy analysis of data found in the logs.

-

Main Usage Points

-

phpLogCon is primarily being used for

+ + + + + +
+

phpLogCon monitoring

+
+ +

[Doc Home]

+

1. Design Goals

-

For in-depth analysis, we recommend using the MonitorWare Console. It provides - advanced analysis capabilities not found inside phpLogCon.

-

Portability

-

phpLogCon is being implemented as a set of PHP scripts to ensure - portability between different platforms. Target platforms for phpLogCon +
+

PhpLogCon enables the system administrator to quickly and easily review his central log repository. It provides views typically used on log data. It integrates with web resources for easy analysis of data found in the logs.

+

1.1 Main Usage Points

+

phpLogCon is primarily being used for

+ +

For in-depth analysis, we recommend using the MonitorWare Console. It provides advanced analysis capabilities not found inside phpLogCon.

+ [Top] +

1.2 Portability

+

phpLogCon is being implemented as a set of PHP scripts to ensure + portability between different platforms. Target platforms for phpLogCon are:

The standard set of database systems is supported, that is

-

Of course, other database systems can most likely be used with phpLogCon - - we just can't guarantee that it will work (and we are also unable to reproduce - any issues in our lab, thus the need for limitation). 

-

[Doc Home] [MonitorWare - Web Site]

-

Copyright © 2003 by Adiscon. Initiated by - Rainer Gerhards. See license for details.

+

Of course, other database systems can most likely be used with phpLogCon - we just can't guarantee that it will work (and we are also unable to reproduce any issues in our lab, thus the need for limitation).

+ [Top] + +

[Doc Home] [MonitorWare Web Site]

+
+ + + + +
+

+ phpLogCon, Copyright © 2003 - 2004 Adiscon GmbH +
+
diff --git a/doc/developer-notes.htm b/doc/developer-notes.htm index ad1f8ff..92a41b0 100644 --- a/doc/developer-notes.htm +++ b/doc/developer-notes.htm @@ -1,39 +1,57 @@ - phpLogCon - Developer notes + phpLogCon Manual :: Developer Notes + + + + + + -

Developer notes

-

- phpLogCon is an open source project. Feel free to change what you want. Here - you will find some hints and background knowledge about phpLogCon.

-

Gernarel database connection functions

-

The database function in phpLogCon are called similar to well-know commands from - e.g. php mysql functions. All database functions beginn with "db_" and - then a word that best describes the instruction. Sample: db_connect() - - should open a connection to the database. This is according to mysql_connect(). - So you know if you find db_fetch_array in phpLogCon for example, that this - function should fetch a result row as an associative array, a numeric array, or - both.

-

ODBC functions

-

phpLogCon support also database connection via ODBC. You can find the functions in - db-drv\odbc.php. The most functions are in a very low basic level. The - reason, a lot of the php ODBC functions don't work with all - versions of php. Also the usability often depends on the ODBC driver.

-

Known Issues
At the moment you can only use ODBC for query Microsoft databases like MSSQL, - Jet, ... A second database layer which can handle different sql formats should be implement in the future!

-

Include files

-

include.php

-

This file is very important. There, all other files to - include are embedded (e. g. config files and so on). So if you - include include.php you have always include automatically all genral "include - files". Also you can find useful function in include.php. All functions - which should reachable at the whole program, you find there (or there - included).

-

Note: At each page of phpLogCon, include.php should be included!

-

 

-

[Doc Home] [MonitorWare - Web Site]

-

Copyright © 2003 by Adiscon. Initiated by - Rainer Gerhards. See license for details.

+ + + + + +
+

phpLogCon monitoring

+
+ +

[Doc Home]

+

6. Developer notes

+ +
+

phpLogCon is an open source project. Feel free to change what you want. Here you will find some hints and background knowledge about phpLogCon.

+

6.1 Gernarel database connection functions

+

The database functions in phpLogCon are called similar to well-know commands from e.g. php mysql functions. All database functions start with "db_" and then a word that best describes the instruction. Sample: db_connect() - should open a connection to the database. This is according to mysql_connect(). So you know if you find db_fetch_array in phpLogCon for example, that this function should fetch a result row as an associative array, a numeric array, or both.

+ [Top] +

6.2 ODBC functions

+

phpLogCon support also database connection via ODBC. You can find the functions in 'db-drv\odbc_mssql.php' and 'db-drv\odbc_mysql.php'. Like you can see, there are two different drivers for ODBC. That's because the syntax of MySql and MsSql are different. The most functions are in a very low basic level. The reason, a lot of the php ODBC functions don't work with all versions of php. Also the usability often depends on the ODBC driver.

+

Known Issues

+

At the moment you can only use ODBC for query Microsoft databases like MSSQL, etc and for MySql. A second database layer which can handle different sql formats should be implemented in the future!

+ [Top] +

6.3 Include files

+

include.php

+

This file is very important. There, all other files to include are embedded (e. g. config files and so on). So if you include include.php you have always include automatically all genral "include files". Also you can find useful function in include.php. All functions which should reachable at the whole program, you find there (or there included).

+

Note: At each page of phpLogCon, include.php should be included!

+

config.php

+

Here are the whole config of phpLogCon saved. It is included already by include.php, so you don't have to include it separately. If you want to set a new config variable, do it here! But if you only want to set a default variable for a variable, anywhere in the script, so do it there or in include.php! Config.php is only for global configuration variables with it's default values.

+ [Top] + +

[Doc Home] [MonitorWare Web Site]

+
+ + + + +
+

+ phpLogCon, Copyright © 2003 - 2004 Adiscon GmbH +
+
diff --git a/doc/getting-started.htm b/doc/getting-started.htm index 0ac0ee5..338fadc 100644 --- a/doc/getting-started.htm +++ b/doc/getting-started.htm @@ -1,24 +1,52 @@ - MonitorWare Web Interface - Getting Started + phpLogCon Manual :: Getting Started + + + + + + -

- phpLogCon - Getting Started

-

Getting started with phpLogCon is just a few simple steps:

+ + + + + +
+

phpLogCon monitoring

+
+ +

[Doc Home]

+

2. Getting Started

-

[Doc Home] [MonitorWare - Web Site]

-

Copyright © 2003 by Adiscon. Initiated by - Rainer Gerhards. See license for details.

+
+

Getting started with phpLogCon is just a few simple steps:

+ +

2.1 Minimum Requirements

+

The minimum requirements of your hardware are given by your database server application. The software requirements for phpLogCon meet the following:

+ + [Top] + +

[Doc Home] [MonitorWare Web Site]

+
+ + + + +
+

+ phpLogCon, Copyright © 2003 - 2004 Adiscon GmbH +
+
diff --git a/doc/history.htm b/doc/history.htm index 952054c..673fefc 100644 --- a/doc/history.htm +++ b/doc/history.htm @@ -1,11 +1,36 @@ - -phpLogCon - History - -

MonitorWare Web Interface - Release History

-

2003-03-05    Actual project was started

-

[Doc Home] [MonitorWare Web Site]

-

Copyright © 2003 by Adiscon. -Initiated by Rainer Gerhards. See license for details.

- + + phpLogCon Manual :: Release History + + + + + + + + + + + + +
+

phpLogCon monitoring

+
+ +

[Doc Home]

+

7. Release History

+

2003-03-05    Actual project was started

+ +

[Doc Home] [MonitorWare Web Site]

+
+ + + + +
+

+ phpLogCon, Copyright © 2003 - 2004 Adiscon GmbH +
+
+ diff --git a/doc/index.htm b/doc/index.htm index 6f13cbf..33aef7e 100644 --- a/doc/index.htm +++ b/doc/index.htm @@ -1,7 +1,22 @@ - phpLogCon 1.0 + phpLogCon Manual :: Index + + + + + + + + + + + +
+

phpLogCon monitoring

+
+

phpLogCon 1.0

phpLogCon is an easy to use solution for browsing syslog messages, Windows event log data and other network events over the web. While originally initiated to work in conjunction with @@ -9,25 +24,69 @@ other solutions as well.

-

See http://www.monitorware.com/en/ for - further details about the MonitorWare solution.

-

[Doc Home] [MonitorWare - Web Site]

-

Copyright © 2003 by Adiscon. Initiated by - Rainer Gerhards. See license for details.

+

See http://www.monitorware.com/en/ for further details about the MonitorWare solution.

+ +

[MonitorWare Web Site]

+
+ + + + +
+

+ phpLogCon, Copyright © 2003 - 2004 Adiscon GmbH +
+
diff --git a/doc/license.htm b/doc/license.htm index 28c0228..a440d12 100644 --- a/doc/license.htm +++ b/doc/license.htm @@ -1,12 +1,39 @@ - -MonitorWare Web Interface - License - -

MonitorWare Web Interface - License

-

MWWeb is currently under development. No license has yet been selected. Use -at your sole risk.

-

[Doc Home] [MonitorWare Web Site]

-

Copyright © 2003 by Adiscon. -Initiated by Rainer Gerhards. See license for details.

- + + phpLogCon Manual :: License + + + + + + + + + + + + +
+

phpLogCon monitoring

+
+ +

[Doc Home]

+

8. License

+

This program 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 2 of the License, or (at your option) any later version.

+

This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

+

If you have questions about phpLogCon in general, please email info@adiscon.com. To learn more about phpLogCon, please visit www.phplogcon.com.

+ +

[Doc Home] [MonitorWare Web Site]

+
+ + + + +
+

+ phpLogCon, Copyright © 2003 - 2004 Adiscon GmbH +
+
+ diff --git a/doc/setup.htm b/doc/setup.htm index e2409ca..9721166 100644 --- a/doc/setup.htm +++ b/doc/setup.htm @@ -1,34 +1,47 @@ - phpLogCon - Setup + phpLogCon Manual :: phpLogCon Setup + + + + + + -

- phpLogCon Setup

+ + + + + +
+

phpLogCon monitoring

+
+ +

[Doc Home]

+

3. phpLogCon Setup

-

If you intend to use phpLogCon with a non-MonitorWare generated database, you - can easily do so. The key point is to make sure that the database contains all - necessary data at the right locations. You might want to look up the - MonitorWare schema to see what is needed. For syslog events, this should be - fairly simple to acomplish as only a limited set of fields is to be provided. - If you purchase our low-priced support contract, we will gladly assist you in - getting this going ;). Currently, the link to the schema is missing. This is - not by intention. If it is missing by the time you read us, contact - support@adiscon.com. The schema is of course provided freely, was just - not at hand while writing this...

-

[Doc Home] [MonitorWare - Web Site]

-

Copyright © 2003 by Adiscon. Initiated by - Rainer Gerhards. See license for details.

+
+

For an installing that runs on every operating system, we created a 'install.php', that you will find in phpLogCon/install. You only have to point to install/install.php in your browser! The Installation-Assistant will guide you through the installation.

+

Note: Don't forget to delete whole 'install/' directory! Also remember, that the user who runs the web server (i.e. www-data) must have 'write'-rights (chmod 666) on the 'config.php'! Remove these rights after installing (chmod 644)!

+

3.1 Configuration Settings

+

Config.php

+

The setup created a 'config.php' in the root directory. This file contains all info you have entered at the install process. Here you can alter the 'config.php' every time you want to your need.

+

phplogcon.ini

+

You will find a file named 'phplogcon.ini' in the root directory. Here you can set some external information. For now, there is only the 'wordsdontshow'-function available. Here you can enter some words, followed by a separator. These words will be hided in events display and details.

+ [Top] + +

[Doc Home] [MonitorWare Web Site]

+
+ + + + +
+

+ phpLogCon, Copyright © 2003 - 2004 Adiscon GmbH +
+
diff --git a/doc/using.htm b/doc/using.htm index 04c6299..c474fb5 100644 --- a/doc/using.htm +++ b/doc/using.htm @@ -1,76 +1,142 @@ - phpLogCon - Using + phpLogCon Manual :: Using The Web Interface + + + + + + -

Using the Web Interface

-

General concepts

-

Overall Event Filter

-

- All processing done by phpLogCon is relative to a user-selected filter. - That is, only events that match the applicable filter condition will be show. - In the initial release, the filter condition will be solely time-based. The - default filter is "today". Other filters are "the last nn minutes", - "the last nn hours", "today", "this week" and "from date ... to date ...". - The filter can always be set by following a link on top - of each web page.

Page Layout

+ + + + + +
+

phpLogCon monitoring

+
+ +

[Doc Home]

+

4. Using the Web Interface

+ +
+

4.1 General concepts

+

phpLogCon is designed to give you fast access to your desired information with a high controllable output/filtering. The whole solution is build for good viewing, fast finding that, what you want and to give you full access to the information.

+ [Top] +

4.2 Overall Event Filter

+

All processing done by phpLogCon is relative to a user-selected filter. That is, only events that match the applicable filter condition will be shown.

+

There are two types of filters in phpLogCon:

+

General Filters:

+

These filters can always be set on the Filer Options page. You can reach them through a link on top of each web page. These settings will be saved in the session. So when the session expired, however the filter settings will be default next time. In User Interface mode they will be saved in database for each user. That provides on each logon or opening phpLogCon gettin your personal filter settings.

+

General Filters are:

+ +

Quick Filters:

+

Quick Filters provide the General Filters and can be set in Events Display. They will override the general filters while staying in Events Display. They provide you quick changes for temporally viewing different and little bit fine filtered events, without changing your general filter settings.

+

Quick Filters are:

+ + [Top] +

4.3 Page Layout

Every page will follow a standard layout. It has three areas

-

The header holds the top menu items and the current date and time. It - also has quick links to:

+

The header holds the top menu items and the current date and time. It also holds:

-

When we have the notation of a user inside phpLogCon, this should probably come - out of the user profile. Over time, we may also provide dynamic links based on - what the user did last.

-

The main work area is the primary display/work space. Obviously its - content is depending on the called function.

+

The main work area is the primary display/work space. Obviously its content is depending on the called function.

The footer holds some general information:

-

Homepage

+ [Top] +

4.4 Homepage/Index

The main work area of the home displays statistical information:

Of course, all of this in respect to the current filter.

-

Utility functions

-

Configuration Page

-

The configuration page allows the user to specify settings important for the - overall operation of phpLogCon. So far, it will allow to configure: -

-

[Doc Home] [MonitorWare - Web Site]

-

Copyright © 2003 by Adiscon. Initiated by - Rainer Gerhards. See license for details.

+ [Top] +

4.5 Show Events

+

Here you can see the events; listed in respect to the current filter settings. Also you can use the quick filter, that allows you to override (not overwrite!) temporally your current filter settings. This provides a quick view on different filtered events, without going to the filter options. You can also choose how much event's should be displayed per page, color and search for an expression and search for a Host or IP.

+ [Top] +

4.6 Show SysLogTags

+

This page is especially created for watching the different SysLogTags. Here you can see all different SysLogTags, those appear in database with occurrences in database and sample message.

+

It brings you two new quick filters to filter and order the SysLogTags for fine-tuning:

+

Display SysLogTags

+

In this drop-down menu you can choose between 'Syslog', that will show you all Syslogs those appear in database with a sample message and 'SysLog corresponding to host', what will show you every SysLogTag that appeared on each Host.

+

Order by

+

You can order the Events ascending or descending by SysLogTag, Occurrences or Hosts, who have send this SysLogTag.

+

When you click on the example message, you'll get listed all occurrences of this SysLogTag. They're listed under respect of overall filter settings!

+ [Top] +

4.7 Details

+

You can reach the details through clicking on an events message. This page will give you full information about the selected event. Also you have direct links to the MonitorWare event reference and google groups to get additional information.

+ [Top] +

4.8 Filter Options

+

The filter options allow the user to specify filters important for output of the events. Which overall filters are available is listed above under point 4.2. For optimizing the events display you can choose which quick filter should be displayed. Also there are filters for the SysLogTag page. You can choose how they should be order and corresponding to which field, for example occurrences of one Tag.

+

If User Interface is enabled and the option "Save filter settings in database and load them while logging in" is checked, all filter settings will be saved in database. Otherwise, they only will stay like this in current session!

+

If User Interface is disabled, the settings will only stay like this in the current session. Next time opening phpLogCon, they will be default.

+ [Top] +

4.9 User Options

+

User options can look in two different versions:

+ +

When User Interface is enabled, there are more settings than in non User Interface mode. The basic settings that are available in both modes are:

+ +

The following settings are only available in User Interface mode:

+ + [Top] +

4.10 Refresh

+

Simply refresh the page. It's the same as hitting F5 in the most of the browsers.

+ [Top] + +

[Doc Home] [MonitorWare Web Site]

+
+ + + + +
+

+ phpLogCon, Copyright © 2003 - 2004 Adiscon GmbH +
+
diff --git a/events-display.php b/events-display.php index ada91bc..0a180c1 100644 --- a/events-display.php +++ b/events-display.php @@ -2,7 +2,7 @@ /*#### #### #### #### #### #### #### #### #### #### phpLogCon - A Web Interface to Log Data. -Copyright (C) 2003 Adiscon GmbH +Copyright (C) 2004 Adiscon GmbH This program 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 2 of the License, or (at your option) any later version. @@ -18,7 +18,7 @@ it become a reality. */#### #### #### #### #### #### #### #### #### #### - require('include.php'); + include 'include.php'; WriteStandardHeader(_MSGShwEvn); @@ -36,7 +36,6 @@ it become a reality. $cmdSQLlast_part .= $myFilter->GetSQLWherePart(0); $cmdSQLlast_part .= $myFilter->GetSQLSort(); - //Set Priority Filter if activated /*if ($Priority!=0) { $cmdSQLlast_part .= " where Priority = ".$Priority; @@ -61,11 +60,10 @@ it become a reality. echo "\tTemporally UNAVAIBLE!!"; echo ""; */ - echo '
'; //SQL statement to get result with limitation - $res = db_exec_limit($global_Con, $cmdSQLfirst_part, $cmdSQLmain_part, $cmdSQLlast_part, $myEventsNavigation->GetLimitLower(), $myEventsNavigation->GetPageSize()); + $res = db_exec_limit($global_Con, $cmdSQLfirst_part, $cmdSQLmain_part, $cmdSQLlast_part, $myEventsNavigation->GetLimitLower(), $myEventsNavigation->GetPageSize(), $myFilter->OrderBy); if($num == 0) { @@ -125,6 +123,7 @@ it become a reality. $numarraywords = count($words); } + $tc = 1; while($row = db_fetch_array($res)) { if (db_errno() != 0) @@ -132,8 +131,8 @@ it become a reality. echo db_errno() . ': ' . db_error(). '\n'; } - //choose InfoUnitdType 1 = SL = Syslog, 3 = Eventreporter, O = Other - switch ($row[6]) + //choose InfoUnitdType 1 = SL => Syslog ; 3 = ER => Eventreporter ; O = O => Other + switch ($row['InfoUnitID']) { case 1: $infounit = 'SL'; @@ -144,24 +143,23 @@ it become a reality. default: $infounit = 'O'; } - static $tc = 1; - if($row[5] == "") + if($row['Message'] == "") $message = _MSGNoMsg; else - $message = $row[5]; + $message = $row['Message']; echo ''; - echo ''; //date - echo ''; //facility + echo ''; //date + echo ''; //facility // get the description of priority (and get the the right color, if enabled) $pricol = 'TD' . $tc; - $priword = FormatPriority($row[3], $pricol); + $priword = FormatPriority($row['Priority'], $pricol); echo ''; echo ''; //InfoUnit - echo ''; //host + echo ''; //host $message = htmlspecialchars($message); @@ -207,7 +205,7 @@ it become a reality. } } - echo ''; //message + echo ''; //message //for changing colors if($tc == 1) $tc = 2; @@ -217,8 +215,7 @@ it become a reality. */ echo ''; } - + echo '
'.$row[1].''.$row[2].''.$row[_DATE].''.$row['Facility'].'', $priword, ''.$infounit.''.$row[4].''.$row['FromHost'].'', $message, '', $message, '
'; } - echo ''; WriteFood(); ?> \ No newline at end of file diff --git a/filter-config-process.php b/filter-config-process.php index 18a3e04..b744258 100644 --- a/filter-config-process.php +++ b/filter-config-process.php @@ -2,7 +2,7 @@ /*#### #### #### #### #### #### #### #### #### #### phpLogCon - A Web Interface to Log Data. -Copyright (C) 2003 Adiscon GmbH +Copyright (C) 2004 Adiscon GmbH This program 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 2 of the License, or (at your option) any later version. @@ -38,41 +38,6 @@ $szDescription = ""; global $global_Con; -/* - // Get Action - if ( !isset($_POST['action'] ) ) - $_POST['action'] = ""; - - if ($_POST['action'] == "ChangeGeneralConfig") - { - if ( !isset($_POST["enableui"]) ) - $_POST["enableui"] = 0; - - setcookie("connection_mode", $_POST['connection_mode'], time()+(60*60*24*365*10), "/"); - -*/ - -/* if( strcmp($_POST["enableui"], $_COOKIE["enable_ui"]) != 0) - { - if($_POST["enableui"] == "0") - { - setcookie("usr", "standard", _COOKIE_EXPIRE, "/"); - setcookie("sesid", "0", _COOKIE_EXPIRE, "/"); - } - else - { - setcookie("usr", "|", _COOKIE_EXPIRE, "/"); - setcookie("sesid", "|", _COOKIE_EXPIRE, "/"); - } - setcookie("enable_ui", $_POST['enableui'], time()+(60*60*24*365*10), "/"); - } - - -$szRedirectLink = "index.php"; -$szDescription = "General settings have been updated"; -*/ - - if( !isset($_POST['filConf']) ) $_POST['filConf'] = ""; @@ -81,6 +46,8 @@ if($_POST['filConf'] == "FilterConfig") // configure filter settings $_SESSION['ti'] = $_POST['ti']; $_SESSION['order'] = $_POST['order']; + $_SESSION['tag_order'] = $_POST['tag_order']; + $_SESSION['tag_sort'] = $_POST['tag_sort']; $_SESSION['refresh'] = $_POST['refresh']+0; // +0 make sure that is numeric // enable/disable quick filter options @@ -112,7 +79,7 @@ if($_POST['filConf'] == "FilterConfig") // If all infounits are unchecked it makes no sense, // because in this case, no messages were displayed. // So, activate all infounit types - if($_SESSION['infounit_sl'] == 0 && $_SESSION['infounit_er'] == 0 & $_SESSION['infounit_o'] == 0) + if($_SESSION['infounit_sl'] == 0 && $_SESSION['infounit_er'] == 0 && $_SESSION['infounit_o'] == 0) { $_SESSION['infounit_sl'] = 1; $_SESSION['infounit_er'] = 1; @@ -122,7 +89,7 @@ if($_POST['filConf'] == "FilterConfig") // If all priorities are unchecked it makes no sense, // because in this case, no messages were displayed. // So, activate all priority types - if($_SESSION['priority_0'] == 0 and $_SESSION['priority_1'] == 0 and $_SESSION['priority_2'] == 0 and $_SESSION['priority_3'] == 0 and $_SESSION['priority_4'] == 0 and $_SESSION['priority_5'] == 0 and $_SESSION['priority_6'] == 0 and $_SESSION['priority_7'] == 0) + if($_SESSION['priority_0'] == 0 && $_SESSION['priority_1'] == 0 && $_SESSION['priority_2'] == 0 && $_SESSION['priority_3'] == 0 && $_SESSION['priority_4'] == 0 && $_SESSION['priority_5'] == 0 && $_SESSION['priority_6'] == 0 && $_SESSION['priority_7'] == 0) { $_SESSION['priority_0'] = 1; $_SESSION['priority_1'] = 1; diff --git a/filter-config.php b/filter-config.php index ca04d9a..25fce07 100644 --- a/filter-config.php +++ b/filter-config.php @@ -2,7 +2,7 @@ /*#### #### #### #### #### #### #### #### #### #### phpLogCon - A Web Interface to Log Data. -Copyright (C) 2003 Adiscon GmbH +Copyright (C) 2004 Adiscon GmbH This program 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 2 of the License, or (at your option) any later version. @@ -20,11 +20,10 @@ it become a reality. - require("include.php"); + include "include.php"; WriteStandardHeader(_MSGFilConf); // If filter settings have been changed in quick filter, reload the old settings - if(isset($_SESSION['ti_old'])) { $_SESSION['ti'] = $_SESSION['ti_old']; @@ -32,6 +31,8 @@ it become a reality. $_SESSION['infounit_er'] = $_SESSION['infounit_er_old']; $_SESSION['infounit_o'] = $_SESSION['infounit_o_old']; $_SESSION['order'] = $_SESSION['order_old']; + $_SESSION['tag_order'] = $_SESSION['tag_order_old']; + $_SESSION['tag_sort'] = $_SESSION['tag_sort_old']; $_SESSION['refresh'] = $_SESSION['refresh_old']; session_unregister('ti_old'); @@ -39,44 +40,13 @@ it become a reality. session_unregister('infounit_er_old'); session_unregister('infounit_o_old'); session_unregister('order_old'); + session_unregister('tag_order_old'); + session_unregister('tag_sort_old'); session_unregister('refresh_old'); } ?> - -
-
- -

..:: ::..

- -
- - - - - - - - - - - - - - - -
:
: - -
This function has been turned off! Set this in config.php!
- -
- -
- -
@@ -130,9 +100,10 @@ it become a reality. >Info (6)
>Debug (7)
+ + - - @@ -140,16 +111,31 @@ it become a reality. - End this is not implemented yet! */ ?> - - - +End this is not implemented yet! */ ?>   + + + : + + + + : + + + + + + : + + + + + : diff --git a/forms/manually-date.php b/forms/manually-date.php index 66b4ad8..f775c70 100644 --- a/forms/manually-date.php +++ b/forms/manually-date.php @@ -37,7 +37,7 @@ All Events between: ?> -  + -   + -  and   +      + -   + - \ No newline at end of file diff --git a/forms/tag-order-by.php b/forms/tag-order-by.php new file mode 100644 index 0000000..d1855a3 --- /dev/null +++ b/forms/tag-order-by.php @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/forms/tag-sort.php b/forms/tag-sort.php new file mode 100644 index 0000000..3eabcb5 --- /dev/null +++ b/forms/tag-sort.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/include.php b/include.php index 5371d41..2059bee 100644 --- a/include.php +++ b/include.php @@ -2,7 +2,7 @@ /*#### #### #### #### #### #### #### #### #### #### phpLogCon - A Web Interface to Log Data. -Copyright (C) 2003 Adiscon GmbH +Copyright (C) 2004 Adiscon GmbH This program 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 2 of the License, or (at your option) any later version. @@ -25,7 +25,7 @@ it become a reality. * and provide some usefull functions */ - // disable error reporting + // enable it only for testing purposes error_reporting(E_ALL); header("Pragma: no-cache"); @@ -204,18 +204,34 @@ it become a reality. $_SESSION['infounit_er_old'] = $_SESSION['infounit_er']; $_SESSION['infounit_o_old'] = $_SESSION['infounit_o']; $_SESSION['order_old'] = $_SESSION['order']; + $_SESSION['tag_order_old'] = $_SESSION['tag_order']; + $_SESSION['tag_sort_old'] = $_SESSION['tag_sort']; $_SESSION['refresh_old'] = $_SESSION['refresh']; - $_SESSION['ti'] = $_POST['ti']; + if( isset($_POST['ti']) ) + $_SESSION['ti'] = $_POST['ti']; $_SESSION['infounit_sl'] = (isset($_POST['infounit_sl'])) ? 1 : 0; $_SESSION['infounit_er'] = (isset($_POST['infounit_er'])) ? 1 : 0; $_SESSION['infounit_o'] = (isset($_POST['infounit_o'])) ? 1 : 0; - $_SESSION['order'] = $_POST['order']; + if( !isset($_POST['order']) ) + { + $_POST['order'] = ''; + $_SESSION['tag_order'] = $_POST['tag_order']; + } + else + { + $_POST['tag_order'] = ''; + $_SESSION['order'] = $_POST['order']; + } + if( isset($_POST['tag_sort']) ) + $_SESSION['tag_sort'] = $_POST['tag_sort']; $_SESSION['refresh'] = $_POST['refresh']; + if( isset($_POST['show_methode']) ) + $_SESSION['show_methode'] = $_POST['show_methode']; } - //events-display.php + //events-display.php // InitVariable(2, "search", ""); // InitVariable(1, "regexp", ""); @@ -230,7 +246,7 @@ it become a reality. $_SESSION['infounit_er'] = 1; if (!isset($_SESSION['infounit_o'])) $_SESSION['infounit_o'] = 1; - + if (!isset($_SESSION['priority_0'])) $_SESSION['priority_0'] = 1; if (!isset($_SESSION['priority_1'])) @@ -258,16 +274,27 @@ it become a reality. // validation in eventfilter.php if (!isset($_SESSION['order'])) $_SESSION['order'] = 'date'; + + // forms/tag-order-by.php + // validation in eventfilter.php + if (!isset($_SESSION['tag_order'])) + $_SESSION['tag_order'] = 'Occurences'; + + // forms/tag-sort.php + // check sort ascending/descending + if (!isset($_SESSION['tag_sort'])) + $_SESSION['tag_sort'] = 'Asc'; // forms/refresh.php if (!isset($_SESSION['refresh'])) $_SESSION['refresh'] = 0; // default - - - /* - * forms/logs-per-page.php - * number of lines to be displayed, only numbers are allowed - */ + + //syslog-index.php + if( !isset($_SESSION['show_methode']) ) + $_SESSION['show_methode'] = "SysLogTag"; + + // forms/logs-per-page.php + // number of lines to be displayed, only numbers are allowed if (isset($_POST['epp'])) { if (is_numeric($_POST['epp'])) @@ -386,15 +413,15 @@ it become a reality. { if( !isset($_COOKIE['valid']) || $_COOKIE['valid'] == "0" ) { - WriteHead("phpLogCon :: " . _MSGAccDen, "", "", _MSGAccDen, 0); - echo "
..:: " . _MSGAccDen . " ::.."; - echo "

..:: " . _MSGBac2Ind . " ::.."; + header("Location: index.php"); exit; } else { session_register('usr'); + session_register('usrdis'); $_SESSION['usr'] = $_COOKIE['usr']; + $_SESSION['usrdis'] = $_COOKIE['usrdis']; LoadUserConfig(); } } @@ -522,6 +549,7 @@ it become a reality. */ WriteHead("phpLogCon :: " . $myMsg , "", "", $myMsg); } + CheckInstallDir(); } /*! @@ -586,26 +614,41 @@ it become a reality. /*! Gets Args from the active URL and returns them. !*/ - function GetSortedArgs() + function GetSortedArgs($mode) { $arCount = count($_SERVER["argv"]); - $sArgs = "?"; - if($arCount == 0) + if($arCount == 0 || $mode != 1) $sArgs = ""; else { + $sArgs = ""; for($i = 0; $i < $arCount; $i++) { if($i > 0) - $sArgs .= "&" . $_SERVER["argv"][$i]; + { + if( stristr($_SERVER["argv"][$i], "pagenum=") == FALSE) + $sArgs .= "&" . $_SERVER["argv"][$i]; + } else - $sArgs .= $_SERVER["argv"][$i]; + { + if( stristr($_SERVER["argv"][$i], "pagenum=") == FALSE) + $sArgs .= $_SERVER["argv"][$i]; + } } } return $sArgs; } + function CheckInstallDir() + { + if(file_exists("install/")) + { + echo "

" . _MSGInstDir . "

"; + } + clearstatcache(); + } + /*! Loads the Users Filter Configuration from database !*/ @@ -627,7 +670,7 @@ it become a reality. { global $global_Con; - $query = "SELECT Name, PropValue FROM userprefs WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_u%'"; + $query = "SELECT Name, PropValue FROM UserPrefs WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_u%'"; $result = db_exec($global_Con, $query); while($value = db_fetch_array($result)) { @@ -687,35 +730,36 @@ it become a reality. else $query[10] = "UPDATE UserPrefs SET PropValue=1 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_priority_7'"; - $query[11] = "UPDATE UserPrefs SET PropValue='" . $_POST['ti'] . "' WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_ti'"; $query[12] = "UPDATE UserPrefs SET PropValue='" . $_POST['order'] . "' WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_order'"; - $query[13] = "UPDATE UserPrefs SET PropValue='" . $_POST['refresh'] . "' WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_refresh'"; + $query[13] = "UPDATE UserPrefs SET PropValue='" . $_POST['tag_order'] . "' WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_tag_order'"; + $query[14] = "UPDATE UserPrefs SET PropValue='" . $_POST['tag_sort'] . "' WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_tag_sort'"; + $query[15] = "UPDATE UserPrefs SET PropValue='" . $_POST['refresh'] . "' WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_refresh'"; if( !isset($_POST['FilterInfoUnit']) ) - $query[14] = "UPDATE UserPrefs SET PropValue=0 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterInfoUnit'"; + $query[16] = "UPDATE UserPrefs SET PropValue=0 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterInfoUnit'"; else - $query[14] = "UPDATE UserPrefs SET PropValue=1 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterInfoUnit'"; + $query[16] = "UPDATE UserPrefs SET PropValue=1 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterInfoUnit'"; if( !isset($_POST['FilterOrderby']) ) - $query[15] = "UPDATE UserPrefs SET PropValue=0 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterOrderby'"; + $query[17] = "UPDATE UserPrefs SET PropValue=0 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterOrderby'"; else - $query[15] = "UPDATE UserPrefs SET PropValue=1 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterOrderby'"; + $query[17] = "UPDATE UserPrefs SET PropValue=1 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterOrderby'"; if( !isset($_POST['FilterRefresh']) ) - $query[16] = "UPDATE UserPrefs SET PropValue=0 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterRefresh'"; + $query[18] = "UPDATE UserPrefs SET PropValue=0 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterRefresh'"; else - $query[16] = "UPDATE UserPrefs SET PropValue=1 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterRefresh'"; + $query[18] = "UPDATE UserPrefs SET PropValue=1 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterRefresh'"; if( !isset($_POST['FilterColExp']) ) - $query[17] = "UPDATE UserPrefs SET PropValue=0 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterColExp'"; + $query[19] = "UPDATE UserPrefs SET PropValue=0 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterColExp'"; else - $query[17] = "UPDATE UserPrefs SET PropValue=1 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterColExp'"; + $query[19] = "UPDATE UserPrefs SET PropValue=1 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterColExp'"; if( !isset($_POST['FilterHost']) ) - $query[18] = "UPDATE UserPrefs SET PropValue=0 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterHost'"; + $query[20] = "UPDATE UserPrefs SET PropValue=0 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterHost'"; else - $query[18] = "UPDATE UserPrefs SET PropValue=1 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterHost'"; + $query[20] = "UPDATE UserPrefs SET PropValue=1 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterHost'"; if( !isset($_POST['FilterMsg']) ) - $query[19] = "UPDATE UserPrefs SET PropValue=0 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterMsg'"; + $query[21] = "UPDATE UserPrefs SET PropValue=0 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterMsg'"; else - $query[19] = "UPDATE UserPrefs SET PropValue=1 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterMsg'"; + $query[21] = "UPDATE UserPrefs SET PropValue=1 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_FilterMsg'"; return $query; } @@ -730,11 +774,11 @@ it become a reality. else $query[2] = "UPDATE UserPrefs SET PropValue=1 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_uSaveFilterSettings'"; if( !isset($_POST['debug']) ) - $query[2] = "UPDATE UserPrefs SET PropValue=0 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_uDebug'"; + $query[3] = "UPDATE UserPrefs SET PropValue=0 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_uDebug'"; else - $query[2] = "UPDATE UserPrefs SET PropValue=1 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_uDebug'"; + $query[3] = "UPDATE UserPrefs SET PropValue=1 WHERE UserLogin LIKE '" . $_SESSION['usr'] . "' AND Name LIKE 'PHPLOGCON_uDebug'"; return $query; } - + ?> diff --git a/index.php b/index.php index 14518a8..cfd0dff 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,7 @@ /*#### #### #### #### #### #### #### #### #### #### phpLogCon - A Web Interface to Log Data. -Copyright (C) 2003 Adiscon GmbH +Copyright (C) 2004 Adiscon GmbH This program 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 2 of the License, or (at your option) any later version. @@ -33,6 +33,7 @@ it become a reality. if ($_GET['do'] == 'logout') { setcookie("usr", "|", _COOKIE_EXPIRE, "/"); + setcookie("usrdis", "|", _COOKIE_EXPIRE, "/"); setcookie("valid", "0", _COOKIE_EXPIRE, "/"); session_unset(); header("Location: index.php"); @@ -50,6 +51,8 @@ it become a reality. { WriteHead("phpLogCon :: Index", "", "", "phpLogCon"); echo "
"; + CheckInstallDir(); + echo "
"; echo '', _MSG001, '.'; echo ''; @@ -64,7 +67,9 @@ it become a reality. { // reload session_register('usr'); + session_register('usrdis'); $_SESSION['usr'] = $_COOKIE['usr']; + $_SESSION['usrdis'] = $_COOKIE['usrdis']; LoadUserConfig(); header("Location: index.php"); exit; @@ -77,9 +82,8 @@ it become a reality. } } - WriteHead("phpLogCon :: Index", "", "", "phpLogCon"); - echo "
"; - + WriteStandardHeader('Index'); + echo '
'; include _CLASSES . 'eventfilter.php'; //the splitted sql statement @@ -90,7 +94,7 @@ it become a reality. //define the last part of the sql statment, e.g. the where part, ordery by, etc. $myFilter = New EventFilter; - $cmdSQLlast_part .= $myFilter->GetSQLWherePart(1); + $cmdSQLlast_part .= $myFilter->GetSQLWherePart(0); $cmdSQLlast_part .= $myFilter->GetSQLSort(); $myEventsNavigation = new EventsNavigation(5); @@ -101,18 +105,10 @@ it become a reality. $num = $myEventsNavigation->GetEventCount(); if(_ENABLEUI) - { - echo ''; - echo ''; - echo ''; - echo ''; - echo '
' . _MSGLogout . '
'; - echo '..:: ', _MSGLogSuc , ' ::..

'; - } - if(_ENABLEUI) - echo _MSGWel . ", " . $_SESSION["usr"] . "" . _MSGChoOpt; + echo _MSGWel . ", " . $_SESSION["usrdis"] . "" . _MSGChoOpt; else echo _MSGWel . _MSGChoOpt; + $SQLcmdfirst_part = "SELECT DISTINCT "; $SQLcmdmain_part = "(*) FROM "._DBTABLENAME; $SQLcmdlast_part = " WHERE "; @@ -127,10 +123,15 @@ it become a reality. $row_er = db_fetch_array($result_er); db_free_result($result_er); + if(strtolower(_DB_APP) == "mssql") + $rowIndex = 'num'; + else + $rowIndex = 0; + echo "

" . _MSGQuiInf . ":"; echo "
"; - echo ""; - echo ""; + echo ""; + echo ""; echo "
" . _MSGNumSLE . "" . $row_sl[0] . "
" . _MSGNumERE . "" . $row_er[0] . "
" . _MSGNumSLE . "" . $row_sl['num'] . "
" . _MSGNumERE . "" . $row_er['num'] . "
"; echo "
" . _MSGTop5 . ":

"; if($num == 0) @@ -150,8 +151,8 @@ it become a reality. echo "" . _MSGMsg . ""; echo ""; - $res = db_exec_limit($global_Con, $cmdSQLfirst_part, $cmdSQLmain_part, $cmdSQLlast_part, 1, 5); - + $res = db_exec_limit($global_Con, $cmdSQLfirst_part, $cmdSQLmain_part, $cmdSQLlast_part, 1, 5, $myFilter->OrderBy); + $i = 0; while($row = db_fetch_array($res)) { if (db_errno() != 0) @@ -160,7 +161,7 @@ it become a reality. } //choose InfoUnitdType 1 = SL = Syslog, 3 = Eventreport, O = Other - switch ($row[6]) + switch ($row['InfoUnitID']) { case 1: $infounit = "SL"; @@ -173,32 +174,25 @@ it become a reality. } static $tc = 1; echo ''; - echo '',$row[1],''; //date - echo '',$row[2],''; //facility + echo '',$row[_DATE],''; //date + echo '',$row['Facility'],''; //facility // get the description of priority (and get the the right color, if enabled) $pricol = 'TD' . $tc; - $priword = FormatPriority($row[3], $pricol); + $priword = FormatPriority($row['Priority'], $pricol); echo '', $priword, ''; echo "".$infounit.""; //InfoUnit - echo "".$row[4].""; //host - $message = $row[5]; + echo "".$row['FromHost'].""; //host + $message = $row['Message']; $message = str_replace("<", "<", $message); $message = str_replace(">", ">", $message); - echo '', $message, ''; //message + echo '', $message, ''; //message //for changing colors if($tc == 1) $tc = 2; else $tc = 1; - /* - echo "".$row['ReceivedAt'].""; - echo "".$row['Facility'].""; - echo "".$row['Priority'].""; - echo "".$row['FromHost'].""; - echo "".$row['Message'].""; - */ echo ""; } echo ""; diff --git a/install/include.php b/install/include.php index 6aa94f0..d28d140 100644 --- a/install/include.php +++ b/install/include.php @@ -61,7 +61,7 @@ function WriteFoot() function GetSQLQueries($strFilePath) { // Get SQL queries from file - $arQueryFile = file("scripts/" . $strFilePath); + $arQueryFile = file("../scripts/" . $strFilePath); for($i = 0, $j = 0; $i < count($arQueryFile); $i++) { diff --git a/install/install.php b/install/install.php index b260a20..b15f9a3 100644 --- a/install/install.php +++ b/install/install.php @@ -24,35 +24,45 @@ include "include.php"; WriteHead("phpLogCon :: Installation"); +if(!isset($_POST['instLang'])) +{ + echo "
Welcome to the installation of phpLogCon, the WebInterface to log data.
"; + echo ""; + echo ""; + echo "Please select your language for Installation progress: "; + echo ""; + echo "
"; + echo "
"; +} +else +{ + + include "../lang/" . $_POST['language'] . ".php"; + ?> -
Welcome to the installation of phpLogCon, the WebInterface to log data.
The following steps will guide you through the installation and help you to install and configure phpLogCon correctly.
Note: Fields marked with a * MUST be filled out! 'Host/IP' can be leaved blank in ODBC mode.
+




-
First we have to check your database structure, because phpLogCon needs some tables. If the tables don't exist, they will be created.
For this, phpLogCon Installation needs some information about your database Server:
+


- + - + - - - - @@ -61,27 +71,27 @@ WriteHead("phpLogCon :: Installation"); - + - + - + - + - + - +
.: Database Settings :..: :.  
Connection Type: *: * -
Database application: * -
Port (If standard, leave blank):Port ():
User (User must have "INSERT" and "CREATE" rights!): *:
Password: *:
Re-type password: *:
Database/DSN name: *: *
Database time format: *: *


-
Now we have to do some settings for phpLogCon to run clearly and user optimized.
Note: If you now select the UserInterface not to be installed, you can install it through a SQL-script file! See the manual for help.
+


- + - + - + - + - + @@ -127,27 +137,27 @@ WriteHead("phpLogCon :: Installation"); - + - + - + - + - + @@ -164,6 +174,8 @@ WriteHead("phpLogCon :: Installation"); \ No newline at end of file diff --git a/install/perform.php b/install/perform.php index f27aa7a..df8673d 100644 --- a/install/perform.php +++ b/install/perform.php @@ -27,41 +27,76 @@ WriteHead("phpLogCon :: Installation Progress"); ?> -
Checking users input... +
"; echo "While installing phpLogCon, there caused an error (Date: ".date("d.m.Y @ H:i")."):

"; echo "Operation: Check user's input!
"; - echo "Error: You have to fill out following fields: " . $strDbErrMsg . "
" . $strUiErrMsg . "


Go back and correct this!
..:: Go back to installation ::..
"; + echo "Error: You have to fill out following fields: " . $strDbErrMsg . "
" . $strUiErrMsg . "


Go back and correct this!
..:: Go back to installation ::..
"; echo "

"; exit; } ?> -Done!
-
Creating required tables... +
+
-Done!
-
Inserting values into tables... +
+
", $_POST['uiuser'], $arQueries[$i]); + $arQueries[$i] = ereg_replace("", $_POST['uilang'], $arQueries[$i]); db_exec($installCon, $arQueries[$i]); } + elseif( stristr($arQueries[$i], "SET IDENTITY_INSERT UserPrefs") ) + db_exec($installCon, $arQueries[$i]); } } @@ -209,8 +279,8 @@ db_close($installCon); ?> -Done!
-
Creating your config file (config.php)... +
+
-Done!
+

-
All processes have been done clearly!
Congratulations! You've successfully installed phpLogCon!
A file named 'config.php' is stored in the root directory of phpLogCon. In this file there are the whole information you have entered before! You can edit it to your needs if you want to.

Move to 'index.php' in root directory to start working with phpLogCon!

Don't forget to delete 'install.php', 'progress.php' and 'include.php' (NOT from root directory) from the 'install'-directory!
These files could be user for a DoS on your phpLogCon!
+









.


@@ -164,7 +165,7 @@ it become a reality.
.: phpLogCon General Settings :..: :.  
Default language::
User Interface:: - Configure? +
Create a User::  
Here you can create a user for the User Interface. If you already have some users in your database or you have unselected the UserInterface, you can leave these fields!
Note: You only have to fill out the fields marked with a * if you have entered a username!
 
 
Username::
Display name: *:
Password: *:
Re-type password: *:
Desired language::
| + | | | | - | + | " . strtoupper(_CON_MODE) . "" . _MSGMenInf2 . "" . strtoupper(_DB_APP) . "" . _MSGMenInf3 . "" . strtoupper(_DBNAME) . "";?>  


- phpLogCon, Copyright © 2003 - 2004 Adiscon GmbH + phpLogCon, Copyright © 2003 - 2004 Adiscon GmbH
diff --git a/quick-filter.php b/quick-filter.php index 89a8f0e..bf5d24e 100644 --- a/quick-filter.php +++ b/quick-filter.php @@ -2,7 +2,7 @@ /*#### #### #### #### #### #### #### #### #### #### phpLogCon - A Web Interface to Log Data. -Copyright (C) 2003 Adiscon GmbH +Copyright (C) 2004 Adiscon GmbH This program 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 2 of the License, or (at your option) any later version. @@ -20,94 +20,109 @@ it become a reality. -?> - - - -', _MSGFilOpt, ': '; + + echo _MSGLogPg, ': '; + include _FORMS.'logs-per-page.php'; + + if ($_SESSION['FilterInfoUnit'] == 1 && stristr($_SERVER['PHP_SELF'], 'syslog') == FALSE) { + echo " |"; echo ' ', _MSGDisIU, ': '; - include _FORMS.'display-infounit.php'; + include _FORMS.'display-infounit.php'; } - - if ($_SESSION['FilterOrderby']==1) - { - echo ' ', _MSGOrdBy, ': '; - include _FORMS.'order-by.php'; - } - - if ($_SESSION['FilterRefresh']==1) + + if ($_SESSION['FilterOrderby'] == 1) { + echo " |"; + echo ' ', _MSGOrdBy, ': '; + if(stristr($_SERVER['PHP_SELF'], 'syslog-index') != FALSE) include _FORMS.'tag-order-by.php'; + else include _FORMS.'order-by.php'; + } + + if ($_SESSION['FilterOrderby'] == 1 && stristr($_SERVER['PHP_SELF'], 'syslog-index') != FALSE) + { + echo ' '; + include _FORMS.'tag-sort.php'; + } + + if (stristr($_SERVER['PHP_SELF'], 'syslog-index') != FALSE) + { + echo " |"; + echo ' ', _MSGDisSlt, ': '; + include _FORMS.'syslog-show.php'; + } + + if ($_SESSION['FilterRefresh'] == 1) + { + echo " |"; echo ' ', _MSGRef, ': '; include _FORMS.'refresh.php'; } - - if ($_SESSION['FilterColExp']==1) + + if ($_SESSION['FilterColExp'] == 1) { + echo " |"; echo ' ', _MSGColExp, ' '; include _FORMS.'color-expression.php'; } - - if ($_SESSION['FilterHost']==1) + + if ($_SESSION['FilterHost'] == 1) { + echo " |"; echo ' ', _MSGFilHost, ': '; include _FORMS.'filter-host.php'; } - - if ($_SESSION['FilterMsg']==1) + + if ($_SESSION['FilterMsg'] == 1) { + echo " |"; echo ' ', _MSGSearchMsg, ': '; include _FORMS.'search-msg.php'; } - - } - echo '', _MSGFilOpt, ''; - + echo ""; + // this switch is only a temporarry solution. Which forms are displayed should be configureable in the user profil in the future! - if ($_SESSION['change'] == 'Predefined') - { - echo ' ', _MSGEvnDat, ' '; - include _FORMS.'events-date.php'; - echo ' ', _MSGLogPg, ': '; - include _FORMS.'logs-per-page.php'; - - ShowVarFilter(); - - echo ''; - } - else - { - echo ' '; - include _FORMS.'manually-date.php'; - echo ' '; - include _FORMS.'logs-per-page.php'; - - ShowVarFilter(); - - echo ''; - } - -?> - -
- -
-'; - //echo "" . _MSGSwiEvnMan . ""; + { + echo ''; + echo ''; + } else - echo ''; - //echo "" . _MSGSwiEvnPre . ''; + { + echo ''; + echo ''; + } ?> -
+ +
+ + + + +
+
\ No newline at end of file diff --git a/scripts/UserInserts.sql b/scripts/UserInserts.sql new file mode 100644 index 0000000..b94fdea --- /dev/null +++ b/scripts/UserInserts.sql @@ -0,0 +1,34 @@ +# phpLogCon - A Web Interface to Log Data. +# Copyright (C) 2003 - 2004 Adiscon GmbH +# +# This SQL file inserts values into 'Users' and 'UserPrefs' tables + +INSERT INTO Users (UserIDText, Password, DisplayName, LastLogon, UserType, PrefCulture) VALUES ('', '', '', , 1, ''); + +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_infounit_sl', '1'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_infounit_er', '1'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_infounit_o', '1'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_priority_0', '1'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_priority_1', '1'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_priority_2', '1'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_priority_3', '1'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_priority_4', '1'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_priority_5', '1'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_priority_6', '1'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_priority_7', '1'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_ti', 'today'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_order', 'Date'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_refresh', '0'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_FilterInfoUnit', '1'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_FilterOrderby', '1'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_FilterRefresh', '1'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_FilterColExp', '1'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_FilterHost', '1'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_FilterMsg', '1'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_favorites', 'www.adiscon.com|Adiscon,www.monitorware.com|MonitorWare,www.winsyslog.com|WinSysLog'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_tag_order', 'Occurences'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_tag_sort', 'Asc'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_uStylesheet', 'phplogcon'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_uLanguage', ''); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_uSaveFilterSettings', '0'); +INSERT INTO UserPrefs (UserLogin, Name, PropValue) VALUES ('', 'PHPLOGCON_uDebug', '0'); diff --git a/scripts/config.php.ex b/scripts/config.php.ex new file mode 100644 index 0000000..0fc1f64 --- /dev/null +++ b/scripts/config.php.ex @@ -0,0 +1,143 @@ +. See AUTHORS to learn who helped make +it become a reality. + +*/#### #### #### #### #### #### #### #### #### #### + + + // Set some defaults + ini_set("register_globals", "1"); + + +/* +************************************************** +* Begin of config variables * +* * ** * * +* You can change these settings to your need * +* * ** * * +* Only change if you know what you are doing * +************************************************** +*/ +/* +***** BEGIN DATABASE SETTINGS ***** +*/ + + //Server name (only needed if you not use ODBC) + define('_DBSERVER', 'localhost'); + + // DSN (ODBC) or database name (Mysql) + define('_DBNAME', 'monitorware'); + + // Userid for database connection *** + define('_DBUSERID', 'root'); + + // Password for database connection *** + define('_DBPWD', ''); + + // table name + define('_DBTABLENAME', 'SystemEvents'); + + // Switch for connection mode + // Currently only odbc and native works + define('_CON_MODE', 'native'); + + // Defines the Database Application you are using, + // because for example thx ODBC syntax of MySQL + // and Microsoft Access/SQL Server/etc are different + // Currently available are: + // with native: mysql + // with ODBC: mysql and mssql are available + define('_DB_APP', 'mysql'); + +/* +***** END DATABASE SETTINGS ***** +*/ +/* +***** BEGIN FOLDER SETTINGS ***** +*/ + + //The folder where the classes are stored + define('_CLASSES', 'classes/'); + + //The folder where the forms are stored + define('_FORMS', 'forms/'); + + //The folder where the database drivers are stored + define('_DB_DRV', 'db-drv/'); + + //The folder where the language files are stored + define('_LANG', 'lang/'); + + //your image folder + define('_ADLibPathImage', 'images/'); + + //folder for scripts i.g. extern javascript + define('_ADLibPathScript', 'layout/'); + +/* +***** END FOLDER SETTINGS ***** +*/ +/* +***** BEGIN VARIOUS SETTINGS ***** +*/ + + //Set to 1 and User Interface will be used! Set 0 to disable it. + define('_ENABLEUI', 0); + + //This sets the default language that will be used. + define('_DEFLANG', 'en'); + + // Use UTC time + define('_UTCtime', 0); + + // Get messages date by ReceivedAt or DeviceReportedTime + define('_DATE', 'ReceivedAt'); + + // Coloring priority + define('_COLPriority', 1); + +/* +***** END VARIOUS SETTINGS ***** +*/ + +/* +****************************************************** +* * ** * * +* From this point you shouldn't change something * +* * ** * * +* Only change if it is really required * +****************************************************** +*/ + + // Show quick filter enabled = 1, disabled = 0: + define('_FilterInfoUnit', 1); + define('_FilterOrderby', 1); + define('_FilterRefresh', 1); + define('_FilterColExp', 1); + define('_FilterHost', 1); + define('_FilterMsg', 1); + + //Session expire time. Unix-Timestamp. To set this value: + //call time(), that returns the seconds from 1.1.1970 (begin Unix-epoch) and add the + //time in seconds when the cookie should expire. + $session_time = (time()+(60*10)); + + //Cookie expire time. Unix-Timestamp. How to set this value, see "session_time". + define('_COOKIE_EXPIRE', (time()+60*60*24*30)); + +?> \ No newline at end of file diff --git a/scripts/mssql_ctSystemEvents.sql b/scripts/mssql_ctSystemEvents.sql new file mode 100644 index 0000000..75d412b --- /dev/null +++ b/scripts/mssql_ctSystemEvents.sql @@ -0,0 +1,33 @@ +# phpLogCon - A Web Interface to Log Data. +# Copyright (C) 2003 - 2004 Adiscon GmbH +# +# This SQL file creates the SystemEvents table for MSsql + +CREATE TABLE [SystemEvents] ( + [ID] [int] IDENTITY (1, 1) NOT NULL , + [CustomerID] [int] NOT NULL , + [ReceivedAt] [datetime] NOT NULL , + [DeviceReportedTime] [datetime] NOT NULL , + [Facility] [int] NOT NULL , + [Priority] [int] NOT NULL , + [FromHost] [varchar] (60) COLLATE Latin1_General_CI_AS NOT NULL , + [Message] [text] COLLATE Latin1_General_CI_AS NOT NULL , + [NTSeverity] [char] (3) COLLATE Latin1_General_CI_AS NOT NULL , + [Importance] [char] (3) COLLATE Latin1_General_CI_AS NOT NULL , + [EventSource] [varchar] (60) COLLATE Latin1_General_CI_AS NULL , + [EventUser] [varchar] (60) COLLATE Latin1_General_CI_AS NOT NULL , + [EventCategory] [int] NOT NULL , + [EventID] [int] NOT NULL , + [EventBinaryData] [text] COLLATE Latin1_General_CI_AS NOT NULL , + [MaxAvailable] [int] NOT NULL , + [CurrUsage] [int] NOT NULL , + [MinUsage] [int] NOT NULL , + [MaxUsage] [int] NOT NULL , + [InfoUnitID] [int] NOT NULL , + [SysLogTag] [varchar] (60) COLLATE Latin1_General_CI_AS NULL , + [EventLogType] [varchar] (60) COLLATE Latin1_General_CI_AS NULL , + [GenericFileName] [varchar] (60) COLLATE Latin1_General_CI_AS NULL , + [SystemID] [int] NOT NULL , + [Checksum] [int] NOT NULL , + PRIMARY KEY (ID) +); diff --git a/scripts/mssql_ctSystemEventsProperties.sql b/scripts/mssql_ctSystemEventsProperties.sql new file mode 100644 index 0000000..b5d55d2 --- /dev/null +++ b/scripts/mssql_ctSystemEventsProperties.sql @@ -0,0 +1,12 @@ +# phpLogCon - A Web Interface to Log Data. +# Copyright (C) 2003 - 2004 Adiscon GmbH +# +# This SQL file creates the SystemEventsProperties table for MSsql + +CREATE TABLE [SystemEventsProperties] ( + [ID] [int] IDENTITY (1, 1) NOT NULL , + [SystemEventID] [int] NULL , + [ParamName] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL , + [ParamValue] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL , + PRIMARY KEY (ID) +); diff --git a/scripts/mssql_ctUserPrefs.sql b/scripts/mssql_ctUserPrefs.sql new file mode 100644 index 0000000..52373cd --- /dev/null +++ b/scripts/mssql_ctUserPrefs.sql @@ -0,0 +1,12 @@ +# phpLogCon - A Web Interface to Log Data. +# Copyright (C) 2003 - 2004 Adiscon GmbH +# +# This SQL file creates the UserPrefs table for MSsql + +CREATE TABLE [UserPrefs] ( + [ID] [int] IDENTITY (1, 1) NOT NULL , + [UserLogin] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL , + [Name] [nvarchar] (255) COLLATE Latin1_General_CI_AS NULL , + [PropValue] [nvarchar] (200) COLLATE Latin1_General_CI_AS NULL , + PRIMARY KEY (ID) +); diff --git a/scripts/mssql_ctUsers.sql b/scripts/mssql_ctUsers.sql new file mode 100644 index 0000000..b57f6ae --- /dev/null +++ b/scripts/mssql_ctUsers.sql @@ -0,0 +1,16 @@ +# phpLogCon - A Web Interface to Log Data. +# Copyright (C) 2003 - 2004 Adiscon GmbH +# +# This SQL file creates the Users table for MSsql + +CREATE TABLE [Users] ( + [UserID] [int] IDENTITY (1, 1) NOT NULL , + [UserIDText] [nvarchar] (20) COLLATE Latin1_General_CI_AS NULL , + [Password] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL , + [DisplayName] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL , + [LastLogon] [smalldatetime] NULL , + [UserType] [int] NULL , + [HomeTZ] [int] NULL , + [PrefCulture] [nvarchar] (5) COLLATE Latin1_General_CI_AS NULL , + PRIMARY KEY (UserID) +); diff --git a/scripts/mysql_ctSystemEvents.sql b/scripts/mysql_ctSystemEvents.sql new file mode 100644 index 0000000..fe15ace --- /dev/null +++ b/scripts/mysql_ctSystemEvents.sql @@ -0,0 +1,33 @@ +# phpLogCon - A Web Interface to Log Data. +# Copyright (C) 2003 - 2004 Adiscon GmbH +# +# This SQL file creates the SystemEvents table for Mysql + +CREATE TABLE IF NOT EXISTS SystemEvents ( + ID int(10) unsigned NOT NULL auto_increment, + CustomerID int(11) NOT NULL default '0', + ReceivedAt datetime NOT NULL default '0000-00-00 00:00:00', + DeviceReportedTime datetime NOT NULL default '0000-00-00 00:00:00', + Facility int(11) NOT NULL default '0', + Priority int(11) NOT NULL default '0', + FromHost varchar(60) NOT NULL default '', + Message text NOT NULL, + NTSeverity char(3) NOT NULL default '', + Importance char(3) NOT NULL default '', + EventSource varchar(60) default NULL, + EventUser varchar(60) NOT NULL default '', + EventCategory int(11) NOT NULL default '0', + EventID int(11) NOT NULL default '0', + EventBinaryData text NOT NULL, + MaxAvailable int(11) NOT NULL default '0', + CurrUsage int(11) NOT NULL default '0', + MinUsage int(11) NOT NULL default '0', + MaxUsage int(11) NOT NULL default '0', + InfoUnitID int(11) NOT NULL default '0', + SysLogTag varchar(60) default NULL, + EventLogType varchar(60) default NULL, + GenericFileName varchar(60) default NULL, + SystemID int(11) NOT NULL default '0', + Checksum int(11) NOT NULL default '0', + PRIMARY KEY (ID) +) TYPE=MyISAM AUTO_INCREMENT=1 ; diff --git a/scripts/mysql_ctSystemEventsProperties.sql b/scripts/mysql_ctSystemEventsProperties.sql new file mode 100644 index 0000000..1d5d0b2 --- /dev/null +++ b/scripts/mysql_ctSystemEventsProperties.sql @@ -0,0 +1,11 @@ +# phpLogCon - A Web Interface to Log Data. +# Copyright (C) 2003 - 2004 Adiscon GmbH +# +# This SQL file creates the SystemEventsProperties table for Mysql + +CREATE TABLE IF NOT EXISTS SystemEventsProperties ( + ID int unsigned not null auto_increment primary key, + SystemEventID int NULL , + ParamName varchar (255) NULL , + ParamValue varchar (255) NULL +); diff --git a/scripts/mysql_ctUserPrefs.sql b/scripts/mysql_ctUserPrefs.sql new file mode 100644 index 0000000..8ec8f3f --- /dev/null +++ b/scripts/mysql_ctUserPrefs.sql @@ -0,0 +1,12 @@ +# phpLogCon - A Web Interface to Log Data. +# Copyright (C) 2003 - 2004 Adiscon GmbH +# +# This SQL file creates the UserPrefs table for Mysql + +CREATE TABLE IF NOT EXISTS UserPrefs ( + ID int(10) unsigned NOT NULL auto_increment, + UserLogin varchar(50) NOT NULL default '', + Name varchar(255) NOT NULL default '', + PropValue varchar(200) NOT NULL default '0', + PRIMARY KEY (ID) +) TYPE=MyISAM AUTO_INCREMENT=1 ; diff --git a/scripts/mysql_ctUsers.sql b/scripts/mysql_ctUsers.sql new file mode 100644 index 0000000..affa084 --- /dev/null +++ b/scripts/mysql_ctUsers.sql @@ -0,0 +1,16 @@ +# phpLogCon - A Web Interface to Log Data. +# Copyright (C) 2003 - 2004 Adiscon GmbH +# +# This SQL file creates the 'Users' and 'UserPrefs' tables + +CREATE TABLE IF NOT EXISTS Users ( + UserID int(10) unsigned NOT NULL auto_increment, + UserIDText varchar(20) NOT NULL default '', + Password varchar(50) NOT NULL default '', + DisplayName varchar(50) NOT NULL default '', + LastLogon datetime NOT NULL default '0000-00-00 00:00:00', + UserType int(11) NOT NULL default '0', + HomeTZ int(11) NOT NULL default '0', + PrefCulture varchar(5) NOT NULL default '', + PRIMARY KEY (UserID) +) TYPE=MyISAM AUTO_INCREMENT=1 ; diff --git a/submit.php b/submit.php index bb85a0c..84feaea 100644 --- a/submit.php +++ b/submit.php @@ -3,7 +3,7 @@ /*#### #### #### #### #### #### #### #### #### #### phpLogCon - A Web Interface to Log Data. -Copyright (C) 2003 Adiscon GmbH +Copyright (C) 2004 Adiscon GmbH This program 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 2 of the License, or (at your option) any later version. @@ -39,7 +39,7 @@ it become a reality. } else { - $query = "SELECT UserIDText, Password FROM Users WHERE UserIDText LIKE '" . $_POST['usr'] . "' AND Password LIKE '" . $_POST['pass'] . "'"; + $query = "SELECT UserIDText, Password, DisplayName FROM Users WHERE UserIDText LIKE '" . $_POST['usr'] . "' AND Password LIKE '" . $_POST['pass'] . "'"; $result = db_exec($global_Con, $query);// or die(db_die_with_error(_MSGInvQur . " :" . $query)); $num = db_num_rows($result); $result = db_fetch_singleresult($result); @@ -61,22 +61,25 @@ it become a reality. else { // $dat = now(); - // db_exec($global_Con, "UPDATE users SET phplogcon_lastlogin = ".dbc_sql_timeformat($dat)." WHERE UserIDText LIKE '".$_POST["usr"]."'"); + // db_exec($global_Con, "UPDATE Users SET phplogcon_lastlogin = ".dbc_sql_timeformat($dat)." WHERE UserIDText LIKE '".$_POST["usr"]."'"); session_register('save_cookies'); if($_POST['save_cookies'] == 1) { $_SESSION['save_cookies'] = $_POST['save_cookies']; setcookie("valid", 1, _COOKIE_EXPIRE, "/"); setcookie("usr", $result["UserIDText"], _COOKIE_EXPIRE, "/"); + setcookie("usrdis", $result["DisplayName"], _COOKIE_EXPIRE, "/"); } else $_SESSION['save_cookies'] = 0; session_register("usr"); + session_register("usrdis"); $_SESSION["usr"] = $result["UserIDText"]; + $_SESSION["usrdis"] = $result["DisplayName"]; LoadUserConfig(); - // Loading Users Config when enabled + // Loading Users Filter Config when enabled if($_SESSION['savefiltersettings']) LoadFilterConfig(); diff --git a/syslog-display.php b/syslog-display.php new file mode 100644 index 0000000..0a77d60 --- /dev/null +++ b/syslog-display.php @@ -0,0 +1,197 @@ +. See AUTHORS to learn who helped make +it become a reality. + +*/#### #### #### #### #### #### #### #### #### #### + + include 'include.php'; + + + + if( !isset($_GET['slt']) ) + { + header("Location: syslog-index.php"); + exit; + } + + WriteStandardHeader(_MSGShwSLog); + + //classes + include _CLASSES . 'eventsnavigation.php'; + include _CLASSES . 'eventfilter.php'; + + //the splitted sql statement + $cmdSQLfirst_part = 'SELECT '; + $cmdSQLmain_part = 'ID, '._DATE.', Facility, Priority, FromHost, Message FROM '._DBTABLENAME; + $cmdSQLlast_part = " WHERE InfoUnitID=1 AND SysLogTag LIKE '" . $_GET['slt'] . "' AND "; + + // define the last part of the sql statment, e.g. the where part, ordery by, etc. + $myFilter = New EventFilter; + $cmdSQLlast_part .= $myFilter->GetSQLWherePart(1); + $cmdSQLlast_part .= $myFilter->GetSQLSort(); + + // how much data records should be displayed on one page + if($_SESSION['epp'] < 1 || $_SESSION['epp'] > 100) + $myEventsNavigation = new EventsNavigation(20); + else + $myEventsNavigation = new EventsNavigation($_SESSION['epp']); + + $myEventsNavigation->SetEventCount($global_Con, $cmdSQLlast_part); + $num = $myEventsNavigation->GetEventCount(); + + // show (include) quick filters + include "quick-filter.php"; + +?> + + +
<<
+ +
'; + + //SQL statement to get result with limitation + $res = db_exec_limit($global_Con, $cmdSQLfirst_part, $cmdSQLmain_part, $cmdSQLlast_part, $myEventsNavigation->GetLimitLower(), $myEventsNavigation->GetPageSize(), $myFilter->OrderBy); + + echo ' + +
'; + echo _MSGEvn, ' ', $myEventsNavigation->GetLimitLower(), ' ', _MSGTo, ' ', $myEventsNavigation->GetLimitUpper(), ' ', _MSGFrm, ' ', $myEventsNavigation->GetEventCount(); + echo ''; + + $myEventsNavigation->ShowNavigation(); + +?> + +
+ + + + + + + + + + + +'; + echo ''; //date + echo ''; //date + echo ''; //host + echo ''; //facility + + // get the description of priority (and get the the right color, if enabled) + $pricol = 'TD' . $tc; + $priword = FormatPriority($row['Priority'], $pricol); + echo ''; + + $message = htmlspecialchars($message); + + if(isset($_POST['regexp']) && $_POST['regexp'] != "") + { + $_POST['regexp'] = trim($_POST['regexp']); + $messageUp = strtoupper($message); + $regexpUp = strtoupper($_POST['regexp']); + $search_pos = strpos($messageUp, $regexpUp); + if($search_pos !== FALSE) + { + $regexpLng = strlen($_POST['regexp']); + $strCount = substr_count($messageUp, $regexpUp); + $strTmp = $message; + + $message = ""; + for($i = 0; $i < $strCount; $i++) + { + $messageUp = strtoupper($strTmp); + $search_pos = strpos($messageUp, $regexpUp); + $subStrSt = substr($strTmp, 0 , $search_pos); + $subStrExp = substr($strTmp, $search_pos, $regexpLng); + $subStrEnd = substr($strTmp, ($search_pos + $regexpLng)); + $message .= $subStrSt . '' . $subStrExp . ''; + if($i == ($strCount - 1)) + $message .= $subStrEnd; + + $strTmp = $subStrEnd; + } + } + } + + //Replace the words that had been read out from the ini file + if($file != FALSE) + { + for($i = 0; $i < $numarraywords; $i++) + { + $repstr = ''; + $words[$i] = trim($words[$i]); + for($j = 0; $j < strlen($words[$i]); $j++) $repstr .= '*'; + if($words[$i] != '') + $message = eregi_replace($words[$i], $repstr, $message); + } + } + + echo ''; //message + + //for changing colors + if($tc == 1) $tc = 2; + else $tc = 1; + /* + echo ""; + */ + echo ''; + } + echo "
SysLogTag
' . $_GET['slt'] . '' . $row[_DATE] . '' . $row['FromHost'] . '' . $row['Facility'] . '', $priword, '', $message, '".$row['Priority']."
"; + WriteFood(); +?> \ No newline at end of file diff --git a/syslog-index.php b/syslog-index.php new file mode 100644 index 0000000..333ed9e --- /dev/null +++ b/syslog-index.php @@ -0,0 +1,239 @@ +. See AUTHORS to learn who helped make +it become a reality. + +*/#### #### #### #### #### #### #### #### #### #### + + include 'include.php'; + + + + if( !isset($_POST['sortMethode']) ) + $_POST['sortMethode'] = "ASC"; + + WriteStandardHeader(_MSGShwSlt); + + //classes + include _CLASSES . 'eventsnavigation.php'; + include _CLASSES . 'eventfilter.php'; + + +// SELECT COUNT(ID) AS occurences, ID, FromHost, Message, SysLogTag FROM SystemEvents WHERE InfoUnitID=1 AND ReceivedAt >= '2004-01-01 00:00:00' AND ReceivedAt <= '2004-10-26 23:59:59' GROUP BY SysLogTag ORDER BY occurences DESC limit 0,20 + +// SELECT COUNT(ID) AS occurences, SysLogTag FROM SystemEvents WHERE (InfoUnitID = 1) AND (ReceivedAt >= '2004-01-01 00:00:00') AND (ReceivedAt <= '2004-10-26 23:59:59') GROUP BY SysLogTag + + +// TO-DO: Change "ExampleHost" to "Most Host" + + //the splitted sql statement + // Cause MSSQL has proplems with GROUP BY clauses we need to do 2 DataBase-Queries + // the first one gets the occurences on one syslogtag, the syslogtag itself and the host. + // the second one only gets the message! + // Don't try to combine these two queries! MSSQL will give you a headnut! :D + $cmdSQLfirst_part = 'SELECT '; + $cmdSQLmain_part_1 = "COUNT(ID) AS occurences, SysLogTag"; + $cmdSQLmain_part_2 = "ID, Message FROM "._DBTABLENAME; + $cmdSQLlast_part_1 = ' WHERE InfoUnitID=1 AND '; + $cmdSQLlast_part_2 = ' WHERE InfoUnitID=1 AND '; + + // define the last part of the sql statment, e.g. the where part, ordery by, etc. + $myFilter = New EventFilter; + // Which methode is choosed? + if($_SESSION['show_methode'] == "Host") + { + $myFilter->SetSQLGroup("SysLogTagHost"); + $cmdSQLmain_part_1 .= ", FromHost FROM "._DBTABLENAME; + } + else + { + if($_SESSION['tag_order'] == "Host") + $_SESSION['tag_order'] = "SysLogTag"; + $myFilter->SetSQLGroup("SysLogTag"); + $cmdSQLmain_part_1 .= " FROM "._DBTABLENAME; + } + $cmdSQLlast_part_1 .= $myFilter->GetSQLWherePart(1); + $cmdSQLlast_part_2 .= $myFilter->GetSQLWherePart(1); + + // how much data records should be displayed on one page + if($_SESSION['epp'] < 1 || $_SESSION['epp'] > 100) + $myEventsNavigation = new EventsNavigation(20); + else + $myEventsNavigation = new EventsNavigation($_SESSION['epp']); + + // show (include) quick filters + include "quick-filter.php"; + + echo "
"; + + // how much data records match with the filter settings +// if(strtolower(_CON_MODE) == "odbc" && strtolower(_DB_APP) == "mssql") +// $myEventsNavigation->EventCount = odbc_record_count($global_Con, $cmdSQLfirst_part . $cmdSQLmain_part_1 . $cmdSQLlast_part_1); +// else + $myEventsNavigation->SetEventCount($global_Con, $cmdSQLlast_part_1); + $num = $myEventsNavigation->GetEventCount(); + $cmdSQLlast_part_1 .= $myFilter->GetSQLGroup(); + $cmdSQLlast_part_1 .= $myFilter->GetSysLogTagSQLSort(); + + // SQL statement to get result with limitation + $res1 = db_exec_limit($global_Con, $cmdSQLfirst_part, $cmdSQLmain_part_1, $cmdSQLlast_part_1, $myEventsNavigation->GetLimitLower(), $myEventsNavigation->GetPageSize(), $myFilter->OrderBy); + + if($num == 0) + { + // output if no data exit for the search string + echo '
', _MSGNoData, ''; + } + else + { + echo ''; + echo ' + +
'; + echo _MSGEvn, ' ', $myEventsNavigation->GetLimitLower(), ' ', _MSGTo, ' ', $myEventsNavigation->GetLimitUpper(), ' ', _MSGFrm, ' ', $myEventsNavigation->GetEventCount(); + echo ''; + + $myEventsNavigation->ShowNavigation(); + +?> + +
+ + + + Example Host";?> + + + + + +'; + if($_SESSION['show_methode'] == "Host") + echo ''; + echo ''; + echo ''; + + $message = htmlspecialchars($message); + + if(isset($_POST['regexp']) && $_POST['regexp'] != "") + { + $_POST['regexp'] = trim($_POST['regexp']); + $messageUp = strtoupper($message); + $regexpUp = strtoupper($_POST['regexp']); + $search_pos = strpos($messageUp, $regexpUp); + if($search_pos !== FALSE) + { + $regexpLng = strlen($_POST['regexp']); + $strCount = substr_count($messageUp, $regexpUp); + $strTmp = $message; + + $message = ""; + for($i = 0; $i < $strCount; $i++) + { + $messageUp = strtoupper($strTmp); + $search_pos = strpos($messageUp, $regexpUp); + $subStrSt = substr($strTmp, 0 , $search_pos); + $subStrExp = substr($strTmp, $search_pos, $regexpLng); + $subStrEnd = substr($strTmp, ($search_pos + $regexpLng)); + $message .= $subStrSt . '' . $subStrExp . ''; + if($i == ($strCount - 1)) + $message .= $subStrEnd; + + $strTmp = $subStrEnd; + } + } + } + + //Replace the words that had been read out from the ini file + if($file != FALSE) + { + for($i = 0; $i < $numarraywords; $i++) + { + $repstr = ''; + $words[$i] = trim($words[$i]); + for($j = 0; $j < strlen($words[$i]); $j++) $repstr .= '*'; + if($words[$i] != '') + $message = eregi_replace($words[$i], $repstr, $message); + } + } + + echo ''; //message + + //for changing colors + if($tc == 1) $tc = 2; + else $tc = 1; + /* + echo ""; + */ + echo ''; + } + echo "
SysLogTagOccurencesExample Message - Click for full list
' . $row1['FromHost'] . '' . $row1['SysLogTag'] . '' . $row1['occurences'] . '', $message, '".$row['Priority']."
"; + + + } + + WriteFood(); +?> \ No newline at end of file diff --git a/user-config-process.php b/user-config-process.php index f6ce381..c6a475d 100644 --- a/user-config-process.php +++ b/user-config-process.php @@ -2,7 +2,7 @@ /*#### #### #### #### #### #### #### #### #### #### phpLogCon - A Web Interface to Log Data. -Copyright (C) 2003 Adiscon GmbH +Copyright (C) 2004 Adiscon GmbH This program 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 2 of the License, or (at your option) any later version. diff --git a/user-config.php b/user-config.php index 9f30346..3397a48 100644 --- a/user-config.php +++ b/user-config.php @@ -2,7 +2,7 @@ /*#### #### #### #### #### #### #### #### #### #### phpLogCon - A Web Interface to Log Data. -Copyright (C) 2003 Adiscon GmbH +Copyright (C) 2004 Adiscon GmbH This program 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 2 of the License, or (at your option) any later version. @@ -29,7 +29,7 @@ it become a reality.
-

..:: ::..

+

..:: ::..

@@ -101,6 +101,9 @@ it become a reality. +
@@ -129,7 +132,8 @@ it become a reality. $result = db_fetch_singleresult($result); if($num != 0) { - echo ''; + echo ''; $sites = explode(",", $result["PropValue"]); $sitecntr = count($sites); for($i = 0; $i < $sitecntr; $i++) @@ -138,9 +142,7 @@ it become a reality. echo ""; } echo ''; - echo "\t\t"; echo "\t\t"; - echo "Sorry, GoTo Site is disabled at the moment!"; } else echo _MSGNoFav @@ -171,7 +173,7 @@ it become a reality.
\ No newline at end of file