mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-27 12:13:20 -04:00
Merge branch '2360-dnstap-timestamp-millis-oliverford' into 'main'
Add option to dnstap-read to print long timestamps Closes #2360 See merge request isc-projects/bind9!7887
This commit is contained in:
commit
af5d0a0afb
4 changed files with 25 additions and 4 deletions
3
CHANGES
3
CHANGES
|
|
@ -1,3 +1,6 @@
|
|||
6163. [func] Add option to dnstap-read to use timestamps in
|
||||
milliseconds (thanks to Oliver Ford). [GL #2360]
|
||||
|
||||
6162. [placeholder]
|
||||
|
||||
6161. [bug] Fix log file rotation when using absolute path as
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ bool memrecord = false;
|
|||
bool printmessage = false;
|
||||
bool hexmessage = false;
|
||||
bool yaml = false;
|
||||
bool timestampmillis = false;
|
||||
|
||||
const char *program = "dnstap-read";
|
||||
|
||||
|
|
@ -90,6 +91,8 @@ usage(void) {
|
|||
fprintf(stderr, "dnstap-read [-mpxy] [filename]\n");
|
||||
fprintf(stderr, "\t-m\ttrace memory allocations\n");
|
||||
fprintf(stderr, "\t-p\tprint the full DNS message\n");
|
||||
fprintf(stderr,
|
||||
"\t-t\tprint long timestamps with millisecond precision\n");
|
||||
fprintf(stderr, "\t-x\tuse hex format to print DNS message\n");
|
||||
fprintf(stderr, "\t-y\tprint YAML format (implies -p)\n");
|
||||
}
|
||||
|
|
@ -231,13 +234,21 @@ print_yaml(dns_dtdata_t *dt) {
|
|||
|
||||
if (!isc_time_isepoch(&dt->qtime)) {
|
||||
char buf[100];
|
||||
isc_time_formatISO8601(&dt->qtime, buf, sizeof(buf));
|
||||
if (timestampmillis) {
|
||||
isc_time_formatISO8601ms(&dt->qtime, buf, sizeof(buf));
|
||||
} else {
|
||||
isc_time_formatISO8601(&dt->qtime, buf, sizeof(buf));
|
||||
}
|
||||
printf(" query_time: !!timestamp %s\n", buf);
|
||||
}
|
||||
|
||||
if (!isc_time_isepoch(&dt->rtime)) {
|
||||
char buf[100];
|
||||
isc_time_formatISO8601(&dt->rtime, buf, sizeof(buf));
|
||||
if (timestampmillis) {
|
||||
isc_time_formatISO8601ms(&dt->rtime, buf, sizeof(buf));
|
||||
} else {
|
||||
isc_time_formatISO8601(&dt->rtime, buf, sizeof(buf));
|
||||
}
|
||||
printf(" response_time: !!timestamp %s\n", buf);
|
||||
}
|
||||
|
||||
|
|
@ -330,7 +341,7 @@ main(int argc, char *argv[]) {
|
|||
dns_dthandle_t *handle = NULL;
|
||||
int rv = 0, ch;
|
||||
|
||||
while ((ch = isc_commandline_parse(argc, argv, "mpxy")) != -1) {
|
||||
while ((ch = isc_commandline_parse(argc, argv, "mptxy")) != -1) {
|
||||
switch (ch) {
|
||||
case 'm':
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
|
||||
|
|
@ -339,6 +350,9 @@ main(int argc, char *argv[]) {
|
|||
case 'p':
|
||||
printmessage = true;
|
||||
break;
|
||||
case 't':
|
||||
timestampmillis = true;
|
||||
break;
|
||||
case 'x':
|
||||
hexmessage = true;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@ Options
|
|||
This option prints the text form of the DNS
|
||||
message that was encapsulated in the ``dnstap`` frame, after printing the ``dnstap`` data.
|
||||
|
||||
.. option:: -t
|
||||
|
||||
This option prints long timestamps with millisecond precision.
|
||||
.. option:: -x
|
||||
|
||||
This option prints a hex dump of the wire form
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ Security Fixes
|
|||
New Features
|
||||
~~~~~~~~~~~~
|
||||
|
||||
- None.
|
||||
- ``dnstap-read`` can now print long timestamps with millisecond precision.
|
||||
:gl:`#2360`
|
||||
|
||||
Removed Features
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
|
|
|||
Loading…
Reference in a new issue