log rolling limitations
Summary
Log file and dnstap output file rotation is behaving counterintuitively in corner cases. The examples demonstrate behavior with dnstap but logging behavior is the same.
BIND version used
- Affects v9.19: b171cacf
- Affects v9.18: ad6990f0 (not tested, but I believe it ;-))
- Affects v9.16: 5c68a45a
Steps to reproduce
- Build
namedwith dnstap support:
./configure --enable-dnstap
- named.conf:
options {
dnstap { all query; };
dnstap-output file "/tmp/test.dnstap" size 1m versions 3 suffix timestamp;
};
Alternative config which demonstrates the same problems with logging:
logging {
channel an_example_channel {
file "/tmp/example.log" versions 1 size 1k suffix timestamp;
print-time yes;
print-category yes;
severity debug 99;
};
category default { an_example_channel; };
};
What is the current and expected current behavior?
-
rndc dnstap -roll 1/ logfile ... versions 1 size 1k suffix timestamp- Rolling does not remove old files if filename in
named.confcontains a path (e.g./tmp/) - affects onlysuffix timestampvariant. All historical files are kept around.
- Rolling does not remove old files if filename in
-
rndc dnstap -roll 1/ logfile ... versions 1 size 1k suffix increment- Currently: Does not remove "extra" versions, i.e. versions beyond 0 if they already exist.
- Expected: Removes older files like
.1,.2, etc.
-
rndc dnstap -roll 0- Currently: Creates new backup files up to
versionsdefined in named.conf - Expected: Does not create backup file, just truncates the existing one.
- Currently: Creates new backup files up to
Relevant logs
rm -f /tmp/example.log*
named -f -c named.conf
ls -1 /tmp/example.com*
/tmp/example.log
/tmp/example.log.20230405130407683
/tmp/example.log.20230405130407687
/tmp/example.log.20230405130407690
/tmp/example.log.20230405130407730
/tmp/example.log.20230405130407733
Edited by Petr Špaček