From 23c29c48f395f8456fe30a50a3628f8776219472 Mon Sep 17 00:00:00 2001 From: Sean Mancini Date: Sun, 20 Sep 2026 23:45:33 -0400 Subject: [PATCH] fix: align Alert Logs table with System Logs and share Kiwi row tints - Alert Logs column order now matches the System Logs tab: date, device, severity, alert name, message, count, facility, priority - Alert rows reuse the syslog Kiwi pastel tint classes (logInfo/ logWarning/logAlert) so both tables share one color scheme; the hard-coded syslogAlertRow border rule is removed and the legend updated - Alert log CSV export reordered to match the new table order --- css/search.css | 1 - functions.php | 29 +++++++++++++++-------------- syslog.php | 24 +++++++++++------------- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/css/search.css b/css/search.css index 9043325..31f42fd 100644 --- a/css/search.css +++ b/css/search.css @@ -609,7 +609,6 @@ #syslog_workspace tr.syslogRow.logNotice td:first-child { border-left-color: #3478b5; } #syslog_workspace tr.syslogRow.logInfo td:first-child { border-left-color: #5b9b4b; } #syslog_workspace tr.syslogRow.logDebug td:first-child { border-left-color: #8b9690; } -#syslog_workspace tr.syslogAlertRow td:first-child { border-left: 4px solid #c0392b; } #syslog_workspace:is([data-theme='dark'], [data-theme='midwinter']) tr.syslogRow { --syslog-tint-even: #2b3530; --syslog-tint-hover: #34443a; } #syslog_workspace:is([data-theme='dark'], [data-theme='midwinter']) tr.syslogRow.logEmergency { --syslog-tint: #5c2626; --syslog-tint-even: #552424; --syslog-tint-hover: #663030; } #syslog_workspace:is([data-theme='dark'], [data-theme='midwinter']) tr.syslogRow.logAlert { --syslog-tint: #57302a; --syslog-tint-even: #502c27; --syslog-tint-hover: #613832; } diff --git a/functions.php b/functions.php index 29afdec..fe869cb 100644 --- a/functions.php +++ b/functions.php @@ -2526,15 +2526,16 @@ function syslog_remove_items($table, $max_seq) { } /** - * function syslog_log_row_color() - * This function set's the CSS for each row of the syslog table as it is displayed - * it supports both the legacy as well as the new approach to controlling these - * colors. + * Sets the CSS class for each alert log row of the syslog table as it is + * displayed. The classes reuse the same Kiwi-style pastel tints that the + * main syslog table applies per priority, so both tables share one look. * - * @param mixed $severity - * @param mixed $tip_title + * @param mixed $severity The alert severity of the row. + * @param mixed $tip_title The row tooltip title (unused, kept for compatibility). + * + * @return void */ -function syslog_log_row_color($severity, $tip_title) { +function syslog_log_row_color($severity, $tip_title): void { switch($severity) { case '': case '0': @@ -2551,7 +2552,7 @@ function syslog_log_row_color($severity, $tip_title) { break; } - print "\n"; + print "\n"; } /** @@ -2804,7 +2805,7 @@ function syslog_export($tab) { $sql_where = ''; $messages = get_syslog_messages($sql_where, 100000, $tab); - $line = ['name', 'severity', 'date', 'message', 'host', 'facility', 'priority', 'count']; + $line = ['date', 'device', 'severity', 'alertname', 'message', 'count', 'facility', 'priority']; $fp = fopen('php://output', 'w'); @@ -2819,14 +2820,14 @@ function syslog_export($tab) { } $line = [ - syslog_csv_safe($message['name']), - syslog_csv_safe($severity), $message['logtime'], - syslog_csv_safe($message['logmsg']), syslog_csv_safe($message['host']), + syslog_csv_safe($severity), + syslog_csv_safe($message['name']), + syslog_csv_safe($message['logmsg']), + $message['count'], syslog_csv_safe(ucfirst($message['facility'])), - syslog_csv_safe(ucfirst($message['priority'])), - $message['count'] + syslog_csv_safe(ucfirst($message['priority'])) ]; fputcsv($fp, $line, ',', '"', ''); diff --git a/syslog.php b/syslog.php index 52196bb..3c551ac 100644 --- a/syslog.php +++ b/syslog.php @@ -1583,9 +1583,8 @@ function syslog_log_legend() { html_start_box('', '100%', '', '3', 'center', ''); print ''; - print "" . __('Critical', 'syslog') . ''; + print "" . __('Alert', 'syslog') . ''; print "" . __('Warning', 'syslog') . ''; - print "" . __('Notice', 'syslog') . ''; print "" . __('Informational', 'syslog') . ''; print ''; html_end_box(false); @@ -1825,14 +1824,14 @@ function syslog_messages($tab = 'syslog') { ['display' => __('Alert Name', 'syslog'), 'sort' => 'ASC', 'align' => 'left'], - 'severity' => ['display' => __('Severity', 'syslog'), 'sort' => 'ASC', 'align' => 'left'], 'logtime' => ['display' => __('Date', 'syslog'), 'sort' => 'ASC', 'align' => 'left'], + 'host' => ['display' => __('Device', 'syslog'), 'sort' => 'ASC', 'align' => 'left'], + 'severity' => ['display' => __('Severity', 'syslog'), 'sort' => 'ASC', 'align' => 'left'], + 'name' => ['display' => __('Alert Name', 'syslog'), 'sort' => 'ASC', 'align' => 'left'], 'logmsg' => ['display' => __('Message', 'syslog'), 'sort' => 'ASC', 'align' => 'left'], 'count' => ['display' => __('Count', 'syslog'), 'sort' => 'ASC', 'align' => 'right'], - 'host' => ['display' => __('Device', 'syslog'), 'sort' => 'ASC', 'align' => 'right'], - 'facility_id' => ['display' => __('Facility', 'syslog'), 'sort' => 'ASC', 'align' => 'right'], - 'priority_id' => ['display' => __('Priority', 'syslog'), 'sort' => 'ASC', 'align' => 'right'] + 'facility_id' => ['display' => __('Facility', 'syslog'), 'sort' => 'ASC', 'align' => 'left'], + 'priority_id' => ['display' => __('Priority', 'syslog'), 'sort' => 'ASC', 'align' => 'left'] ]; $nav = html_nav_bar("syslog.php?tab=$tab", MAX_DISPLAY_PAGES, get_request_var_request('page'), $rows, $total_rows, cacti_sizeof($display_text), __('Alert Log Rows', 'syslog'), 'page', 'main'); @@ -1849,16 +1848,15 @@ function syslog_messages($tab = 'syslog') { syslog_log_row_color($log['severity'], $title); - form_selectable_cell(filter_value($log['name'] != '' ? $log['name'] : __('Alert Removed', 'syslog'), get_request_var('rfilter'), $config['url_path'] . 'plugins/syslog/syslog.php?id=' . $log['seq'] . '&tab=current'), $log['seq'], '', 'left'); - - form_selectable_cell(isset($severities[$log['severity']]) ? $severities[$log['severity']] : __('Unknown', 'syslog'), $log['seq'], '', 'left'); form_selectable_cell($log['logtime'], $log['seq'], '', 'left'); + print "" . syslog_value_filter_button($log['host'], 'host') . ''; + form_selectable_cell(isset($severities[$log['severity']]) ? $severities[$log['severity']] : __('Unknown', 'syslog'), $log['seq'], '', 'left'); + form_selectable_cell(filter_value($log['name'] != '' ? $log['name'] : __('Alert Removed', 'syslog'), get_request_var('rfilter'), $config['url_path'] . 'plugins/syslog/syslog.php?id=' . $log['seq'] . '&tab=current'), $log['seq'], '', 'left'); form_selectable_cell(syslog_message_button($log['logmsg'], $log['host'], $log['program'] ?? '', $log['facility'], $log['priority'], $log['logtime']), $log['seq'], '', 'syslogMessage left'); form_selectable_cell($log['count'], $log['seq'], '', 'right'); - print "" . syslog_value_filter_button($log['host'], 'host') . ''; - form_selectable_cell(ucfirst($log['facility']), $log['seq'], '', 'right'); - print "" . syslog_value_filter_button(ucfirst($log['priority']), 'priority') . ''; + form_selectable_cell(ucfirst($log['facility']), $log['seq'], '', 'left'); + print "" . syslog_value_filter_button(ucfirst($log['priority']), 'priority') . ''; form_end_row(); }