Added new setting for MYSQL logstream sources to control the amount of data per query.

This value can be used to tweak MYSQL performance for your environment.
For example when filtering for fields which are generated by a message parser,
highering the value does improve the database performance. Default is 100.
This commit is contained in:
Andre Lorbach 2008-10-27 17:14:32 +01:00
parent 5a22843551
commit 4daa93225d
11 changed files with 38 additions and 7 deletions

View File

@ -102,6 +102,7 @@ if ( isset($_GET['op']) )
$content['SourceDBEnableRowCounting'] = "false"; $content['SourceDBEnableRowCounting'] = "false";
$content['SourceDBEnableRowCounting_true'] = ""; $content['SourceDBEnableRowCounting_true'] = "";
$content['SourceDBEnableRowCounting_false'] = "checked"; $content['SourceDBEnableRowCounting_false'] = "checked";
$content['SourceDBRecordsPerQuery'] = "100";
// General stuff // General stuff
$content['userid'] = null; $content['userid'] = null;
@ -188,6 +189,8 @@ if ( isset($_GET['op']) )
$content['SourceDBEnableRowCounting_true'] = ""; $content['SourceDBEnableRowCounting_true'] = "";
$content['SourceDBEnableRowCounting_false'] = "checked"; $content['SourceDBEnableRowCounting_false'] = "checked";
} }
$content['SourceDBRecordsPerQuery'] = $mysource['DBRecordsPerQuery'];
if ( $mysource['userid'] != null ) if ( $mysource['userid'] != null )
$content['CHECKED_ISUSERONLY'] = "checked"; $content['CHECKED_ISUSERONLY'] = "checked";
@ -302,6 +305,7 @@ if ( isset($_POST['op']) )
if ( isset($_POST['SourceDBServer']) ) { $content['SourceDBServer'] = DB_RemoveBadChars($_POST['SourceDBServer']); } if ( isset($_POST['SourceDBServer']) ) { $content['SourceDBServer'] = DB_RemoveBadChars($_POST['SourceDBServer']); }
if ( isset($_POST['SourceDBTableName']) ) { $content['SourceDBTableName'] = DB_RemoveBadChars($_POST['SourceDBTableName']); } if ( isset($_POST['SourceDBTableName']) ) { $content['SourceDBTableName'] = DB_RemoveBadChars($_POST['SourceDBTableName']); }
if ( isset($_POST['SourceDBUser']) ) { $content['SourceDBUser'] = DB_RemoveBadChars($_POST['SourceDBUser']); } if ( isset($_POST['SourceDBUser']) ) { $content['SourceDBUser'] = DB_RemoveBadChars($_POST['SourceDBUser']); }
if ( isset($_POST['SourceDBRecordsPerQuery']) ) { $content['SourceDBRecordsPerQuery'] = DB_RemoveBadChars($_POST['SourceDBRecordsPerQuery']); }
if ( isset($_POST['SourceDBPassword']) ) { $content['SourceDBPassword'] = DB_RemoveBadChars($_POST['SourceDBPassword']); } else {$content['SourceDBPassword'] = ""; } if ( isset($_POST['SourceDBPassword']) ) { $content['SourceDBPassword'] = DB_RemoveBadChars($_POST['SourceDBPassword']); } else {$content['SourceDBPassword'] = ""; }
if ( isset($_POST['SourceDBEnableRowCounting']) ) { $content['SourceDBEnableRowCounting'] = DB_RemoveBadChars($_POST['SourceDBEnableRowCounting']); } if ( isset($_POST['SourceDBEnableRowCounting']) ) { $content['SourceDBEnableRowCounting'] = DB_RemoveBadChars($_POST['SourceDBEnableRowCounting']); }
// Extra Check for this property // Extra Check for this property
@ -417,6 +421,11 @@ if ( isset($_POST['op']) )
$content['ISERROR'] = true; $content['ISERROR'] = true;
$content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_MISSINGPARAM'], $content['LN_CFG_DBUSER'] ); $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_MISSINGPARAM'], $content['LN_CFG_DBUSER'] );
} }
else if ( !is_numeric($content['SourceDBRecordsPerQuery']) )
{
$content['ISERROR'] = true;
$content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_INVALIDVALUE'], $content['LN_CFG_DBRECORDSPERQUERY'] );
}
} }
else else
{ {
@ -454,6 +463,7 @@ if ( isset($_POST['op']) )
$tmpSource['DBUser'] = $content['SourceDBUser']; $tmpSource['DBUser'] = $content['SourceDBUser'];
$tmpSource['DBPassword'] = $content['SourceDBPassword']; $tmpSource['DBPassword'] = $content['SourceDBPassword'];
$tmpSource['DBEnableRowCounting'] = $content['SourceDBEnableRowCounting']; $tmpSource['DBEnableRowCounting'] = $content['SourceDBEnableRowCounting'];
$tmpSource['DBRecordsPerQuery'] = $content['SourceDBRecordsPerQuery'];
$tmpSource['userid'] = $content['userid']; $tmpSource['userid'] = $content['userid'];
$tmpSource['groupid'] = $content['groupid']; $tmpSource['groupid'] = $content['groupid'];
} }
@ -500,7 +510,7 @@ if ( isset($_POST['op']) )
} }
else if ( $content['SourceType'] == SOURCE_DB || $content['SourceType'] == SOURCE_PDO ) else if ( $content['SourceType'] == SOURCE_DB || $content['SourceType'] == SOURCE_PDO )
{ {
$sqlquery = "INSERT INTO " . DB_SOURCES . " (Name, Description, SourceType, MsgParserList, MsgNormalize, MsgSkipUnparseable, ViewID, DBTableType, DBType, DBServer, DBName, DBUser, DBPassword, DBTableName, DBEnableRowCounting, userid, groupid) $sqlquery = "INSERT INTO " . DB_SOURCES . " (Name, Description, SourceType, MsgParserList, MsgNormalize, MsgSkipUnparseable, ViewID, DBTableType, DBType, DBServer, DBName, DBUser, DBPassword, DBTableName, DBEnableRowCounting, SourceDBRecordsPerQuery, userid, groupid)
VALUES ('" . $content['Name'] . "', VALUES ('" . $content['Name'] . "',
'" . $content['Description'] . "', '" . $content['Description'] . "',
" . $content['SourceType'] . ", " . $content['SourceType'] . ",
@ -516,6 +526,7 @@ if ( isset($_POST['op']) )
'" . $content['SourceDBPassword'] . "', '" . $content['SourceDBPassword'] . "',
'" . $content['SourceDBTableName'] . "', '" . $content['SourceDBTableName'] . "',
" . $content['SourceDBEnableRowCounting'] . ", " . $content['SourceDBEnableRowCounting'] . ",
" . $content['SourceDBRecordsPerQuery'] . ",
" . $content['userid'] . ", " . $content['userid'] . ",
" . $content['groupid'] . " " . $content['groupid'] . "
)"; )";
@ -573,6 +584,7 @@ if ( isset($_POST['op']) )
DBPassword = '" . $content['SourceDBPassword'] . "', DBPassword = '" . $content['SourceDBPassword'] . "',
DBTableName = '" . $content['SourceDBTableName'] . "', DBTableName = '" . $content['SourceDBTableName'] . "',
DBEnableRowCounting = " . $content['SourceDBEnableRowCounting'] . ", DBEnableRowCounting = " . $content['SourceDBEnableRowCounting'] . ",
DBRecordsPerQuery = " . $content['SourceDBRecordsPerQuery'] . ",
userid = " . $content['userid'] . ", userid = " . $content['userid'] . ",
groupid = " . $content['groupid'] . " groupid = " . $content['groupid'] . "
WHERE ID = " . $content['SOURCEID']; WHERE ID = " . $content['SOURCEID'];

View File

@ -1,5 +1,6 @@
-- New Database Structure Updates -- New Database Structure Updates
ALTER TABLE `logcon_sources` ADD `MsgSkipUnparseable` BOOL NOT NULL DEFAULT '0' AFTER `MsgNormalize` ; ALTER TABLE `logcon_sources` ADD `MsgSkipUnparseable` BOOL NOT NULL DEFAULT '0' AFTER `MsgNormalize` ;
ALTER TABLE `logcon_sources` ADD `DBRecordsPerQuery` INT NOT NULL DEFAULT '100' AFTER `DBEnableRowCounting` ;
-- Insert data -- Insert data

View File

@ -159,6 +159,7 @@ function InitSource(&$mysource)
if ( isset($mysource['DBUser']) ) { $mysource['ObjRef']->DBUser = $mysource['DBUser']; } if ( isset($mysource['DBUser']) ) { $mysource['ObjRef']->DBUser = $mysource['DBUser']; }
if ( isset($mysource['DBPassword']) ) { $mysource['ObjRef']->DBPassword = $mysource['DBPassword']; } if ( isset($mysource['DBPassword']) ) { $mysource['ObjRef']->DBPassword = $mysource['DBPassword']; }
if ( isset($mysource['DBEnableRowCounting']) ) { $mysource['ObjRef']->DBEnableRowCounting = $mysource['DBEnableRowCounting']; } if ( isset($mysource['DBEnableRowCounting']) ) { $mysource['ObjRef']->DBEnableRowCounting = $mysource['DBEnableRowCounting']; }
if ( isset($mysource['DBRecordsPerQuery']) ) { $mysource['ObjRef']->RecordsPerQuery = $mysource['DBRecordsPerQuery']; }
} }
else if ( $mysource['SourceType'] == SOURCE_PDO ) else if ( $mysource['SourceType'] == SOURCE_PDO )
{ {

View File

@ -223,6 +223,7 @@ $content['LN_SOURCES_WARNDELETESEARCH'] = "Are you sure that you want to delete
$content['LN_SOURCES_ERROR_DELSOURCE'] = "Deleting of the Source with id '%1' failed!"; $content['LN_SOURCES_ERROR_DELSOURCE'] = "Deleting of the Source with id '%1' failed!";
$content['LN_SOURCES_ERROR_HASBEENDEL'] = "The Source '%1' has been successfully deleted!"; $content['LN_SOURCES_ERROR_HASBEENDEL'] = "The Source '%1' has been successfully deleted!";
$content['LN_SOURCES_DESCRIPTION'] = "Source Description (Optional)"; $content['LN_SOURCES_DESCRIPTION'] = "Source Description (Optional)";
$content['LN_SOURCES_ERROR_INVALIDVALUE'] = "Invalid value for the paramater '%1'.";
// Database Upgrade // Database Upgrade
$content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update"; $content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update";

View File

@ -193,6 +193,7 @@ $content['LN_CFG_FIRSTSYSLOGSOURCE'] = "Erste Syslog Quelle";
$content['LN_CFG_MSGPARSERS'] = "Message Parsers (comma seperated)"; $content['LN_CFG_MSGPARSERS'] = "Message Parsers (comma seperated)";
$content['LN_CFG_NORMALIZEMSG'] = "Normalize Message within Parsers"; $content['LN_CFG_NORMALIZEMSG'] = "Normalize Message within Parsers";
$content['LN_CFG_SKIPUNPARSEABLE'] = "Skip unparseable messages (Only works if msgparsers are configured!)"; $content['LN_CFG_SKIPUNPARSEABLE'] = "Skip unparseable messages (Only works if msgparsers are configured!)";
$content['LN_CFG_DBRECORDSPERQUERY'] = "Recordcount for database queries";
// Details page // Details page
$content['LN_DETAILS_FORSYSLOGMSG'] = "Details für syslog-Nachrichten mit der ID"; $content['LN_DETAILS_FORSYSLOGMSG'] = "Details für syslog-Nachrichten mit der ID";

View File

@ -227,6 +227,7 @@ $content['LN_SOURCES_WARNDELETESEARCH'] = "Are you sure that you want to delete
$content['LN_SOURCES_ERROR_DELSOURCE'] = "Deleting of the Source with id '%1' failed!"; $content['LN_SOURCES_ERROR_DELSOURCE'] = "Deleting of the Source with id '%1' failed!";
$content['LN_SOURCES_ERROR_HASBEENDEL'] = "The Source '%1' has been successfully deleted!"; $content['LN_SOURCES_ERROR_HASBEENDEL'] = "The Source '%1' has been successfully deleted!";
$content['LN_SOURCES_DESCRIPTION'] = "Source Description (Optional)"; $content['LN_SOURCES_DESCRIPTION'] = "Source Description (Optional)";
$content['LN_SOURCES_ERROR_INVALIDVALUE'] = "Invalid value for the paramater '%1'.";
// Database Upgrade // Database Upgrade
$content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update"; $content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update";

View File

@ -195,6 +195,7 @@ $content['LN_CFG_DBUSERLOGINREQUIRED'] = "Require user to be logged in";
$content['LN_CFG_MSGPARSERS'] = "Message Parsers (comma seperated)"; $content['LN_CFG_MSGPARSERS'] = "Message Parsers (comma seperated)";
$content['LN_CFG_NORMALIZEMSG'] = "Normalize Message within Parsers"; $content['LN_CFG_NORMALIZEMSG'] = "Normalize Message within Parsers";
$content['LN_CFG_SKIPUNPARSEABLE'] = "Skip unparseable messages (Only works if msgparsers are configured!)"; $content['LN_CFG_SKIPUNPARSEABLE'] = "Skip unparseable messages (Only works if msgparsers are configured!)";
$content['LN_CFG_DBRECORDSPERQUERY'] = "Recordcount for database queries";
// Details page // Details page
$content['LN_DETAILS_FORSYSLOGMSG'] = "Details for the syslog messages with id"; $content['LN_DETAILS_FORSYSLOGMSG'] = "Details for the syslog messages with id";

View File

@ -223,6 +223,7 @@ $content['LN_SOURCES_WARNDELETESEARCH'] = "Are you sure that you want to delete
$content['LN_SOURCES_ERROR_DELSOURCE'] = "Deleting of the Source with id '%1' failed!"; $content['LN_SOURCES_ERROR_DELSOURCE'] = "Deleting of the Source with id '%1' failed!";
$content['LN_SOURCES_ERROR_HASBEENDEL'] = "The Source '%1' has been successfully deleted!"; $content['LN_SOURCES_ERROR_HASBEENDEL'] = "The Source '%1' has been successfully deleted!";
$content['LN_SOURCES_DESCRIPTION'] = "Source Description (Optional)"; $content['LN_SOURCES_DESCRIPTION'] = "Source Description (Optional)";
$content['LN_SOURCES_ERROR_INVALIDVALUE'] = "Invalid value for the paramater '%1'.";
// Database Upgrade // Database Upgrade
$content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update"; $content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update";

View File

@ -197,6 +197,7 @@ $content['LN_CFG_VIEW'] = "Selecione visão";
$content['LN_CFG_MSGPARSERS'] = "Message Parsers (comma seperated)"; $content['LN_CFG_MSGPARSERS'] = "Message Parsers (comma seperated)";
$content['LN_CFG_NORMALIZEMSG'] = "Normalize Message within Parsers"; $content['LN_CFG_NORMALIZEMSG'] = "Normalize Message within Parsers";
$content['LN_CFG_SKIPUNPARSEABLE'] = "Skip unparseable messages (Only works if msgparsers are configured!)"; $content['LN_CFG_SKIPUNPARSEABLE'] = "Skip unparseable messages (Only works if msgparsers are configured!)";
$content['LN_CFG_DBRECORDSPERQUERY'] = "Recordcount for database queries";
// Details page // Details page
$content['LN_DETAILS_FORSYSLOGMSG'] = "Detalhes para a mensagem com id"; $content['LN_DETAILS_FORSYSLOGMSG'] = "Detalhes para a mensagem com id";

View File

@ -17,14 +17,16 @@
showvisibility("HiddenDatabaseTypeOptions"); showvisibility("HiddenDatabaseTypeOptions");
hidevisibility("HiddenDiskTypeOptions"); hidevisibility("HiddenDiskTypeOptions");
hidevisibility("HiddenDBTypesOptions"); showvisibility("HiddenMYSQLSourceOptions");
hidevisibility("HiddenPDOSourceOptions");
} }
else if (myfield.value == 3) else if (myfield.value == 3)
{ {
showvisibility("HiddenDatabaseTypeOptions"); showvisibility("HiddenDatabaseTypeOptions");
hidevisibility("HiddenDiskTypeOptions"); hidevisibility("HiddenDiskTypeOptions");
showvisibility("HiddenDBTypesOptions"); showvisibility("HiddenPDOSourceOptions");
hidevisibility("HiddenMYSQLSourceOptions");
} }
} }
</script> </script>
@ -136,7 +138,7 @@
<td align="right" class="line1"><input type="checkbox" name="MsgNormalize" value="1" {CHECKED_ISNORMALIZEMSG}></td> <td align="right" class="line1"><input type="checkbox" name="MsgNormalize" value="1" {CHECKED_ISNORMALIZEMSG}></td>
</tr> </tr>
<tr> <tr>
<td align="left" class="cellmenu2" nowrap><b>{LN_CFG_SKIPUNPARSEABLE}</b></td> <td align="left" class="cellmenu2_naked"><b>{LN_CFG_SKIPUNPARSEABLE}</b></td>
<td align="right" class="line1"><input type="checkbox" name="MsgSkipUnparseable" value="1" {CHECKED_ISSKIPUNPARSEABLE}></td> <td align="right" class="line1"><input type="checkbox" name="MsgSkipUnparseable" value="1" {CHECKED_ISSKIPUNPARSEABLE}></td>
</tr> </tr>
@ -184,7 +186,7 @@
<tr><td align="center" class="cellmenu1" colspan="2"><b>{LN_CFG_DATABASETYPEOPTIONS}</b></td></tr> <tr><td align="center" class="cellmenu1" colspan="2"><b>{LN_CFG_DATABASETYPEOPTIONS}</b></td></tr>
</table> </table>
<div id="HiddenDBTypesOptions" class="ShownContent"> <div id="HiddenPDOSourceOptions" class="ShownContent">
<table border="0" cellpadding="1" cellspacing="1" width="600" align="center" class="with_border"> <table border="0" cellpadding="1" cellspacing="1" width="600" align="center" class="with_border">
<tr> <tr>
<td align="left" class="cellmenu2" width="250" nowrap><b>{LN_CFG_DBSTORAGEENGINE}</b></td> <td align="left" class="cellmenu2" width="250" nowrap><b>{LN_CFG_DBSTORAGEENGINE}</b></td>
@ -233,6 +235,15 @@
</table> </table>
</div> </div>
<div id="HiddenMYSQLSourceOptions" class="ShownContent">
<table border="0" cellpadding="1" cellspacing="1" width="600" align="center" class="with_border">
<tr>
<td align="left" class="cellmenu2" width="250" nowrap><b>{LN_CFG_DBRECORDSPERQUERY}</b></td>
<td align="right" class="line1" width="350"><input type="text" name="SourceDBRecordsPerQuery" size="40" maxlength="255" value="{SourceDBRecordsPerQuery}"></td>
</tr>
</table>
</div>
<table border="0" cellpadding="1" cellspacing="1" bgcolor="#DDDDDD" width="600" class="with_border_alternate"> <table border="0" cellpadding="1" cellspacing="1" bgcolor="#DDDDDD" width="600" class="with_border_alternate">
<tr> <tr>
<td align="center" colspan="2"> <td align="center" colspan="2">