mirror of
https://github.com/rsyslog/loganalyzer.git
synced 2025-09-26 11:19:26 +02:00
Added new feature to resolve IP Addresses into DNS Names and display them.
- The DNS Names will be injected in into the message text displayed in brackets like 172.16.0.1 {server.something.xxx}. This feature can be turned of in the configuration file. - Removed some stylesheet bugs in the main display related to the menu. - optimized automatic linking for IP Addresses.
This commit is contained in:
parent
cf6f9b454e
commit
c49fbd56a4
@ -4,6 +4,7 @@
|
||||
}
|
||||
|
||||
#menu ul { /* remove bullets and list indents */
|
||||
position: absolute;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
@ -68,6 +68,8 @@ $CFG['ViewEnableAutoReloadSeconds'] = 0; // If "ViewEnableAutoReloadSeconds" is
|
||||
|
||||
$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
|
||||
|
||||
$CFG['EnableIPAddressResolve'] = 1; // If enabled, IP Addresses inline messages are automatically resolved and the result is added in brackets {} behind the IP Address
|
||||
// ---
|
||||
|
||||
// --- Define which fields you want to see
|
||||
|
@ -397,10 +397,13 @@ function InitPhpDebugMode()
|
||||
|
||||
function CheckAndSetRunMode()
|
||||
{
|
||||
global $RUNMODE;
|
||||
global $RUNMODE, $MaxExecutionTime;
|
||||
// Set to command line mode if argv is set!
|
||||
if ( !isset($_SERVER["GATEWAY_INTERFACE"]) )
|
||||
$RUNMODE = RUNMODE_COMMANDLINE;
|
||||
|
||||
// Obtain max_execution_time
|
||||
$MaxExecutionTime = ini_get("max_execution_time");
|
||||
}
|
||||
|
||||
function InitRuntimeInformations()
|
||||
@ -854,8 +857,15 @@ function GetMonthFromString($szMonth)
|
||||
*/
|
||||
function AddContextLinks(&$sourceTxt)
|
||||
{
|
||||
global $szTLDDomains;
|
||||
global $szTLDDomains, $CFG;
|
||||
|
||||
// Return if not enabled!
|
||||
if ( !isset($CFG['EnableIPAddressResolve']) || $CFG['EnableIPAddressResolve'] == 1 )
|
||||
{
|
||||
// Search for IP's and Add Reverse Lookup first!
|
||||
$sourceTxt = preg_replace( '/\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/e', "'\\1.\\2.\\3.\\4' . ReverseResolveIP('\\1.\\2.\\3.\\4', '<font class=\"highlighted\"> {', '} </font>')", $sourceTxt );
|
||||
}
|
||||
|
||||
// Create if not set!
|
||||
if ( !isset($szTLDDomains) )
|
||||
CreateTopLevelDomainSearch();
|
||||
@ -864,14 +874,15 @@ function AddContextLinks(&$sourceTxt)
|
||||
$search = array
|
||||
(
|
||||
'/\.([\w\d\_]+)\.(' . $szTLDDomains . ')([^a-zA-Z0-9])/x',
|
||||
'|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|',
|
||||
// '|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|',
|
||||
'/\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/x',
|
||||
);
|
||||
|
||||
// Create Replace Array
|
||||
$replace = array
|
||||
(
|
||||
'.<a href="http://kb.monitorware.com/kbsearch.php?sa=whois&oid=name&origin=phplogcon&q=$1.$2" target="_top" class="contextlink">$1.$2</a>$3',
|
||||
'<a href="http://kb.monitorware.com/kbsearch.php?sa=whois&oid=ip&origin=phplogcon&q=$1" target="_top" class="contextlink">$1</a>',
|
||||
'<a href="http://kb.monitorware.com/kbsearch.php?sa=whois&oid=ip&origin=phplogcon&q=$1.$2.$3.$4" target="_top" class="contextlink">$1.$2.$3.$4</a>',
|
||||
);
|
||||
|
||||
// Replace and return!
|
||||
@ -881,6 +892,44 @@ function AddContextLinks(&$sourceTxt)
|
||||
//return $outTxt;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reserve Resolve IP Address!
|
||||
*/
|
||||
function ReverseResolveIP( $szIP, $prepend, $append )
|
||||
{
|
||||
global $gl_starttime, $MaxExecutionTime;
|
||||
|
||||
// Substract 5 savety seconds!
|
||||
$scriptruntime = intval(microtime_float() - $gl_starttime);
|
||||
if ( $scriptruntime > ($MaxExecutionTime-5) )
|
||||
{
|
||||
echo "WTF $scriptruntime - $MaxExecutionTime";
|
||||
return "";
|
||||
}
|
||||
|
||||
// Abort if these IP's are postet
|
||||
if ( strpos("0.0.0.0", $szIP) !== false | strpos("127.", $szIP) !== false | strpos("255.255.255.255", $szIP) !== false )
|
||||
return "";
|
||||
else
|
||||
{
|
||||
// Resolve name if needed
|
||||
if ( !isset($_SESSION['dns_cache'][$szIP]) )
|
||||
$_SESSION['dns_cache'][$szIP] = gethostbyaddr($szIP);
|
||||
|
||||
// Abort if IP and RESOLVED name are the same ^^!
|
||||
if ( $_SESSION['dns_cache'][$szIP] == $szIP )
|
||||
return;
|
||||
|
||||
// Create string
|
||||
$szReturn = $prepend;
|
||||
$szReturn .= $_SESSION['dns_cache'][$szIP];
|
||||
$szReturn .= $append;
|
||||
|
||||
// return result
|
||||
return $szReturn;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper function to create a top level domain search string ONCE per process!
|
||||
*/
|
||||
|
@ -73,6 +73,7 @@ $content['LN_SEARCH_PERFORMADVANCED'] = "Erweiterte Suche starten";
|
||||
$content['LN_VIEW_FILTERFOR'] = "Filter message for ";
|
||||
$content['LN_VIEW_SEARCHFOR'] = "Search online for ";
|
||||
$content['LN_VIEW_SEARCHFORGOOGLE'] = "Search Google for ";
|
||||
$content['LN_GEN_MESSAGEDETAILS'] = "Message Details";
|
||||
|
||||
$content['LN_HIGHLIGHT'] = "Hightlight >>";
|
||||
$content['LN_HIGHLIGHT_OFF'] = "Hightlight <<";
|
||||
|
@ -74,6 +74,7 @@ $content['LN_VIEW_RELATEDMSG'] = "View related syslog messages";
|
||||
$content['LN_VIEW_FILTERFOR'] = "Filter message for ";
|
||||
$content['LN_VIEW_SEARCHFOR'] = "Search online for ";
|
||||
$content['LN_VIEW_SEARCHFORGOOGLE'] = "Search Google for ";
|
||||
$content['LN_GEN_MESSAGEDETAILS'] = "Message Details";
|
||||
|
||||
$content['LN_HIGHLIGHT'] = "Hightlight >>";
|
||||
$content['LN_HIGHLIGHT_OFF'] = "Hightlight <<";
|
||||
|
@ -221,52 +221,49 @@
|
||||
<!-- BEGIN values -->
|
||||
<td align="{FieldAlign}" class="{fieldcssclass}" {fieldbgcolor} valign="middle" {isnowrap}>
|
||||
<!-- IF hasbuttons="true" -->
|
||||
<!-- IF hasdropdownbutton="true" -->
|
||||
<img align="left" src="{MENU_NAV_CLOSE}" width="16" height="16" border="1" title="{LN_GEN_AVAILABLESEARCHES}" OnClick="ToggleDisplayTypeById('menu_{FieldColumn}_{uid}');">
|
||||
<!-- ENDIF hasdropdownbutton="true" -->
|
||||
<div id="menu">
|
||||
<ul>
|
||||
<li>
|
||||
<ul class="with_border" id="menu_{FieldColumn}_{uid}">
|
||||
<li class="cellmenu1" OnMouseMove="ToggleDisplayEnhanceTimeOut('menu_{FieldColumn}_{uid}');">
|
||||
<h2>{LN_GEN_AVAILABLESEARCHES}</h2>
|
||||
<!-- BEGIN buttons -->
|
||||
<li class="{cssclass}" OnMouseMove="ToggleDisplayEnhanceTimeOut('menu_{FieldColumn}_{uid}');">
|
||||
<img align="left" src="{IconSource}" width="16" height="16" vspace="2"><a href="{ButtonUrl}{additional_url_sourceonly}" target="_top">{DisplayName}</a>
|
||||
<div id="menu">
|
||||
<ul>
|
||||
<li>
|
||||
<ul class="with_border" id="menu_{FieldColumn}_{uid}">
|
||||
<li class="cellmenu1" OnMouseMove="ToggleDisplayEnhanceTimeOut('menu_{FieldColumn}_{uid}');">
|
||||
<h2>{LN_GEN_AVAILABLESEARCHES}</h2>
|
||||
<!-- BEGIN buttons -->
|
||||
<li class="{cssclass}" OnMouseMove="ToggleDisplayEnhanceTimeOut('menu_{FieldColumn}_{uid}');">
|
||||
<img align="left" src="{IconSource}" width="16" height="16" vspace="2"><a href="{ButtonUrl}{additional_url_sourceonly}" target="_top">{DisplayName}</a>
|
||||
</li>
|
||||
<!-- END buttons -->
|
||||
</ul>
|
||||
</li>
|
||||
<!-- END buttons -->
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- IF hasdropdownbutton="true" -->
|
||||
<img align="top" src="{MENU_NAV_CLOSE}" width="16" height="16" border="0" title="{LN_GEN_AVAILABLESEARCHES}" OnClick="ToggleDisplayTypeById('menu_{FieldColumn}_{uid}');">
|
||||
<!-- ENDIF hasdropdownbutton="true" -->
|
||||
|
||||
<!-- ENDIF hasbuttons="true" -->
|
||||
|
||||
<!-- IF ismessagefield="true" -->
|
||||
<a href="{detaillink}{additional_url_sourceonly}" class="syslogdetails"><img align="left" src="{MENU_LINK_VIEW}" width="16" height="16" border="1" title="{LN_GEN_AVAILABLESEARCHES}"></a>
|
||||
<a href="{detaillink}{additional_url_sourceonly}" class="syslogdetails"><img align="top" src="{MENU_LINK_VIEW}" width="16" height="16" border="0" title="{LN_GEN_MESSAGEDETAILS}"></a>
|
||||
<!-- ENDIF ismessagefield="true" -->
|
||||
|
||||
<!-- IF hasdetails="false" -->
|
||||
<!-- IF ismessagefield!="true" -->
|
||||
|
||||
<!-- IF hasbuttons="true" -->
|
||||
<a href="#search" OnClick="ToggleDisplayTypeById('menu_{FieldColumn}_{uid}');" class="{fieldcssclass}">
|
||||
{fieldvalue}
|
||||
</a>
|
||||
<a href="#search" OnClick="ToggleDisplayTypeById('menu_{FieldColumn}_{uid}');" class="{fieldcssclass}">{fieldvalue}</a>
|
||||
<!-- ENDIF hasbuttons="true" -->
|
||||
|
||||
<!-- IF hasbuttons!="true" -->
|
||||
<b>{fieldvalue}</b>
|
||||
<!-- ENDIF hasbuttons!="true" -->
|
||||
|
||||
<!-- IF hasbuttons!="true" -->
|
||||
<b>{fieldvalue}</b>
|
||||
<!-- ENDIF hasbuttons!="true" -->
|
||||
<!-- ENDIF ismessagefield!="true" -->
|
||||
|
||||
<!-- IF ismessagefield="true" -->
|
||||
<a href="{detaillink}{additional_url_sourceonly}" class="syslogdetails" target="_top">
|
||||
{fieldvalue}
|
||||
</a>
|
||||
<a href="{detaillink}{additional_url_sourceonly}" class="syslogdetails" target="_top">{fieldvalue}</a>
|
||||
<!-- ENDIF ismessagefield="true" -->
|
||||
|
||||
<!-- ENDIF hasdetails="false" -->
|
||||
|
||||
<!-- IF hasdetails="true" -->
|
||||
<div OnClick="document.location='{detaillink}{additional_url_sourceonly}';" style="cursor:pointer" class="syslogdetails" OnMouseOver="this.className='syslogdetails_popup';" OnMouseOut="this.className='syslogdetails';">{fieldvalue}<br />
|
||||
<span>
|
||||
@ -282,6 +279,7 @@
|
||||
</span>
|
||||
</div>
|
||||
<!-- ENDIF hasdetails="true" -->
|
||||
|
||||
</td>
|
||||
<!-- END values -->
|
||||
|
||||
|
@ -408,3 +408,9 @@ select, input, button, textarea
|
||||
border: 1px solid;
|
||||
border-color: #233B51 #124A7C #124A7C #233B51;
|
||||
}
|
||||
|
||||
.highlighted
|
||||
{
|
||||
font: bold 8pt Arial,Helvetica,sans-serif;
|
||||
color: #CC6600
|
||||
}
|
||||
|
@ -413,3 +413,9 @@ select, input, button, textarea
|
||||
border: 1px solid;
|
||||
border-color: #233B51 #124A7C #124A7C #233B51;
|
||||
}
|
||||
|
||||
.highlighted
|
||||
{
|
||||
font: bold 8pt Arial,Helvetica,sans-serif;
|
||||
color: #BB0000
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user