mirror of
https://github.com/rsyslog/loganalyzer.git
synced 2025-09-26 11:19:26 +02:00
Added new description field for logstream sources.
If the description field is used, it will be shown below the pager on the main index site. A database field has also been added, the database version has been incremented as well. During next login, you will be prompted for a database update.
This commit is contained in:
parent
918cdcbb69
commit
2ee4d65ff5
@ -65,6 +65,7 @@ if ( isset($_GET['op']) )
|
|||||||
|
|
||||||
//PreInit these values
|
//PreInit these values
|
||||||
$content['Name'] = "";
|
$content['Name'] = "";
|
||||||
|
$content['Description'] = "";
|
||||||
$content['SourceType'] = SOURCE_DISK;
|
$content['SourceType'] = SOURCE_DISK;
|
||||||
CreateSourceTypesList($content['SourceType']);
|
CreateSourceTypesList($content['SourceType']);
|
||||||
$content['MsgParserList'] = "";
|
$content['MsgParserList'] = "";
|
||||||
@ -132,6 +133,7 @@ if ( isset($_GET['op']) )
|
|||||||
|
|
||||||
// Copy basic properties
|
// Copy basic properties
|
||||||
$content['Name'] = $mysource['Name'];
|
$content['Name'] = $mysource['Name'];
|
||||||
|
$content['Description'] = $mysource['Description'];
|
||||||
$content['SourceType'] = $mysource['SourceType'];
|
$content['SourceType'] = $mysource['SourceType'];
|
||||||
CreateSourceTypesList($content['SourceType']);
|
CreateSourceTypesList($content['SourceType']);
|
||||||
$content['MsgParserList'] = $mysource['MsgParserList'];
|
$content['MsgParserList'] = $mysource['MsgParserList'];
|
||||||
@ -267,6 +269,7 @@ if ( isset($_POST['op']) )
|
|||||||
// Read parameters first!
|
// Read parameters first!
|
||||||
if ( isset($_POST['id']) ) { $content['SOURCEID'] = intval(DB_RemoveBadChars($_POST['id'])); } else {$content['SOURCEID'] = -1; }
|
if ( isset($_POST['id']) ) { $content['SOURCEID'] = intval(DB_RemoveBadChars($_POST['id'])); } else {$content['SOURCEID'] = -1; }
|
||||||
if ( isset($_POST['Name']) ) { $content['Name'] = DB_RemoveBadChars($_POST['Name']); } else {$content['Name'] = ""; }
|
if ( isset($_POST['Name']) ) { $content['Name'] = DB_RemoveBadChars($_POST['Name']); } else {$content['Name'] = ""; }
|
||||||
|
if ( isset($_POST['Description']) ) { $content['Description'] = DB_RemoveBadChars($_POST['Description']); } else {$content['Description'] = ""; }
|
||||||
if ( isset($_POST['SourceType']) ) { $content['SourceType'] = DB_RemoveBadChars($_POST['SourceType']); }
|
if ( isset($_POST['SourceType']) ) { $content['SourceType'] = DB_RemoveBadChars($_POST['SourceType']); }
|
||||||
if ( isset($_POST['MsgParserList']) ) { $content['MsgParserList'] = DB_RemoveBadChars($_POST['MsgParserList']); }
|
if ( isset($_POST['MsgParserList']) ) { $content['MsgParserList'] = DB_RemoveBadChars($_POST['MsgParserList']); }
|
||||||
if ( isset($_POST['MsgNormalize']) ) { $content['MsgNormalize'] = intval(DB_RemoveBadChars($_POST['MsgNormalize'])); } else {$content['MsgNormalize'] = 0; }
|
if ( isset($_POST['MsgNormalize']) ) { $content['MsgNormalize'] = intval(DB_RemoveBadChars($_POST['MsgNormalize'])); } else {$content['MsgNormalize'] = 0; }
|
||||||
@ -419,6 +422,7 @@ if ( isset($_POST['op']) )
|
|||||||
// First create a tmp source array
|
// First create a tmp source array
|
||||||
$tmpSource['ID'] = $content['SOURCEID'];
|
$tmpSource['ID'] = $content['SOURCEID'];
|
||||||
$tmpSource['Name'] = $content['Name'];
|
$tmpSource['Name'] = $content['Name'];
|
||||||
|
$tmpSource['Description'] = $content['Description'];
|
||||||
$tmpSource['SourceType'] = $content['SourceType'];
|
$tmpSource['SourceType'] = $content['SourceType'];
|
||||||
$tmpSource['MsgParserList'] = $content['MsgParserList'];
|
$tmpSource['MsgParserList'] = $content['MsgParserList'];
|
||||||
$tmpSource['MsgNormalize'] = $content['MsgNormalize'];
|
$tmpSource['MsgNormalize'] = $content['MsgNormalize'];
|
||||||
@ -469,8 +473,9 @@ if ( isset($_POST['op']) )
|
|||||||
// Add custom search now!
|
// Add custom search now!
|
||||||
if ( $content['SourceType'] == SOURCE_DISK )
|
if ( $content['SourceType'] == SOURCE_DISK )
|
||||||
{
|
{
|
||||||
$sqlquery = "INSERT INTO " . DB_SOURCES . " (Name, SourceType, MsgParserList, MsgNormalize, ViewID, LogLineType, DiskFile, userid, groupid)
|
$sqlquery = "INSERT INTO " . DB_SOURCES . " (Name, Description, SourceType, MsgParserList, MsgNormalize, ViewID, LogLineType, DiskFile, userid, groupid)
|
||||||
VALUES ('" . $content['Name'] . "',
|
VALUES ('" . $content['Name'] . "',
|
||||||
|
'" . $content['Description'] . "',
|
||||||
" . $content['SourceType'] . ",
|
" . $content['SourceType'] . ",
|
||||||
'" . $content['MsgParserList'] . "',
|
'" . $content['MsgParserList'] . "',
|
||||||
" . $content['MsgNormalize'] . ",
|
" . $content['MsgNormalize'] . ",
|
||||||
@ -483,8 +488,9 @@ 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, SourceType, MsgParserList, MsgNormalize, ViewID, DBTableType, DBType, DBServer, DBName, DBUser, DBPassword, DBTableName, DBEnableRowCounting, userid, groupid)
|
$sqlquery = "INSERT INTO " . DB_SOURCES . " (Name, Description, SourceType, MsgParserList, MsgNormalize, ViewID, DBTableType, DBType, DBServer, DBName, DBUser, DBPassword, DBTableName, DBEnableRowCounting, userid, groupid)
|
||||||
VALUES ('" . $content['Name'] . "',
|
VALUES ('" . $content['Name'] . "',
|
||||||
|
'" . $content['Description'] . "',
|
||||||
" . $content['SourceType'] . ",
|
" . $content['SourceType'] . ",
|
||||||
'" . $content['MsgParserList'] . "',
|
'" . $content['MsgParserList'] . "',
|
||||||
" . $content['MsgNormalize'] . ",
|
" . $content['MsgNormalize'] . ",
|
||||||
@ -524,6 +530,7 @@ if ( isset($_POST['op']) )
|
|||||||
{
|
{
|
||||||
$sqlquery = "UPDATE " . DB_SOURCES . " SET
|
$sqlquery = "UPDATE " . DB_SOURCES . " SET
|
||||||
Name = '" . $content['Name'] . "',
|
Name = '" . $content['Name'] . "',
|
||||||
|
Description = '" . $content['Description'] . "',
|
||||||
SourceType = " . $content['SourceType'] . ",
|
SourceType = " . $content['SourceType'] . ",
|
||||||
MsgParserList = '" . $content['MsgParserList'] . "',
|
MsgParserList = '" . $content['MsgParserList'] . "',
|
||||||
MsgNormalize = " . $content['MsgNormalize'] . ",
|
MsgNormalize = " . $content['MsgNormalize'] . ",
|
||||||
@ -538,6 +545,7 @@ if ( isset($_POST['op']) )
|
|||||||
{
|
{
|
||||||
$sqlquery = "UPDATE " . DB_SOURCES . " SET
|
$sqlquery = "UPDATE " . DB_SOURCES . " SET
|
||||||
Name = '" . $content['Name'] . "',
|
Name = '" . $content['Name'] . "',
|
||||||
|
Description = '" . $content['Description'] . "',
|
||||||
SourceType = " . $content['SourceType'] . ",
|
SourceType = " . $content['SourceType'] . ",
|
||||||
MsgParserList = '" . $content['MsgParserList'] . "',
|
MsgParserList = '" . $content['MsgParserList'] . "',
|
||||||
MsgNormalize = " . $content['MsgNormalize'] . ",
|
MsgNormalize = " . $content['MsgNormalize'] . ",
|
||||||
|
@ -114,6 +114,7 @@ $CFG['Charts'][] = array ( "DisplayName" => "Usage by Day", "chart_type" => CHAR
|
|||||||
/* Example for DiskType Source:
|
/* Example for DiskType Source:
|
||||||
$CFG['Sources']['Source1']['ID'] = "Source1";
|
$CFG['Sources']['Source1']['ID'] = "Source1";
|
||||||
$CFG['Sources']['Source1']['Name'] = "Syslog Disk File";
|
$CFG['Sources']['Source1']['Name'] = "Syslog Disk File";
|
||||||
|
$CFG['Sources']['Source1']['Description'] = "More details you want to see about this source";
|
||||||
$CFG['Sources']['Source1']['SourceType'] = SOURCE_DISK;
|
$CFG['Sources']['Source1']['SourceType'] = SOURCE_DISK;
|
||||||
$CFG['Sources']['Source1']['LogLineType'] = "syslog";
|
$CFG['Sources']['Source1']['LogLineType'] = "syslog";
|
||||||
$CFG['Sources']['Source1']['MsgParserList'] = "";
|
$CFG['Sources']['Source1']['MsgParserList'] = "";
|
||||||
@ -123,6 +124,7 @@ $CFG['Charts'][] = array ( "DisplayName" => "Usage by Day", "chart_type" => CHAR
|
|||||||
|
|
||||||
$CFG['Sources']['Source2']['ID'] = "Source5";
|
$CFG['Sources']['Source2']['ID'] = "Source5";
|
||||||
$CFG['Sources']['Source2']['Name'] = "WinSyslog DB";
|
$CFG['Sources']['Source2']['Name'] = "WinSyslog DB";
|
||||||
|
$CFG['Sources']['Source1']['Description'] = "";
|
||||||
$CFG['Sources']['Source2']['SourceType'] = SOURCE_DB;
|
$CFG['Sources']['Source2']['SourceType'] = SOURCE_DB;
|
||||||
$CFG['Sources']['Source1']['MsgParserList'] = "";
|
$CFG['Sources']['Source1']['MsgParserList'] = "";
|
||||||
$CFG['Sources']['Source2']['DBTableType'] = "winsyslog";
|
$CFG['Sources']['Source2']['DBTableType'] = "winsyslog";
|
||||||
|
6
src/include/db_update_v4.txt
Normal file
6
src/include/db_update_v4.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
-- New Database Structure Updates
|
||||||
|
ALTER TABLE `logcon_sources` ADD `Description` TEXT NOT NULL AFTER `Name` ;
|
||||||
|
|
||||||
|
-- Insert data
|
||||||
|
|
||||||
|
-- Updated Data
|
@ -79,6 +79,12 @@ function InitSource(&$mysource)
|
|||||||
$CFG['Sources'][$iSourceID]['MsgNormalize'] = 0;
|
$CFG['Sources'][$iSourceID]['MsgNormalize'] = 0;
|
||||||
$content['Sources'][$iSourceID]['MsgNormalize'] = 0;
|
$content['Sources'][$iSourceID]['MsgNormalize'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !isset($mysource['Description']) )
|
||||||
|
{
|
||||||
|
$CFG['Sources'][$iSourceID]['Description'] = "";
|
||||||
|
$content['Sources'][$iSourceID]['Description'] = "";
|
||||||
|
}
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
// Set default view id to source
|
// Set default view id to source
|
||||||
@ -230,6 +236,14 @@ function InitSourceConfigs()
|
|||||||
// Set for the selection box in the header
|
// Set for the selection box in the header
|
||||||
$content['Sources'][$currentSourceID]['selected'] = "selected";
|
$content['Sources'][$currentSourceID]['selected'] = "selected";
|
||||||
|
|
||||||
|
// Set Description properties!
|
||||||
|
if ( isset($content['Sources'][$currentSourceID]['Description']) && strlen($content['Sources'][$currentSourceID]['Description']) > 0 )
|
||||||
|
{
|
||||||
|
$content['SourceDescriptionEnabled'] = true;
|
||||||
|
$content['SourceDescription'] = $content['Sources'][$currentSourceID]['Description'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// --- Additional handling needed for the current view!
|
// --- Additional handling needed for the current view!
|
||||||
global $currentViewID;
|
global $currentViewID;
|
||||||
$currentViewID = $content['Sources'][$currentSourceID]['ViewID'];
|
$currentViewID = $content['Sources'][$currentSourceID]['ViewID'];
|
||||||
|
@ -45,7 +45,7 @@ $errdesc = "";
|
|||||||
$errno = 0;
|
$errno = 0;
|
||||||
|
|
||||||
// --- Current Database Version, this is important for automated database Updates!
|
// --- Current Database Version, this is important for automated database Updates!
|
||||||
$content['database_internalversion'] = "3"; // Whenever incremented, a database upgrade is needed
|
$content['database_internalversion'] = "4"; // Whenever incremented, a database upgrade is needed
|
||||||
$content['database_installedversion'] = "0"; // 0 is default which means Prior Versioning Database
|
$content['database_installedversion'] = "0"; // 0 is default which means Prior Versioning Database
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
|
@ -192,8 +192,9 @@ function ConvertCustomSources()
|
|||||||
// Add New Entry
|
// Add New Entry
|
||||||
if ( $mySource['SourceType'] == SOURCE_DISK )
|
if ( $mySource['SourceType'] == SOURCE_DISK )
|
||||||
{
|
{
|
||||||
$result = DB_Query("INSERT INTO " . DB_SOURCES . " (Name, SourceType, MsgParserList, MsgNormalize, ViewID, LogLineType, DiskFile) VALUES ( " .
|
$result = DB_Query("INSERT INTO " . DB_SOURCES . " (Name, Description, SourceType, MsgParserList, MsgNormalize, ViewID, LogLineType, DiskFile) VALUES ( " .
|
||||||
"'" . PrepareValueForDB($mySource['Name']) . "', " .
|
"'" . PrepareValueForDB($mySource['Name']) . "', " .
|
||||||
|
"'" . PrepareValueForDB($mySource['Description']) . "', " .
|
||||||
" " . PrepareValueForDB($mySource['SourceType']) . " , " .
|
" " . PrepareValueForDB($mySource['SourceType']) . " , " .
|
||||||
"'" . PrepareValueForDB($mySource['MsgParserList']) . "', " .
|
"'" . PrepareValueForDB($mySource['MsgParserList']) . "', " .
|
||||||
" " . PrepareValueForDB($mySource['MsgNormalize']) . " , " .
|
" " . PrepareValueForDB($mySource['MsgNormalize']) . " , " .
|
||||||
@ -213,8 +214,9 @@ function ConvertCustomSources()
|
|||||||
$mySource['DBType'] = DB_MYSQL;
|
$mySource['DBType'] = DB_MYSQL;
|
||||||
|
|
||||||
// Perform the insert
|
// Perform the insert
|
||||||
$result = DB_Query("INSERT INTO " . DB_SOURCES . " (Name, SourceType, MsgParserList, MsgNormalize, ViewID, DBTableType, DBType, DBServer, DBName, DBUser, DBPassword, DBTableName, DBEnableRowCounting) VALUES ( " .
|
$result = DB_Query("INSERT INTO " . DB_SOURCES . " (Name, Description, SourceType, MsgParserList, MsgNormalize, ViewID, DBTableType, DBType, DBServer, DBName, DBUser, DBPassword, DBTableName, DBEnableRowCounting) VALUES ( " .
|
||||||
"'" . PrepareValueForDB($mySource['Name']) . "', " .
|
"'" . PrepareValueForDB($mySource['Name']) . "', " .
|
||||||
|
"'" . PrepareValueForDB($mySource['Description']) . "', " .
|
||||||
" " . PrepareValueForDB($mySource['SourceType']) . " , " .
|
" " . PrepareValueForDB($mySource['SourceType']) . " , " .
|
||||||
"'" . PrepareValueForDB($mySource['MsgParserList']) . "', " .
|
"'" . PrepareValueForDB($mySource['MsgParserList']) . "', " .
|
||||||
" " . PrepareValueForDB($mySource['MsgNormalize']) . " , " .
|
" " . PrepareValueForDB($mySource['MsgNormalize']) . " , " .
|
||||||
|
@ -220,7 +220,7 @@ $content['LN_SOURCES_HASBEENEDIT'] = "The Source '%1' has been successfully edit
|
|||||||
$content['LN_SOURCES_WARNDELETESEARCH'] = "Are you sure that you want to delete the Source '%1'? This cannot be undone!";
|
$content['LN_SOURCES_WARNDELETESEARCH'] = "Are you sure that you want to delete the Source '%1'? This cannot be undone!";
|
||||||
$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_'] = "";
|
$content['LN_SOURCES_DESCRIPTION'] = "Source Description (Optional)";
|
||||||
|
|
||||||
// Database Upgrade
|
// Database Upgrade
|
||||||
$content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update";
|
$content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update";
|
||||||
|
@ -221,7 +221,7 @@ $content['LN_SOURCES_HASBEENEDIT'] = "The Source '%1' has been successfully edit
|
|||||||
$content['LN_SOURCES_WARNDELETESEARCH'] = "Are you sure that you want to delete the Source '%1'? This cannot be undone!";
|
$content['LN_SOURCES_WARNDELETESEARCH'] = "Are you sure that you want to delete the Source '%1'? This cannot be undone!";
|
||||||
$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_'] = "";
|
$content['LN_SOURCES_DESCRIPTION'] = "Source Description (Optional)";
|
||||||
|
|
||||||
// Database Upgrade
|
// Database Upgrade
|
||||||
$content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update";
|
$content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update";
|
||||||
|
@ -220,7 +220,7 @@ $content['LN_SOURCES_HASBEENEDIT'] = "The Source '%1' has been successfully edit
|
|||||||
$content['LN_SOURCES_WARNDELETESEARCH'] = "Are you sure that you want to delete the Source '%1'? This cannot be undone!";
|
$content['LN_SOURCES_WARNDELETESEARCH'] = "Are you sure that you want to delete the Source '%1'? This cannot be undone!";
|
||||||
$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_'] = "";
|
$content['LN_SOURCES_DESCRIPTION'] = "Source Description (Optional)";
|
||||||
|
|
||||||
// Database Upgrade
|
// Database Upgrade
|
||||||
$content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update";
|
$content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update";
|
||||||
|
@ -102,6 +102,11 @@
|
|||||||
<td align="left" class="cellmenu2" width="250"><b>{LN_SOURCES_NAME}</b></td>
|
<td align="left" class="cellmenu2" width="250"><b>{LN_SOURCES_NAME}</b></td>
|
||||||
<td align="right" class="line1" width="350"><input type="text" name="Name" size="55" maxlength="255" value="{Name}"></td>
|
<td align="right" class="line1" width="350"><input type="text" name="Name" size="55" maxlength="255" value="{Name}"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="left" class="cellmenu2" width="250" valign="top"><b>{LN_SOURCES_DESCRIPTION}</b></td>
|
||||||
|
<td align="right" class="line1" width="350"><textarea name="Description" cols="50" rows="5">{Description}</textarea></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left" class="cellmenu2" nowrap><b>{LN_SOURCES_TYPE}</b></td>
|
<td align="left" class="cellmenu2" nowrap><b>{LN_SOURCES_TYPE}</b></td>
|
||||||
<td align="right" class="line1">
|
<td align="right" class="line1">
|
||||||
|
@ -122,7 +122,6 @@
|
|||||||
|
|
||||||
<table width="100%" align="center" border="0" cellpadding="1" cellspacing="1" class="with_border">
|
<table width="100%" align="center" border="0" cellpadding="1" cellspacing="1" class="with_border">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<td nowrap width="100%" class="line2" align="left">
|
<td nowrap width="100%" class="line2" align="left">
|
||||||
<!-- IF main_currentpagenumber_found="true" -->
|
<!-- IF main_currentpagenumber_found="true" -->
|
||||||
{LN_GEN_PAGE} {main_currentpagenumber}
|
{LN_GEN_PAGE} {main_currentpagenumber}
|
||||||
@ -218,6 +217,14 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<!-- IF SourceDescriptionEnabled="true" -->
|
||||||
|
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center">
|
||||||
|
<tr>
|
||||||
|
<td class="titleSecond" width="100%" align="left">{SourceDescription}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<!-- ENDIF SourceDescriptionEnabled="true" -->
|
||||||
|
|
||||||
<!-- IF syslogmessagesenabled="true" -->
|
<!-- IF syslogmessagesenabled="true" -->
|
||||||
<table width="100%" cellpadding="0" cellspacing="1" border="0" align="center" class="with_border_alternate">
|
<table width="100%" cellpadding="0" cellspacing="1" border="0" align="center" class="with_border_alternate">
|
||||||
<tr>
|
<tr>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user