Log rotation on windows?

I’ve searched a lot for this but I haven’t found any information.
On linux you can do a log rotation by sending the USR1 signal to the
process.
Is there a similar way to do this on windows?

Thanks.

On Mon, Aug 23, 2010 at 8:00 PM, Arthur B. [email protected]
wrote:

I’ve searched a lot for this but I haven’t found any information.
On linux you can do a log rotation by sending the USR1 signal to the
process.
Is there a similar way to do this on windows?
Thanks.

nginx -s reopen

?


O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

I get this error:

C:\nginx>nginx -s reopen
[error]: OpenEvent(“ngx_reopen_1884”) failed (2: The system cannot find
the
file specified)

C:\nginx>tasklist /fi “imagename eq nginx”
INFO: No tasks are running which match the specified criteria.

C:\nginx>tasklist /fi “imagename eq nginx.exe”

Image Name PID Session Name Session# Mem
Usage
========================= ======== ================ ===========

nginx.exe 1884 Services 0
4,460 K
nginx.exe 1752 Services 0
5,512 K

On Mon, Aug 23, 2010 at 10:44:21AM -0400, Arthur B. wrote:

I get this error:

C:\nginx>nginx -s reopen
[error]: OpenEvent(“ngx_reopen_1884”) failed (2: The system cannot find the
file specified)

What does

tasklist /fi “imagename eq nginx.exe”

show ?


Igor S.
http://sysoev.ru/en/

On Mon, Aug 23, 2010 at 10:53:38AM -0400, Arthur B. wrote:

C:\nginx>tasklist /fi “imagename eq nginx”
INFO: No tasks are running which match the specified criteria.

C:\nginx>tasklist /fi “imagename eq nginx.exe”

Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
nginx.exe 1884 Services 0 4,460 K
nginx.exe 1752 Services 0 5,512 K

Strange, there is a process with 1884 pid. The event should exist.
Could you terminate the nginx processes, then start nginx again and try
to run “nginx -s reopen” ?


nginx mailing list
[email protected]
http://nginx.org/mailman/listinfo/nginx


nginx mailing list
[email protected]
http://nginx.org/mailman/listinfo/nginx


Igor S.
http://sysoev.ru/en/

My apologies: I see now that this behavior is clearly documented here:
http://nginx.org/en/docs/windows.html it was confusing to me whether
wiki.nginx.org or nginx.org is the official documentation page.
Thanks for this great software!
I was able to replace 4 load balanced Apache servers that could not
handle a
high request load (>1000 requests per second) with one nginx instance on
a
single server that could handle all that load with a small amount of
memory
and staying at around 10% cpu. Is nginx on windows still considered
inferior in performance to the linux version? Despite that, it seems to
blow away apache on windows.

On Tue, Aug 24, 2010 at 07:03:43AM -0400, Arthur B. wrote:

My apologies: I see now that this behavior is clearly documented here:
http://nginx.org/en/docs/windows.html it was confusing to me whether
wiki.nginx.org or nginx.org is the official documentation page.\

nginx can run as a service itself, but it should be run by another
utility. Probably nginx should use “Global” prefix, i.e.
“Global\ngx_reopen_XXX”, because srvany/etc may change session.
Tomorrow I will make a test-build with this prefix to test it.

I tried that and it does not work either, but I’ve found that if I run
anywhere on the wiki or faq. I guess it’s supposed to be obvious?)

Image Name PID Session Name Session# Mem
to run “nginx -s reopen” ?

the
Igor S.
[email protected]
http://nginx.org/mailman/listinfo/nginx


nginx mailing list
[email protected]
http://nginx.org/mailman/listinfo/nginx


Igor S.
http://sysoev.ru/en/

I tried that and it does not work either, but I’ve found that if I run
nginx
directly from the command line, it does work.

