logchange is now always enabled, with 1 second threshold by default.
@c {{{ logchange
@node logchange directive
@subsection logchange
-This directive forces @code{chronyd} to send a message to syslog if it
-makes a system clock adjustment larger than a threshold value. An
-example of use is
+This directive sets the threshold for the adjustment of the system clock
+that will generate a syslog message.
+
+By default, the threshold is 1 second.
+
+An example of use is
@example
-logchange 0.5
+logchange 0.1
@end example
which would cause a syslog message to be generated a system clock error
-of over 0.5 seconds starts to be compensated.
+of over 0.1 seconds starts to be compensated.
-Clock errors detected either via NTP packets or via timestamps entered
+Clock errors detected via NTP packets, reference clocks, or timestamps entered
via the @code{settime} command of @code{chronyc} are logged.
-
-This directive assumes that syslog messages are appearing where somebody
-can see them. This allows that person to see if a large error has
-arisen, e.g. because of a fault, or because of faulty timezone handling,
-for example when summer time (daylight saving) starts or ends.
@c }}}
@c {{{ logdir
@node logdir directive
static int max_samples = 0; /* no limit */
static int min_samples = 0;
-/* Flag set if we should log to syslog when a time adjustment
- exceeding the threshold is initiated */
-static int do_log_change = 0;
-static double log_change_threshold = 0.0;
+/* Threshold for a time adjustment to be logged to syslog */
+static double log_change_threshold = 1.0;
static char *mail_user_on_change = NULL;
static double mail_change_threshold = 0.0;
} else if (!strcasecmp(command, "logbanner")) {
parse_int(p, &log_banner);
} else if (!strcasecmp(command, "logchange")) {
- do_log_change = parse_double(p, &log_change_threshold);
+ parse_double(p, &log_change_threshold);
} else if (!strcasecmp(command, "logdir")) {
parse_string(p, &logdir);
} else if (!strcasecmp(command, "mailonchange")) {
/* ================================================== */
-void
-CNF_GetLogChange(int *enabled, double *threshold)
+double
+CNF_GetLogChange(void)
{
- *enabled = do_log_change;
- *threshold = log_change_threshold;
+ return log_change_threshold;
}
/* ================================================== */
extern int CNF_GetRtcSync(void);
extern void CNF_GetMakeStep(int *limit, double *threshold);
extern void CNF_GetMaxChange(int *delay, int *ignore, double *offset);
-extern void CNF_GetLogChange(int *enabled, double *threshold);
+extern double CNF_GetLogChange(void);
extern void CNF_GetMailOnChange(int *enabled, double *threshold, char **user);
extern int CNF_GetNoClientLog(void);
extern unsigned long CNF_GetClientLogLimit(void);
static int max_offset_ignore;
static double max_offset;
-/* Flag and threshold for logging clock changes to syslog */
-static int do_log_change;
+/* Threshold for logging clock changes to syslog */
static double log_change_threshold;
/* Flag, threshold and user for sending mail notification on large clock changes */
CNF_GetMakeStep(&make_step_limit, &make_step_threshold);
CNF_GetMaxChange(&max_offset_delay, &max_offset_ignore, &max_offset);
- CNF_GetLogChange(&do_log_change, &log_change_threshold);
CNF_GetMailOnChange(&do_mail_change, &mail_change_threshold, &mail_change_user);
+ log_change_threshold = CNF_GetLogChange();
CNF_GetFallbackDrifts(&fb_drift_min, &fb_drift_max);
LCL_AddParameterChangeHandler(handle_slew, NULL);
- /* And just to prevent anything wierd ... */
- if (do_log_change) {
- log_change_threshold = fabs(log_change_threshold);
- }
-
/* Make first entry in tracking log */
REF_SetUnsynchronised();
}
abs_offset = fabs(offset);
- if (do_log_change &&
- (abs_offset > log_change_threshold)) {
+ if (abs_offset > log_change_threshold) {
LOG(LOGS_WARN, LOGF_Reference,
"System clock wrong by %.6f seconds, adjustment started",
-offset);