-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Shane,
I'm not sure if I understand what you mean by a rotated log file. Could
you give me some more pointers of what you are trying to do?
Shane Kerr wrote:> Hello,
>
> As far as I can tell, if you specify a log file for NSD it is never
> rotated.
>
> We could use syslog to give us this functionality, but we run a number
> of different versions of NSD, and prefer to use the log file than
> syslog.
>
> I think a small change would be to have the server re-open the log file
> when the server is reloaded would work for us. These two patches should
> make that happen:
>
> --- nsd.c Thu Sep 25 14:01:41 2008
> +++ nsd.c.new Tue Nov 4 15:19:26 2008
> @@ -588,8 +588,8 @@
> {
> if(nsd.options->identity) nsd.identity = nsd.options->identity;
> }
> - if (nsd.options->logfile && !log_filename) {
> - log_filename = nsd.options->logfile;
> + if (log_filename) {
> + nsd.options->logfile = log_filename;
> }
> if(nsd.child_count == 0) {
> nsd.child_count = nsd.options->server_count;
> @@ -759,8 +759,8 @@
> #endif /* TSIG */
>
> /* Set up the logging... */
> - log_open(LOG_PID, FACILITY, log_filename);
> - if (!log_filename) {
> + log_open(LOG_PID, FACILITY, nsd.options->logfile);
> + if (!nsd.options->logfile) {
> log_set_log_function(log_syslog);
> }
> --- server.c Thu Oct 16 14:21:28 2008
> +++ server.c.new Tue Nov 4 15:16:32 2008
> @@ -1034,6 +1034,8 @@
> }
>
> log_msg(LOG_WARNING, "signal received, reloading...");
> + log_finalize();
> + log_open(LOG_PID, FACILITY, nsd->options->logfile);
>
> if (socketpair(AF_UNIX, SOCK_STREAM, 0, reload_sockets) == -1) {
> log_msg(LOG_ERR, "reload failed on socketpair: %s",
strerror(errno));
I don't think this patch changes any behavior in nsd. Am I missing
something?
Regards,
Matthijs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFJFBOYIXqNzxRs6egRAgRJAJ4rMHwK4Lo0kmEp5GK2cnfxXMU7iACghVEe
Dgqx02UDcETMGTxUN0EjqOs=SZdz
-----END PGP SIGNATURE-----