You want to rotate a name servers log files.
BIND name servers support a limited form of log file rotation. When you define a file channel, you can specify that the name server keep some number of versions of the file with the versions argument to the file substatement. For example, this channel definition tells the name server to save seven versions of the named.log file:
logging { channel "named_log" { file "named.log" versions 7; print-time yes; }; };
The name server will only rotate the files when its restarted or reloaded, so after seven restarts or reloads, youll have a named.log, named.log.1, and so on.
You can combine the versions argument with the size argument to tell the name server to rotate the log file once it reaches a certain size. For example, to rotate the log file once it reaches a megabyte in size, you could use this channel substatement:
logging { channel "named_log" { file "named.log" versions 7 size 1m; print-time yes; }; };
With a size specified, log files are only renamed when the current log file exceeds the size limit, not on restart or reload.
Use the keyword unlimited to keep an unlimited number of old versions of a log file:
logging { channel "named_log" { file "named.log" versions unlimited size 1m; print-time yes; }; };
On BIND 8, unlimited is actually synonymous with "99" for purposes of log file rotation.
"The Logging Statement" in Chapter 7 of DNS and BIND.
Getting Started
Zone Data
BIND Name Server Configuration
Electronic Mail
BIND Name Server Operations
Delegation and Registration
Security
Interoperability and Upgrading
Resolvers and Programming
Logging and Troubleshooting
IPv6