Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@

--- develop ---

* issue#199: Duplicate Partition name errors
* issue#250: Fix date filter persistence by validating before shift_span detection
* issue#252: hardening: escape device hostname output in syslog view; parameterize alert API functions
* issue#256: hardening: prevent CSV formula injection and malformed CSV output in exports
* issue#258: Execute CREATE TABLE SQL correctly during replication sync
* issue#260: hardening: replace eval-based callback execution in syslog autocomplete JS
* issue#278: Extract duplicated alert command execution paths in syslog_process_alerts
* issue#278: Extract alert command execution into shared helper in functions.php; command tokenization now uses preg_split (handles tabs and consecutive spaces); /bin/sh fallback for non-executable command templates removed (use absolute paths with execute bit set)
* issue#298: syslog poller: lock timeout, signal handler, and earlier partition rotation
* issue#300: Syslog table drop with no apparent reason
* issue: Making changes to support Cacti 1.3
* issue: Don't use MyISAM for non-analytical tables
* issue: The install advisor for Syslog was broken in current Cacti releases
Expand Down
5 changes: 4 additions & 1 deletion setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ function syslog_setup_table_new($options) {
$present = syslog_db_fetch_row("SHOW TABLES FROM `$syslogdb_default` LIKE 'syslog_reports'");

if (cacti_sizeof($present)) {
$newreport = sizeof(syslog_db_fetch_row("SHOW COLUMNS FROM `$syslogdb_default`.`syslog_reports` LIKE 'body'"));
$newreport = syslog_db_column_exists('syslog_reports', 'body');
} else {
$newreport = true;
}
Expand Down Expand Up @@ -784,6 +784,9 @@ function syslog_setup_table_new($options) {
set_config_option($name, $values['default']);
}
}

// ensure that the setting if set previously to truncate is switched to upgrade
set_config_option('syslog_install_upgrade_type', 'upgrade');
Comment thread
TheWitness marked this conversation as resolved.
}

function syslog_replicate_out($data) {
Expand Down
41 changes: 41 additions & 0 deletions syslog_process.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
+-------------------------------------------------------------------------+
*/

if (function_exists('pcntl_async_signals')) {
pcntl_async_signals(true);
} else {
declare(ticks = 100);
}
Comment thread
TheWitness marked this conversation as resolved.

include(__DIR__ . '/../../include/cli_check.php');
include_once(__DIR__ . '/functions.php');
include_once(__DIR__ . '/database.php');
Expand All @@ -32,9 +38,13 @@
* Let it run for an hour if it has to, to clear up any big
* bursts of incoming syslog events
*/
ini_set('output_buffering', 'Off');
ini_set('max_execution_time', 3600);
ini_set('memory_limit', '-1');

set_time_limit(3600);
ob_implicit_flush();

global $debug, $syslog_facilities, $syslog_levels;

$debug = false;
Expand Down Expand Up @@ -82,6 +92,12 @@
}
}

// install signal handlers for UNIX only
if (function_exists('pcntl_signal')) {
pcntl_signal(SIGTERM, 'sig_handler');
pcntl_signal(SIGINT, 'sig_handler');
}

// record the start time
$start_time = microtime(true);

Expand Down Expand Up @@ -242,6 +258,31 @@

exit(0);

/**
* sig_handler - handles UNIX signals and logs shutdown events to the Cacti log.
*
* @param int $signo The signal received by the process.
*
* @return (void)
*/
function sig_handler($signo) {
global $config;

switch ($signo) {
case SIGTERM:
case SIGINT:
cacti_log("WARNING: Syslog 'master' is shutting down by signal!", false, 'SYSLOG');

unregister_process('syslog', 'master', $config['poller_id']);

exit(1);

break;
default:
// ignore all other signals
}
}

/**
* display_version - displays version information
*
Expand Down
Loading