conf: set logchange to 1 second by default
logchange is now always enabled, with 1 second threshold by default.
This commit is contained in:
parent
e0ae2b4bb5
commit
8549043a3f
4 changed files with 19 additions and 31 deletions
|
@ -2251,24 +2251,22 @@ used to disable it entirely.
|
||||||
@c {{{ logchange
|
@c {{{ logchange
|
||||||
@node logchange directive
|
@node logchange directive
|
||||||
@subsection logchange
|
@subsection logchange
|
||||||
This directive forces @code{chronyd} to send a message to syslog if it
|
This directive sets the threshold for the adjustment of the system clock
|
||||||
makes a system clock adjustment larger than a threshold value. An
|
that will generate a syslog message.
|
||||||
example of use is
|
|
||||||
|
By default, the threshold is 1 second.
|
||||||
|
|
||||||
|
An example of use is
|
||||||
|
|
||||||
@example
|
@example
|
||||||
logchange 0.5
|
logchange 0.1
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
which would cause a syslog message to be generated a system clock error
|
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.
|
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 }}}
|
||||||
@c {{{ logdir
|
@c {{{ logdir
|
||||||
@node logdir directive
|
@node logdir directive
|
||||||
|
|
15
conf.c
15
conf.c
|
@ -146,10 +146,8 @@ static double max_offset;
|
||||||
static int max_samples = 0; /* no limit */
|
static int max_samples = 0; /* no limit */
|
||||||
static int min_samples = 0;
|
static int min_samples = 0;
|
||||||
|
|
||||||
/* Flag set if we should log to syslog when a time adjustment
|
/* Threshold for a time adjustment to be logged to syslog */
|
||||||
exceeding the threshold is initiated */
|
static double log_change_threshold = 1.0;
|
||||||
static int do_log_change = 0;
|
|
||||||
static double log_change_threshold = 0.0;
|
|
||||||
|
|
||||||
static char *mail_user_on_change = NULL;
|
static char *mail_user_on_change = NULL;
|
||||||
static double mail_change_threshold = 0.0;
|
static double mail_change_threshold = 0.0;
|
||||||
|
@ -476,7 +474,7 @@ CNF_ParseLine(const char *filename, int number, char *line)
|
||||||
} else if (!strcasecmp(command, "logbanner")) {
|
} else if (!strcasecmp(command, "logbanner")) {
|
||||||
parse_int(p, &log_banner);
|
parse_int(p, &log_banner);
|
||||||
} else if (!strcasecmp(command, "logchange")) {
|
} 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")) {
|
} else if (!strcasecmp(command, "logdir")) {
|
||||||
parse_string(p, &logdir);
|
parse_string(p, &logdir);
|
||||||
} else if (!strcasecmp(command, "mailonchange")) {
|
} else if (!strcasecmp(command, "mailonchange")) {
|
||||||
|
@ -1607,11 +1605,10 @@ CNF_GetMaxChange(int *delay, int *ignore, double *offset)
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
||||||
void
|
double
|
||||||
CNF_GetLogChange(int *enabled, double *threshold)
|
CNF_GetLogChange(void)
|
||||||
{
|
{
|
||||||
*enabled = do_log_change;
|
return log_change_threshold;
|
||||||
*threshold = log_change_threshold;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
2
conf.h
2
conf.h
|
@ -67,7 +67,7 @@ extern int CNF_GetRtcOnUtc(void);
|
||||||
extern int CNF_GetRtcSync(void);
|
extern int CNF_GetRtcSync(void);
|
||||||
extern void CNF_GetMakeStep(int *limit, double *threshold);
|
extern void CNF_GetMakeStep(int *limit, double *threshold);
|
||||||
extern void CNF_GetMaxChange(int *delay, int *ignore, double *offset);
|
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 void CNF_GetMailOnChange(int *enabled, double *threshold, char **user);
|
||||||
extern int CNF_GetNoClientLog(void);
|
extern int CNF_GetNoClientLog(void);
|
||||||
extern unsigned long CNF_GetClientLogLimit(void);
|
extern unsigned long CNF_GetClientLogLimit(void);
|
||||||
|
|
13
reference.c
13
reference.c
|
@ -80,8 +80,7 @@ static int max_offset_delay;
|
||||||
static int max_offset_ignore;
|
static int max_offset_ignore;
|
||||||
static double max_offset;
|
static double max_offset;
|
||||||
|
|
||||||
/* Flag and threshold for logging clock changes to syslog */
|
/* Threshold for logging clock changes to syslog */
|
||||||
static int do_log_change;
|
|
||||||
static double log_change_threshold;
|
static double log_change_threshold;
|
||||||
|
|
||||||
/* Flag, threshold and user for sending mail notification on large clock changes */
|
/* Flag, threshold and user for sending mail notification on large clock changes */
|
||||||
|
@ -254,8 +253,8 @@ REF_Initialise(void)
|
||||||
|
|
||||||
CNF_GetMakeStep(&make_step_limit, &make_step_threshold);
|
CNF_GetMakeStep(&make_step_limit, &make_step_threshold);
|
||||||
CNF_GetMaxChange(&max_offset_delay, &max_offset_ignore, &max_offset);
|
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);
|
CNF_GetMailOnChange(&do_mail_change, &mail_change_threshold, &mail_change_user);
|
||||||
|
log_change_threshold = CNF_GetLogChange();
|
||||||
|
|
||||||
CNF_GetFallbackDrifts(&fb_drift_min, &fb_drift_max);
|
CNF_GetFallbackDrifts(&fb_drift_min, &fb_drift_max);
|
||||||
|
|
||||||
|
@ -272,11 +271,6 @@ REF_Initialise(void)
|
||||||
|
|
||||||
LCL_AddParameterChangeHandler(handle_slew, NULL);
|
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 */
|
/* Make first entry in tracking log */
|
||||||
REF_SetUnsynchronised();
|
REF_SetUnsynchronised();
|
||||||
}
|
}
|
||||||
|
@ -536,8 +530,7 @@ maybe_log_offset(double offset, time_t now)
|
||||||
|
|
||||||
abs_offset = fabs(offset);
|
abs_offset = fabs(offset);
|
||||||
|
|
||||||
if (do_log_change &&
|
if (abs_offset > log_change_threshold) {
|
||||||
(abs_offset > log_change_threshold)) {
|
|
||||||
LOG(LOGS_WARN, LOGF_Reference,
|
LOG(LOGS_WARN, LOGF_Reference,
|
||||||
"System clock wrong by %.6f seconds, adjustment started",
|
"System clock wrong by %.6f seconds, adjustment started",
|
||||||
-offset);
|
-offset);
|
||||||
|
|
Loading…
Reference in a new issue