Hello! On Thu, Feb 13, 2014 at 11:15:41AM +1100, Andrew Punch wrote:
> Hi, > > I am maintaining a custom module for nginx. We currently rotate our logs > and load dynamic data every 5 minutes by using SIGHUP. Unfortunately this > is also tears down our keepalive connections which harms our performance > (we are handling about 1500 requests per second per server). We have a > number of custom log files in addition to the access log and error log > which also need to be rotated. > > I was hoping that I could use SIGUSR1 to reopen the logs (including the > module's custom logs) and notify the module that it should reload the > dynamic data without dropping the keepalive connections. > > I can see that I could use ngx_conf_open_file() to open the module's custom > log files so that nginx will take care of reopening them. However for > reloading the dynamic data: I can't see a way to hook the SIGUSR1 in the > worker process (which shows up as a NGX_CMD_REOPEN in the channel for the > worker process). However if I added a new hook for NGX_CMD_REOPEN then > epoll inside the channel handler would probably return EEXIST. > > So what is the best way for a module to hook NGX_CMD_REOPEN? Or is there > better way of approaching this? Take a look at ngx_open_file_t's flush() handler. E.g., it is used by ngx_http_log_module to flush buffered/gzipped logs before reopen. -- Maxim Dounin http://nginx.org/ _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel