Problems with DB-Connect in new v2.1.0

You need additional help with phplogcon, then write into this forum.

Problems with DB-Connect in new v2.1.0

Postby TestIT on Fri Apr 25, 2008 7:48 am

Hi,

i installed and configured phpLogCon v2.1.0 successfully but it does not work correctly.
While browsing to my phpLogCon-Site i got the following information:
Code: Select all
No syslog records found. - Error Details:
Unknown or unhandeled error occured.

I take a look at my apache-log:
Code: Select all
PHP Notice:  Use of undefined constant Source1 - assumed 'Source1' in /var/www/html/phplogcon/src/config.php on line 112, referer: http://xx.xxx.xxx/phplogcon/src/index.php
PHP Notice:  Use of undefined constant Source1 - assumed 'Source1' in /var/www/html/phplogcon/src/config.php on line 113, referer: http://xx.xxx.xxx/phplogcon/src/index.php
PHP Notice:  Use of undefined constant Source1 - assumed 'Source1' in /var/www/html/phplogcon/src/config.php on line 114, referer: http://xx.xxx.xxx/phplogcon/src/index.php
PHP Notice:  Use of undefined constant Source1 - assumed 'Source1' in /var/www/html/phplogcon/src/config.php on line 115, referer: http://xx.xxx.xxx/phplogcon/src/index.php
PHP Notice:  Use of undefined constant Source1 - assumed 'Source1' in /var/www/html/phplogcon/src/config.php on line 116, referer: http://xx.xxx.xxx/phplogcon/src/index.php
PHP Notice:  Use of undefined constant Source1 - assumed 'Source1' in /var/www/html/phplogcon/src/config.php on line 117, referer: http://xx.xxx.xxx/phplogcon/src/index.php
PHP Notice:  Use of undefined constant Source1 - assumed 'Source1' in /var/www/html/phplogcon/src/config.php on line 118, referer: http://xx.xxx.xxx/phplogcon/src/index.php
PHP Notice:  Use of undefined constant Source1 - assumed 'Source1' in /var/www/html/phplogcon/src/config.php on line 119, referer: http://xx.xxx.xxx/phplogcon/src/index.php
PHP Notice:  Use of undefined constant Source1 - assumed 'Source1' in /var/www/html/phplogcon/src/config.php on line 120, referer: http://xx.xxx.xxx/phplogcon/src/index.php
PHP Notice:  Use of undefined constant STATS_CONFIG - assumed 'STATS_CONFIG' in /var/www/html/phplogcon/src/include/functions_common.php on line 371, referer: http://xx.xxx.xxx/phplogcon/src/index.php
PHP Notice:  Undefined variable: CFG in /var/www/html/phplogcon/src/include/functions_db.php on line 96, referer: http://xx.xxx.xxx/phplogcon/src/index.php
PHP Notice:  Undefined variable: CFG in /var/www/html/phplogcon/src/include/functions_db.php on line 161, referer: http://xx.xxx.xxx/phplogcon/src/index.php


This is the mentioned config.php:
Code: Select all
<?php
/*
        *********************************************************************
        * phpLogCon - http://www.phplogcon.org
        * -----------------------------------------------------------------
        * Main Configuration File
        *
        * -> Configuration need variables for the Database connection
        *
        * Copyright (C) 2008 Adiscon GmbH.
        *
        * This file is part of phpLogCon.
        *
        * PhpLogCon 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 3 of the License, or
        * (at your option) any later version.
        *
        * PhpLogCon 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 phpLogCon. If not, see <http://www.gnu.org/licenses/>.
        *
        * A copy of the GPL can be found in the file "COPYING" in this
        * distribution.
        *********************************************************************
*/

// --- Avoid directly accessing this file!
if ( !defined('IN_PHPLOGCON') )
{
        die('Hacking attempt');
        exit;
}
// ---

// --- Database options
$CFG['UserDBEnabled'] = false;
$CFG['UserDBServer'] = "";
$CFG['UserDBPort'] = 3306;
$CFG['UserDBName'] = "";
$CFG['UserDBPref'] = "";
$CFG['UserDBUser'] = "";
$CFG['UserDBPass'] = "";
// ---

// --- Misc Options
$CFG['MiscShowDebugMsg'] = 0;                           // if enabled, you will get additional output on certain places
$CFG['MiscShowDebugGridCounter'] = 0;           // Only for debugging purposes, will add a counter column into the grid!
$CFG["MiscShowPageRenderStats"] = 1;            // If enabled, you will see Pagerender Settings
// ---

// --- Default Frontend Options
$CFG['ViewUseTodayYesterday'] = 1;                      // If enabled, the date from today and yesterday is displayed as "today" and "yesterday"
$CFG['ViewMessageCharacterLimit'] = 80;         // Default character limit for the message gets trunscated.
$CFG['ViewEntriesPerPage'] = 50;                        // Default number of syslog entries shown per page
$CFG['ViewEnableDetailPopups'] = 1;                     // If enabled, you will see additional Details for each syslog message on mouse over.
$CFG['ViewDefaultTheme'] = "default";           // This sets the default theme the user is going to see when he opens phplogcon the first time.
                                                                                        // Currently only "default" and "dark" are available.
$CFG['ViewDefaultLanguage'] = "en";                     // Sets the default display language

$CFG['SearchCustomButtonCaption'] = "I'd like to feel sad";     // Default caption for the custom fast search button
$CFG['SearchCustomButtonSearch'] = "error";                                     // Default search string for the custom search button
// ---

// --- Define which fields you want to see
//$CFG['ShowMessage'] = true;                                   // If enabled, the Message column will be appended to the columns list.
$CFG['Columns'][] = SYSLOG_DATE;
$CFG['Columns'][] = SYSLOG_FACILITY;
$CFG['Columns'][] = SYSLOG_SEVERITY;
$CFG['Columns'][] = SYSLOG_HOST;
$CFG['Columns'][] = SYSLOG_SYSLOGTAG;
$CFG['Columns'][] = SYSLOG_MESSAGETYPE;
$CFG['Columns'][] = SYSLOG_MESSAGE;
// ---