I am using a windows service wrapper so that nginx can continue to run
when
I’m logged off (as documented here
http://misterdai.wordpress.com/2009/10/16/nginx-windows-service/)
In fact, none of the -s commands work when I’m running it under a
service.
Any ideas why not? I tried it both under an administrator account and
the
actual account that it is running under as a service…

It wasn’t clear to me that “-s reopen” was for reopening the log files
(not
anywhere on the wiki or faq. I guess it’s supposed to be obvious?)

On Tue, Aug 24, 2010 at 03:55:29PM +0400, Igor S. wrote:

On Tue, Aug 24, 2010 at 07:03:43AM -0400, Arthur B. wrote:

My apologies: I see now that this behavior is clearly documented here:
http://nginx.org/en/docs/windows.html it was confusing to me whether
wiki.nginx.org or nginx.org is the official documentation page.\

nginx can run as a service itself, but it should be run by another

nginx can NOT run as a service itself, but it should be run by another

utility. Probably nginx should use “Global” prefix, i.e.
“Global\ngx_reopen_XXX”, because srvany/etc may change session.
Tomorrow I will make a test-build with this prefix to test it.


Igor S.
http://sysoev.ru/en/

Yes, I am using the winsw wrapper to run nginx as a server. It’s very
lightweight and easy to use.
http://projectkenai.com/projects/winsw
http://projectkenai.com/projects/winswBy the way, this project is MIT
licensed, so I think that it would be quite easy to add it to the nginx
code
base.
http://misterdai.wordpress.com/2009/10/16/nginx-windows-service/
explains
fully how to use winsw with nginx.

Thank you. I would be happy to test this build for you as well.

I found the ultimate solution to my problem: Switch to Linux :slight_smile:

One more question: On Linux, which command is better to rotate log
files?

nginx -s reopen

or

kill -USR1

I think using nginx -s reopen is better because its more clear and you
don’t
have to grab the pid. On the other hand, using kill may be more unixy
and
work better with some existing system rotation scripts. But I think
that’s
moot anyway because using the USR1 signal to rotate logs is not really
standard. It probably doesn’t really matter. I’m thinking that using
kill
to rotate the logs is just sort of a “legacy” way of doing it before the
-s
reopen option was added…

On Tue, Aug 24, 2010 at 08:03:49AM -0400, Arthur B. wrote:

Thank you. I would be happy to test this build for you as well.

Could you test this: http://nginx.org/tmp/nginx-0.8.50.zip ?


Igor S.
http://sysoev.ru/en/

On Wed, Aug 25, 2010 at 8:28 AM, Igor S. [email protected] wrote:

On Tue, Aug 24, 2010 at 08:03:49AM -0400, Arthur B. wrote:

Thank you. I would be happy to test this build for you as well.

Could you test this: http://nginx.org/tmp/nginx-0.8.50.zip ?

C:\nginx-0.8.50>tasklist /fi “imagename eq nginx.exe”

Image Name PID Session Name Session# Mem
Usage
========================= ======== ================ ===========

nginx.exe 6824 Services 0
4,808 K
nginx.exe 5328 Services 0
5,132 K

C:\nginx-0.8.50>nginx -s reopen
[error]: OpenEvent(“Global\ngx_reopen_6824”) failed (5: Access is
denied)

On Wed, Aug 25, 2010 at 08:06:41AM -0400, Arthur B. wrote:

I found the ultimate solution to my problem: Switch to Linux :slight_smile:

Yes, Linux is much more preferable than Windows for nginx.

work better with some existing system rotation scripts. But I think that’s
moot anyway because using the USR1 signal to rotate logs is not really
standard. It probably doesn’t really matter. I’m thinking that using kill
to rotate the logs is just sort of a “legacy” way of doing it before the -s
reopen option was added…

We usually use the kill. “nginx -s reopen” has to grab the pid using
nginx.conf, because it needs to know master process pid.


Igor S.
http://sysoev.ru/en/

On Wed, Aug 25, 2010 at 7:31 PM, Igor S. [email protected] wrote:

We usually use the kill. “nginx -s reopen” has to grab the pid using
nginx.conf, because it needs to know master process pid.

actually, using nginx -s reopen -c /path/to/config is usually more
reliable as there’s no need to check/find the path to pidfile (unless
using pkill but then that’d trigger all nginx master servers when
there are more than one running (no reason to, but who knows?))


O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

On Wed, Aug 25, 2010 at 9:18 AM, Igor S. [email protected] wrote:

5,132 K

C:\nginx-0.8.50>nginx -s reopen
[error]: OpenEvent(“Global\ngx_reopen_6824”) failed (5: Access is denied)

It’s better. Could you run “nginx -s reopen” as the same user as run by
WinSW ?

That works! Just have to make sure to use the -p option too if you run
the
command from another path.

On Wed, Aug 25, 2010 at 09:11:22AM -0400, Arthur B. wrote:

C:\nginx-0.8.50>tasklist /fi “imagename eq nginx.exe”

Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
nginx.exe 6824 Services 0 4,808 K
nginx.exe 5328 Services 0 5,132 K

C:\nginx-0.8.50>nginx -s reopen
[error]: OpenEvent(“Global\ngx_reopen_6824”) failed (5: Access is denied)

It’s better. Could you run “nginx -s reopen” as the same user as run by
WinSW ?


Igor S.
http://sysoev.ru/en/

http://sourceforge.net/projects/pyrotate/

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,122714,172133#msg-172133

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs