Forum: NGINX new log file every x minutes

Posted by S Ahmed (Guest)
on 2012-12-04 15:57
(Received via mailing list)
Hi,

How can I tell nginx to create a new log file (access log) every x 
minutes?
Posted by Edho Arief (Guest)
on 2012-12-04 16:02
(Received via mailing list)
On Tue, Dec 4, 2012 at 9:56 PM, S Ahmed <sahmed1020@gmail.com> wrote:
> Hi,
>
> How can I tell nginx to create a new log file (access log) every x minutes?
>

Use your system's logrotate to do that.
Posted by smallfish (Guest)
on 2012-12-04 16:04
(Received via mailing list)
use crontab. and send USR1 to master process.
--
smallfish http://chenxiaoyu.org
Posted by S Ahmed (Guest)
on 2012-12-04 19:46
(Received via mailing list)
How do I sent a USR1?  What is that for, it signals to nginx to start a 
new
file?
Posted by Jonathan Matthews (Guest)
on 2012-12-04 19:49
(Received via mailing list)
On 4 December 2012 18:45, S Ahmed <sahmed1020@gmail.com> wrote:
> How do I sent a USR1?  What is that for, it signals to nginx to start a new
> file?

I don't believe so, no. Check
http://wiki.nginx.org/CommandLine#Stopping_or_Rest...
You'd have to move the log out from under nginx before sending it, I 
think.

I'd personally use logrotate with a specially SIGUSR1-related config
stanza if I had to do this, and wouldn't try and write the logic
myself.

Jonathan
--
Jonathan Matthews // Oxford, London, UK
http://www.jpluscplusm.com/contact.html
Posted by S Ahmed (Guest)
on 2012-12-04 20:06
(Received via mailing list)
I didn't realize this would so tricky, or "tricky" :)

I was hoping it was just a simple config setting! hehe


On Tue, Dec 4, 2012 at 1:49 PM, Jonathan Matthews
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.