mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
+5
-5
@@ -48,16 +48,16 @@ function get_cache($host, $value)
|
||||
|
||||
function process_syslog($entry, $update)
|
||||
{
|
||||
global $config, $dev_cache;
|
||||
global $dev_cache;
|
||||
|
||||
foreach ($config['syslog_filter'] as $bi) {
|
||||
foreach (Config::get('syslog_filter') as $bi) {
|
||||
if (strpos($entry['msg'], $bi) !== false) {
|
||||
return $entry;
|
||||
}
|
||||
}
|
||||
|
||||
$entry['host'] = preg_replace("/^::ffff:/", "", $entry['host']);
|
||||
if ($new_host = Config::get("syslog_xlate")[$entry['host']]) {
|
||||
if ($new_host = Config::get("syslog_xlate.{$entry['host']}")) {
|
||||
$entry['host'] = $new_host;
|
||||
}
|
||||
$entry['device_id'] = get_cache($entry['host'], 'device_id');
|
||||
@@ -65,8 +65,8 @@ function process_syslog($entry, $update)
|
||||
$os = get_cache($entry['host'], 'os');
|
||||
$hostname = get_cache($entry['host'], 'hostname');
|
||||
|
||||
if ((isset($config['enable_syslog_hooks'])) && ($config['enable_syslog_hooks']) && (isset($config['os'][$os]['syslog_hook'])) && (is_array($config['os'][$os]['syslog_hook']))) {
|
||||
foreach ($config['os'][$os]['syslog_hook'] as $k => $v) {
|
||||
if (Config::get('enable_syslog_hooks') && is_array(Config::getOsSetting($os, 'syslog_hook'))) {
|
||||
foreach (Config::getOsSetting($os, 'syslog_hook') as $k => $v) {
|
||||
$syslogprogmsg = $entry['program'].": ".$entry['msg'];
|
||||
if ((isset($v['script'])) && (isset($v['regex'])) && ((preg_match($v['regex'], $syslogprogmsg)))) {
|
||||
shell_exec(escapeshellcmd($v['script']).' '.escapeshellarg($hostname).' '.escapeshellarg($os).' '.escapeshellarg($syslogprogmsg).' >/dev/null 2>&1 &');
|
||||
|
||||
Reference in New Issue
Block a user