// --- Predefined Searches!
$CFG['Search'][] = array ( "DisplayName" => "Syslog Warnings and Errors", "SearchQuery" => "filter=severity%3A0%2C1%2C2%2C3%2C4&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "Syslog Errors", "SearchQuery" => "filter=severity%3A0%2C1%2C2%2C3&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from the last hour", "SearchQuery" => "filter=datelastx%3A1&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 12 hours", "SearchQuery" => "filter=datelastx%3A2&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 24 hours", "SearchQuery" => "filter=datelastx%3A3&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 7 days", "SearchQuery" => "filter=datelastx%3A4&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 31 days", "SearchQuery" => "filter=datelastx%3A5&search=Search" );
// $CFG['Search'][] = array ( "DisplayName" => "", "SearchQuery" => "" );
// ---

// --- 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'][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'][Source1]['ID'] = 'Source1';
$CFG['Sources'][Source1]['Name'] = 'SystemEvents';
$CFG['Sources'][Source1]['SourceType'] = 2;
$CFG['Sources'][Source1]['DBTableType'] = '';
$CFG['Sources'][Source1]['DBType'] = '0';
$CFG['Sources'][Source1]['DBServer'] = 'localhost';
$CFG['Sources'][Source1]['DBName'] = 'xxx';
$CFG['Sources'][Source1]['DBUser'] = 'xxx';
$CFG['Sources'][Source1]['DBPassword'] = 'xxx';
$CFG['Sources'][Source1]['DBTableName'] = 'SystemEvents';

// ---

?>


and this is my database table structure:
Code: Select all
mysql> describe SystemEvents;
+--------------------+------------------+------+-----+---------+----------------+
| Field              | Type             | Null | Key | Default | Extra          |
+--------------------+------------------+------+-----+---------+----------------+
| ID                 | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| CustomerID         | bigint(20)       | YES  |     | NULL    |                |
| ReceivedAt         | datetime         | YES  |     | NULL    |                |
| DeviceReportedTime | datetime         | YES  |     | NULL    |                |
| Facility           | smallint(6)      | YES  |     | NULL    |                |
| Priority           | smallint(6)      | YES  |     | NULL    |                |
| FromHost           | varchar(60)      | YES  |     | NULL    |                |
| Message            | text             | YES  |     | NULL    |                |
| NTSeverity         | int(11)          | YES  |     | NULL    |                |
| Importance         | int(11)          | YES  |     | NULL    |                |
| EventSource        | varchar(60)      | YES  |     | NULL    |                |
| EventUser          | varchar(60)      | YES  |     | NULL    |                |
| EventCategory      | int(11)          | YES  |     | NULL    |                |
| EventID            | int(11)          | YES  |     | NULL    |                |
| EventBinaryData    | text             | YES  |     | NULL    |                |
| MaxAvailable       | int(11)          | YES  |     | NULL    |                |
| CurrUsage          | int(11)          | YES  |     | NULL    |                |
| MinUsage           | int(11)          | YES  |     | NULL    |                |
| MaxUsage           | int(11)          | YES  |     | NULL    |                |
| InfoUnitID         | int(11)          | YES  |     | NULL    |                |
| SysLogTag          | varchar(60)      | YES  |     | NULL    |                |
| EventLogType       | varchar(60)      | YES  |     | NULL    |                |
| GenericFileName    | varchar(60)      | YES  |     | NULL    |                |
| SystemID           | int(11)          | YES  |     | NULL    |                |
+--------------------+------------------+------+-----+---------+----------------+


Code: Select all
mysql> describe SystemEventsProperties;
+---------------+------------------+------+-----+---------+----------------+
| Field         | Type             | Null | Key | Default | Extra          |
+---------------+------------------+------+-----+---------+----------------+
| ID            | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| SystemEventID | int(11)          | YES  |     | NULL    |                |
| ParamName     | varchar(255)     | YES  |     | NULL    |                |
| ParamValue    | text             | YES  |     | NULL    |                |
+---------------+------------------+------+-----+---------+----------------+


It seems to me that this is an bug while creating the config.php,
but i do not know how to correct the config.php.
Furthermore i dont know how to handle the Undefined variable: CFG inside the built-in scripts functions_db.php + functions_common.php

Can anyone help me?

Regards
Marcus
TestIT
New
 
Posts: 4
Joined: Fri Apr 25, 2008 7:16 am

Postby alorbach on Fri Apr 25, 2008 10:24 am

Hi,

there are two minor bugs in the installer one caused these notices, please replace the source configurations with this:

Code: Select all
$CFG['Sources']['Source1']['ID'] = 'Source1';
$CFG['Sources']['Source1']['Name'] = 'SystemEvents';
$CFG['Sources']['Source1']['SourceType'] = 2;
$CFG['Sources']['Source1']['DBTableType'] = '';
$CFG['Sources']['Source1']['DBType'] = '0';
$CFG['Sources']['Source1']['DBServer'] = 'localhost';
$CFG['Sources']['Source1']['DBName'] = 'xxx';
$CFG['Sources']['Source1']['DBUser'] = 'xxx';
$CFG['Sources']['Source1']['DBPassword'] = 'xxx';
$CFG['Sources']['Source1']['DBTableName'] = 'SystemEvents';


To remove the other annoying notices, please edit include/functions_common.php and search for "function InitPhpDebugMode()".

Replace the whole function with this:
Code: Select all
function InitPhpDebugMode()
{
   global $content, $CFG;
   // --- Set Global DEBUG Level!
   if ( $CFG['MiscShowDebugMsg'] == 1 )
      ini_set( "error_reporting", E_ALL ); // ALL PHP MESSAGES!
   // ---
}


This will also be fixed in the next release.
User avatar
alorbach
Site Admin
 
Posts: 853
Joined: Thu Feb 13, 2003 11:55 am

Postby TestIT on Fri Apr 25, 2008 11:52 am

Hi,
thanks for that hint but this time i got (without the "referer"):
Code: Select all
PHP Notice:  Undefined variable: CFG in /var/www/html/phplogcon/src/include/functions_db.php on line 96
PHP Notice:  Undefined variable: CFG in /var/www/html/phplogcon/src/include/functions_db.php on line 161

Thanks in advance
Marcus
TestIT
New
 
Posts: 4
Joined: Fri Apr 25, 2008 7:16 am

Postby alorbach on Fri Apr 25, 2008 11:56 am

Another two notices. The next version will have them fixed, however they do not relate to the database source at all. The function_db.php is not in use right now, it will become useful for the userinterface in later development.

The next minor release will be released today.
User avatar
alorbach
Site Admin
 
Posts: 853
Joined: Thu Feb 13, 2003 11:55 am

Postby TestIT on Fri Apr 25, 2008 11:59 am

Hmmm
but i still get the error
Code: Select all
No syslog records found. - Error Details:
Unknown or unhandeled error occured.

How to debug and find the cause? The apache error log doesnt show any errors except the above ones.
TestIT
New
 
Posts: 4
Joined: Fri Apr 25, 2008 7:16 am

Postby alorbach on Fri Apr 25, 2008 12:18 pm

Hrm I see that the DBTableType is missing, please replace

Code: Select all
$CFG['Sources']['Source1']['DBTableType'] = "";

with
Code: Select all
$CFG['Sources']['Source1']['DBTableType'] = "winsyslog";
User avatar
alorbach
Site Admin
 
Posts: 853
Joined: Thu Feb 13, 2003 11:55 am

Postby TestIT on Fri Apr 25, 2008 1:02 pm

:D ... thats it. It works for me.
TestIT
New
 
Posts: 4
Joined: Fri Apr 25, 2008 7:16 am

Postby alorbach on Fri Apr 25, 2008 2:04 pm

Very well :)
Btw you can obtain the new version 2.1.1 from here now:
http://www.phplogcon.org/downloads

Upgrading is very simple, just copy all files over your existing ones, except for install.php - you don't need this file to copy.
All your settings will remain intact.
User avatar
alorbach
Site Admin
 
Posts: 853
Joined: Thu Feb 13, 2003 11:55 am

Google Ads



Return to Help

Who is online

Users browsing this forum: No registered users and 0 guests

cron