conf: add rawmeasurements log option
While the measurements log can be useful for debugging problems in NTP configuration (e.g. authentication failures with symmetric keys), it seems most users are interested only in valid measurements (e.g. for producing graphs) and don't expect/handle entries where some of the RFC 5905 tests 1-7 failed. Modify the measurements log option to log only valid measurements, and for debugging purposes add a new rawmeasurements option.
This commit is contained in:
parent
e225ac68bc
commit
0a0aff14d8
4 changed files with 22 additions and 8 deletions
9
conf.c
9
conf.c
|
@ -97,6 +97,7 @@ static double combine_limit = 3.0;
|
|||
|
||||
static int cmd_port = DEFAULT_CANDM_PORT;
|
||||
|
||||
static int raw_measurements = 0;
|
||||
static int do_log_measurements = 0;
|
||||
static int do_log_statistics = 0;
|
||||
static int do_log_tracking = 0;
|
||||
|
@ -814,7 +815,10 @@ parse_log(char *line)
|
|||
log_name = line;
|
||||
line = CPS_SplitWord(line);
|
||||
if (*log_name) {
|
||||
if (!strcmp(log_name, "measurements")) {
|
||||
if (!strcmp(log_name, "rawmeasurements")) {
|
||||
do_log_measurements = 1;
|
||||
raw_measurements = 1;
|
||||
} else if (!strcmp(log_name, "measurements")) {
|
||||
do_log_measurements = 1;
|
||||
} else if (!strcmp(log_name, "statistics")) {
|
||||
do_log_statistics = 1;
|
||||
|
@ -1468,8 +1472,9 @@ CNF_GetDumpDir(void)
|
|||
/* ================================================== */
|
||||
|
||||
int
|
||||
CNF_GetLogMeasurements(void)
|
||||
CNF_GetLogMeasurements(int *raw)
|
||||
{
|
||||
*raw = raw_measurements;
|
||||
return do_log_measurements;
|
||||
}
|
||||
|
||||
|
|
2
conf.h
2
conf.h
|
@ -52,7 +52,7 @@ extern char *CNF_GetDriftFile(void);
|
|||
extern char *CNF_GetLogDir(void);
|
||||
extern char *CNF_GetDumpDir(void);
|
||||
extern int CNF_GetLogBanner(void);
|
||||
extern int CNF_GetLogMeasurements(void);
|
||||
extern int CNF_GetLogMeasurements(int *raw);
|
||||
extern int CNF_GetLogStatistics(void);
|
||||
extern int CNF_GetLogTracking(void);
|
||||
extern int CNF_GetLogRtc(void);
|
||||
|
|
|
@ -1518,10 +1518,12 @@ The log files are written to the directory specified by the <<logdir,*logdir*>>
|
|||
directive. A banner is periodically written to the files to indicate the
|
||||
meanings of the columns.
|
||||
+
|
||||
*measurements*:::
|
||||
*rawmeasurements*:::
|
||||
This option logs the raw NTP measurements and related information to a file
|
||||
called _measurements.log_. An example line (which actually appears as a single
|
||||
line in the file) from the log file is shown below.
|
||||
called _measurements.log_. An entry is made for each packet received from the
|
||||
source. This can be useful when debugging a problem. An example line (which
|
||||
actually appears as a single line in the file) from the log file is shown
|
||||
below.
|
||||
+
|
||||
----
|
||||
2016-11-09 05:40:50 203.0.113.15 N 2 111 111 1111 10 10 1.0 \
|
||||
|
@ -1563,6 +1565,12 @@ from the example line above):
|
|||
. Source of the local receive timestamp
|
||||
(_D_=daemon, _K_=kernel, _H_=hardware). [K]
|
||||
+
|
||||
*measurements*:::
|
||||
This option is identical to the *rawmeasurements* option, except it logs only
|
||||
valid measurements from synchronised sources, i.e. measurements which passed
|
||||
the RFC 5905 tests 1 through 7. This can be useful for producing graphs of the
|
||||
source's performance.
|
||||
+
|
||||
*statistics*:::
|
||||
This option logs information about the regression processing to a file called
|
||||
_statistics.log_. An example line (which actually appears as a single line in
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
/* ================================================== */
|
||||
|
||||
static LOG_FileID logfileid;
|
||||
static int log_raw_measurements;
|
||||
|
||||
/* ================================================== */
|
||||
/* Enumeration used for remembering the operating mode of one of the
|
||||
|
@ -353,7 +354,7 @@ NCR_Initialise(void)
|
|||
do_size_checks();
|
||||
do_time_checks();
|
||||
|
||||
logfileid = CNF_GetLogMeasurements() ? LOG_FileOpen("measurements",
|
||||
logfileid = CNF_GetLogMeasurements(&log_raw_measurements) ? LOG_FileOpen("measurements",
|
||||
" Date (UTC) Time IP Address L St 123 567 ABCD LP RP Score Offset Peer del. Peer disp. Root del. Root disp. Refid MTxRx")
|
||||
: -1;
|
||||
|
||||
|
@ -1687,7 +1688,7 @@ receive_packet(NCR_Instance inst, NTP_Local_Address *local_addr,
|
|||
}
|
||||
|
||||
/* Do measurement logging */
|
||||
if (logfileid != -1) {
|
||||
if (logfileid != -1 && (log_raw_measurements || synced_packet)) {
|
||||
LOG_FileWrite(logfileid, "%s %-15s %1c %2d %1d%1d%1d %1d%1d%1d %1d%1d%1d%d %2d %2d %4.2f %10.3e %10.3e %10.3e %10.3e %10.3e %08"PRIX32" %1d%1c %1c %1c",
|
||||
UTI_TimeToLogForm(sample_time.tv_sec),
|
||||
UTI_IPToString(&inst->remote_addr.ip_addr),
|
||||
|
|
Loading…
Reference in a new issue