diff --git a/src/include/config.sample.php b/src/include/config.sample.php index 56ac775..1c6e6d7 100644 --- a/src/include/config.sample.php +++ b/src/include/config.sample.php @@ -75,7 +75,8 @@ $CFG['EnableIPAddressResolve'] = 1; // If enabled, IP Addresses inline message // --- Define which fields you want to see //$CFG['ShowMessage'] = true; // If enabled, the Message column will be appended to the columns list. //Eventlog based fields: $CFG['Columns'] = array ( SYSLOG_DATE, SYSLOG_HOST, SYSLOG_EVENT_LOGTYPE, SYSLOG_EVENT_SOURCE, /*SYSLOG_EVENT_CATEGORY, */SYSLOG_EVENT_ID, SYSLOG_MESSAGE ); -$CFG['Columns'] = array ( SYSLOG_DATE, SYSLOG_FACILITY, SYSLOG_SEVERITY, SYSLOG_HOST, SYSLOG_SYSLOGTAG, SYSLOG_MESSAGETYPE, SYSLOG_MESSAGE ); +//$CFG['Columns'] = array ( SYSLOG_DATE, SYSLOG_FACILITY, SYSLOG_SEVERITY, SYSLOG_HOST, SYSLOG_SYSLOGTAG, SYSLOG_MESSAGETYPE, SYSLOG_MESSAGE ); +$CFG['DefaultViewsID'] = ""; // --- // --- Predefined Searches! @@ -91,22 +92,24 @@ $CFG['Search'][] = array ( "DisplayName" => "All messages from last 31 days", "S // --- Source Options /* Example for DiskType Source: - $CFG['Sources'][Source1]['ID'] = "Source1"; - $CFG['Sources'][Source1]['Name'] = "Syslog Disk File"; - $CFG['Sources'][Source1]['SourceType'] = SOURCE_DISK; - $CFG['Sources'][Source1]['LogLineType'] = "syslog"; - $CFG['Sources'][Source1]['DiskFile'] = "/var/log/syslog"; + $CFG['Sources']['Source1']['ID'] = "Source1"; + $CFG['Sources']['Source1']['Name'] = "Syslog Disk File"; + $CFG['Sources']['Source1']['SourceType'] = SOURCE_DISK; + $CFG['Sources']['Source1']['LogLineType'] = "syslog"; + $CFG['Sources']['Source1']['DiskFile'] = "/var/log/syslog"; + $CFG['Sources']['Source1']['ViewID'] = "SYSLOG"; - $CFG['Sources'][Source2]['ID'] = "Source5"; - $CFG['Sources'][Source2]['Name'] = "WinSyslog DB"; - $CFG['Sources'][Source2]['SourceType'] = SOURCE_DB; - $CFG['Sources'][Source2]['DBTableType'] = "winsyslog"; - $CFG['Sources'][Source2]['DBType'] = DB_MYSQL; - $CFG['Sources'][Source2]['DBServer'] = "localhost"; - $CFG['Sources'][Source2]['DBName'] = "phplogcon"; - $CFG['Sources'][Source2]['DBUser'] = "root"; - $CFG['Sources'][Source2]['DBPassword'] = ""; - $CFG['Sources'][Source2]['DBTableName'] = "systemevents"; + $CFG['Sources']['Source2']['ID'] = "Source5"; + $CFG['Sources']['Source2']['Name'] = "WinSyslog DB"; + $CFG['Sources']['Source2']['SourceType'] = SOURCE_DB; + $CFG['Sources']['Source2']['DBTableType'] = "winsyslog"; + $CFG['Sources']['Source2']['DBType'] = DB_MYSQL; + $CFG['Sources']['Source2']['DBServer'] = "localhost"; + $CFG['Sources']['Source2']['DBName'] = "phplogcon"; + $CFG['Sources']['Source2']['DBUser'] = "root"; + $CFG['Sources']['Source2']['DBPassword'] = ""; + $CFG['Sources']['Source2']['DBTableName'] = "systemevents"; + $CFG['Sources']['Source2']['ViewID'] = "SYSLOG"; */ // --- %Insert Source Here% diff --git a/src/include/functions_config.php b/src/include/functions_config.php index 671ef02..b9eaac3 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -78,6 +78,7 @@ else // Not configured, maybe old legacy cfg. Set default view. $content['Sources'][$iSourceID]['ViewID'] = strlen($CFG['DefaultViewsID']) > 0 ? $CFG['DefaultViewsID'] : "SYSLOG"; + } // Only for the display box diff --git a/src/install.php b/src/install.php index d6b00e5..1fbc98b 100644 --- a/src/install.php +++ b/src/install.php @@ -228,6 +228,17 @@ else if ( $content['INSTALL_STEP'] == 3 ) $content['ViewEnableDetailPopups_true'] = ""; $content['ViewEnableDetailPopups_false'] = "checked"; } + if ( isset($_SESSION['EnableIPAddressResolve']) ) { $content['EnableIPAddressResolve'] = $_SESSION['EnableIPAddressResolve']; } else { $content['EnableIPAddressResolve'] = 1; } + if ( $content['EnableIPAddressResolve'] == 1 ) + { + $content['EnableIPAddressResolve_true'] = "checked"; + $content['EnableIPAddressResolve_false'] = ""; + } + else + { + $content['EnableIPAddressResolve_true'] = ""; + $content['EnableIPAddressResolve_false'] = "checked"; + } // --- // Disable the bottom next button, as the Form in this step has its own button! @@ -315,6 +326,12 @@ else if ( $content['INSTALL_STEP'] == 4 ) $_SESSION['ViewEnableDetailPopups'] = intval( DB_RemoveBadChars($_POST['ViewEnableDetailPopups']) ); else $_SESSION['ViewEnableDetailPopups'] = 1; // Fallback default! + + if ( isset($_POST['EnableIPAddressResolve']) ) + $_SESSION['EnableIPAddressResolve'] = intval( DB_RemoveBadChars($_POST['EnableIPAddressResolve']) ); + else + $_SESSION['EnableIPAddressResolve'] = 1; // Fallback default! + // --- // If UserDB is disabled, skip next step! @@ -463,6 +480,17 @@ else if ( $content['INSTALL_STEP'] == 7 ) if ( isset($_SESSION['SourceType']) ) { $content['SourceType'] = $_SESSION['SourceType']; } else { $content['SourceType'] = SOURCE_DISK; } CreateSourceTypesList($content['SourceType']); if ( isset($_SESSION['SourceName']) ) { $content['SourceName'] = $_SESSION['SourceName']; } else { $content['SourceName'] = "My Syslog Source"; } + + // Init default View + if ( isset($_SESSION['SourceViewID']) ) { $content['SourceViewID'] = $_SESSION['SourceViewID']; } else { $content['SourceViewID'] = 'SYSLOG'; } + foreach ( $content['Views'] as $myView ) + { + if ( $myView['ID'] == $content['SourceViewID'] ) + $content['Views'][ $myView['ID'] ]['selected'] = "selected"; + else + $content['Views'][ $myView['ID'] ]['selected'] = ""; + } + // SOURCE_DISK specific if ( isset($_SESSION['SourceLogLineType']) ) { $content['SourceLogLineType'] = $_SESSION['SourceLogLineType']; } else { $content['SourceLogLineType'] = ""; } @@ -510,6 +538,12 @@ else if ( $content['INSTALL_STEP'] == 8 ) else RevertOneStep( $content['INSTALL_STEP']-1, $content['LN_CFG_PARAMMISSING'] . $content['LN_CFG_NAMEOFTHESOURCE'] ); + if ( isset($_POST['SourceViewID']) ) + $_SESSION['SourceViewID'] = DB_RemoveBadChars($_POST['SourceViewID']); + else + RevertOneStep( $content['INSTALL_STEP']-1, $content['LN_CFG_PARAMMISSING'] . $content['LN_CFG_VIEW'] ); + + // Check DISK Parameters! if ( $_SESSION['SourceType'] == SOURCE_DISK) { @@ -581,10 +615,12 @@ else if ( $content['INSTALL_STEP'] == 8 ) $patterns[] = "/\\\$CFG\['ViewMessageCharacterLimit'\] = [0-9]{1,2};/"; $patterns[] = "/\\\$CFG\['ViewEntriesPerPage'\] = [0-9]{1,2};/"; $patterns[] = "/\\\$CFG\['ViewEnableDetailPopups'\] = [0-9]{1,2};/"; + $patterns[] = "/\\\$CFG\['EnableIPAddressResolve'\] = [0-9]{1,2};/"; $patterns[] = "/\\\$CFG\['UserDBEnabled'\] = [0-9]{1,2};/"; $replacements[] = "\$CFG['ViewMessageCharacterLimit'] = " . $_SESSION['ViewMessageCharacterLimit'] . ";"; $replacements[] = "\$CFG['ViewEntriesPerPage'] = " . $_SESSION['ViewEntriesPerPage'] . ";"; $replacements[] = "\$CFG['ViewEnableDetailPopups'] = " . $_SESSION['ViewEnableDetailPopups'] . ";"; + $replacements[] = "\$CFG['EnableIPAddressResolve'] = " . $_SESSION['EnableIPAddressResolve'] . ";"; $replacements[] = "\$CFG['UserDBEnabled'] = " . $_SESSION['UserDBEnabled'] . ";"; //User Database Options @@ -596,7 +632,9 @@ else if ( $content['INSTALL_STEP'] == 8 ) //Add the first source! $firstsource = "\$CFG['DefaultSourceID'] = 'Source1';\n\n" . "\$CFG['Sources']['Source1']['ID'] = 'Source1';\n" . - "\$CFG['Sources']['Source1']['Name'] = '" . $_SESSION['SourceName'] . "';\n"; + "\$CFG['Sources']['Source1']['Name'] = '" . $_SESSION['SourceName'] . "';\n" . + "\$CFG['Sources']['Source1']['ViewID'] = '" . $_SESSION['SourceViewID'] . "';\n"; + if ( $_SESSION['SourceType'] == SOURCE_DISK ) { $firstsource .= "\$CFG['Sources']['Source1']['SourceType'] = SOURCE_DISK;\n" . diff --git a/src/lang/de/main.php b/src/lang/de/main.php index e76e87a..afded35 100644 --- a/src/lang/de/main.php +++ b/src/lang/de/main.php @@ -145,6 +145,7 @@ $content['LN_CFG_DBSTORAGEENGINE'] = "Datenbank Typ"; $content['LN_CFG_DBTABLENAME'] = "Datenbank Tabellenname"; $content['LN_CFG_NAMEOFTHESOURCE'] = "Name der Quelle"; $content['LN_CFG_FIRSTSYSLOGSOURCE'] = "Erste Syslog Quelle"; + $content['LN_CFG_VIEW'] = "Select View"; // Details page $content['LN_DETAILS_FORSYSLOGMSG'] = "Details für syslog-Nachrichten mit der ID"; diff --git a/src/lang/en/main.php b/src/lang/en/main.php index 751f451..8c67bb0 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -148,6 +148,7 @@ $content['LN_CFG_DBTABLENAME'] = "Database Tablename"; $content['LN_CFG_NAMEOFTHESOURCE'] = "Name of the Source"; $content['LN_CFG_FIRSTSYSLOGSOURCE'] = "First Syslog Source"; $content['LN_CFG_DBROWCOUNTING'] = "Enable Row Counting"; + $content['LN_CFG_VIEW'] = "Select View"; // Details page $content['LN_DETAILS_FORSYSLOGMSG'] = "Details for the syslog messages with id"; diff --git a/src/templates/install.html b/src/templates/install.html index 75e40d5..319d70d 100644 --- a/src/templates/install.html +++ b/src/templates/install.html @@ -183,6 +183,12 @@ Yes No +
@@ -301,6 +307,16 @@ +