Skip to content

Commit fd2563b

Browse files
committed
Fixing Issue #110
Syslog Alerts cause DB errors
1 parent f0ae274 commit fd2563b

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ that.
164164

165165
* issue#109: Should merge CVE-2020-7106 solution to syslog plugin
166166

167+
* issue#110: Syslog Alerts cause DB errors
168+
167169
* issue: Massive performance improvement in statistics page rendering
168170

169171
--- 2.5 ---

functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ function syslog_log_alert($alert_id, $alert_name, $severity, $msg, $count = 1, $
730730
$save['seq'] = '';
731731
$save['alert_id'] = $alert_id;
732732
$save['logseq'] = $msg['seq'];
733-
$save['logtime'] = $msg['date'] . ' ' . $msg['time'];
733+
$save['logtime'] = $msg['logtime'];
734734
$save['logmsg'] = db_qstr($msg['message']);
735735
$save['host'] = $msg['host'];
736736
$save['facility_id'] = $msg['facility_id'];

syslog_process.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,14 +388,14 @@
388388
if ($alert['method'] == 0) $alertm = $alerth;
389389
$alertm .= "-----------------------------------------------\n";
390390
$alertm .= __('Hostname:', 'syslog') . ' ' . html_escape($a['host']) . "\n";
391-
$alertm .= __('Date:', 'syslog') . ' ' . $a['date'] . ' ' . $a['time'] . "\n";
391+
$alertm .= __('Date:', 'syslog') . ' ' . $a['logtime'] . "\n";
392392
$alertm .= __('Severity:', 'syslog') . ' ' . $severities[$alert['severity']] . "\n\n";
393393
$alertm .= __('Level:', 'syslog') . ' ' . $syslog_levels[$a['priority_id']] . "\n\n";
394394
$alertm .= __('Message:', 'syslog') . ' ' . "\n" . html_escape($a['message']) . "\n";
395395

396396
if ($alert['method'] == 0) $htmlm = $htmlh;
397397
$htmlm .= '<tr><td>' . $a['host'] . '</td>';
398-
$htmlm .= '<td>' . $a['date'] . ' ' . $a['time'] . '</td>';
398+
$htmlm .= '<td>' . $a['logtime'] . '</td>';
399399
$htmlm .= '<td>' . $severities[$alert['severity']] . '</td>';
400400
$htmlm .= '<td>' . $syslog_levels[$a['priority_id']] . '</td>';
401401
$htmlm .= '<td>' . html_escape($a['message']) . '</td></tr>';
@@ -410,8 +410,8 @@
410410
$ignore = syslog_db_fetch_cell('SELECT count(*)
411411
FROM syslog_logs
412412
WHERE alert_id=' . $alert['id'] . "
413-
AND logtime>'$date'
414-
AND host='" . $a['host'] . "'");
413+
AND logtime > '$date'
414+
AND host = " . db_qstr($a['host']));
415415
}
416416

417417
if (!$ignore) {

0 commit comments

Comments
 (0)