isc_log_t *lctx = NULL;
uint32_t flags = 0U;
int ch;
+ bool compact = false;
bool downgrade = false;
bool upgrade = false;
+ unsigned int serial = 0;
+ char *endp = NULL;
progname = argv[0];
- while ((ch = isc_commandline_parse(argc, argv, "dux")) != -1) {
+ while ((ch = isc_commandline_parse(argc, argv, "c:dux")) != -1) {
switch (ch) {
+ case 'c':
+ compact = true;
+ serial = strtoul(isc_commandline_argument, &endp, 0);
+ if (endp == isc_commandline_argument || *endp != 0) {
+ fprintf(stderr, "invalid serial: %s\n",
+ isc_commandline_argument);
+ exit(1);
+ }
+ break;
case 'd':
downgrade = true;
break;
} else if (downgrade) {
flags = DNS_JOURNAL_COMPACTALL | DNS_JOURNAL_VERSION1;
result = dns_journal_compact(mctx, file, 0, flags, 0);
+ } else if (compact) {
+ flags = 0;
+ result = dns_journal_compact(mctx, file, serial, flags, 0);
} else {
result = dns_journal_print(mctx, flags, file, stdout);
if (result == DNS_R_NOJOURNAL) {
Synopsis
~~~~~~~~
-:program:`named-journalprint` [**-dux**] {journal}
+:program:`named-journalprint` [-c serial] [**-dux**] {journal}
Description
~~~~~~~~~~~
to indicate whether the record was added or deleted, and continues with
the resource record in master-file format.
+The ``-c`` option provides a mechanism to compact the journal starting
+with the specified serial. Note this option *must not* be used while
+``named`` is running and can cause data loss if the the zone file does
+not contain the data that is being remove. Use with extreme caution.
+
The ``-x`` option causes additional data about the journal file to be
printed at the beginning of the output and before each group of changes.
..
.SH SYNOPSIS
.sp
-\fBnamed\-journalprint\fP [\fB\-dux\fP] {journal}
+\fBnamed\-journalprint\fP [\-c serial] [\fB\-dux\fP] {journal}
.SH DESCRIPTION
.sp
\fBnamed\-journalprint\fP scans the contents of a zone journal file,
to indicate whether the record was added or deleted, and continues with
the resource record in master\-file format.
.sp
+The \fB\-c\fP option provides a mechanism to compact the journal starting
+with the specified serial. Note this option \fImust not\fP be used while
+\fBnamed\fP is running and can cause data loss if the the zone file does
+not contain the data that is being remove. Use with extreme caution.
+.sp
The \fB\-x\fP option causes additional data about the journal file to be
printed at the beginning of the output and before each group of changes.
.sp