void sig_handler_logrotate(int signo)
{
if(signo) {
- error_log_limit_reset();
+ error_log_limit_unlimited();
info("Received signal %d to re-open the log files", signo);
reopen_all_log_files();
+ error_log_limit_reset();
}
}
void sig_handler_save(int signo)
{
if(signo) {
- error_log_limit_reset();
+ error_log_limit_unlimited();
info("Received signal %d to save the database...", signo);
rrdset_save_all();
+ error_log_limit_reset();
}
}
void sig_handler_reload_health(int signo)
{
if(signo) {
- error_log_limit_reset();
+ error_log_limit_unlimited();
info("Received signal %d to reload health configuration...", signo);
health_reload();
+ error_log_limit_reset();
}
}
// ----------------------------------------------------------------------------
// error log throttling
+time_t error_log_throttle_period_backup = 0;
time_t error_log_throttle_period = 1200;
unsigned long error_log_errors_per_period = 200;
extern int error_log_syslog;
extern int output_log_syslog;
-extern time_t error_log_throttle_period;
+extern time_t error_log_throttle_period, error_log_throttle_period_backup;
extern unsigned long error_log_errors_per_period;
extern int error_log_limit(int reset);
extern void open_all_log_files();
extern void reopen_all_log_files();
-#define error_log_limit_reset() do { error_log_limit(1); } while(0)
+#define error_log_limit_reset() do { error_log_throttle_period = error_log_throttle_period_backup; error_log_limit(1); } while(0)
#define error_log_limit_unlimited() do { error_log_throttle_period = 0; } while(0)
#define debug(type, args...) do { if(unlikely(debug_flags & type)) debug_int(__FILE__, __FUNCTION__, __LINE__, ##args); } while(0)
stderr_filename = config_get("global", "error log", LOG_DIR "/error.log");
stdaccess_filename = config_get("global", "access log", LOG_DIR "/access.log");
- error_log_throttle_period = config_get_number("global", "errors flood protection period", error_log_throttle_period);
+ error_log_throttle_period_backup =
+ error_log_throttle_period = config_get_number("global", "errors flood protection period", error_log_throttle_period);
setenv("NETDATA_ERRORS_THROTTLE_PERIOD", config_get("global", "errors flood protection period" , ""), 1);
error_log_errors_per_period = (unsigned long)config_get_number("global", "errors to trigger flood protection", error_log_errors_per_period);
error_log_throttle_period = 0;
error_log_errors_per_period = 0;
}
+ error_log_limit_unlimited();
// --------------------------------------------------------------------
if(check_config)
exit(1);
+ // ------------------------------------------------------------------------
+ // enable log flood protection
+
+ error_log_limit_reset();
+
// ------------------------------------------------------------------------
// spawn the threads