View Single Post
Old 23rd November 2017
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,132
Default

So it doesn;t look a named pipe issue then

I wonder whether it a log file rotation issue as TronDD has mentioned,

To rotate a log file the log rotating program sends a signal to the program creating the log. This way it knows that it the log file has been renamed/rotated and thus stop logging to that file and has to open/create a new one.

The standard signal is SIGHUP, but some programs needs a different signal, In OpenBSD's newslog.conf(8) there is a field that allows you to specify an alternative signal i.e. SIGUSR1.

Nginx is an example of such a program that needs a SIGUSR1 because it also has to deal with it's multipe worker processes, and thus can rotate the logs by itself.

From http://article.gmane.org/gmane.comp....nx.english/181 :

Code:
From: Igor Sysoev <is-G97k7egY2jIKNkxEY4oc4w <at> public.gmane.org>
Subject: Re: Log rotation
Newsgroups: gmane.comp.web.nginx.english
Date: Tuesday 19th September 2006 22:49:17 UTC (over 11 years ago)

On Tue, 19 Sep 2006, Bob Ippolito wrote:

> It looks like nginx can do log rotation by sending it USR1, but I
> haven't seen any English mention of this outside of the source code.
> Could someone show an example of how log rotation works with nginx? Is
> there a recommended log rotation tool that can handle this style of
> log rotation? I've been using piped log processes (mostly rotatelogs)
> w/ Apache for years to handle this issue.
>
> Currently most of my nginx usage is as a proxy, so I've just turned
> access logs off.. but I would like to replace Apache in a few other
> places, so I need to have rotated logs.

When master process receives -USR1 it repopens all logs, does chown()
and chmod() (to allow unpriviliged worker processes to reopen them),
and notifies workers about reopening. Then the workers reopens its
logs too. So the old logs are available to gzip right away - you will
not lose any line. The sequence is following:

mv access_log  access_log.0
mv error_log  error_log.0
kill -USR1 master
sleep 1
gzip access_log.0
gzip error_log.0

nginx does not support piping logs.

Igor Sysoev
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote