Skip to content

Setup logrotate for nginx under windows

Create a batch script for the logrotate and save it as nginx_logrotate.bat


rem get date in format ddMMyyyyhhmmss
set dt=%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%
set dt=%dt: =0%
rem move the current logfiles
move F:\Programme\nginx\logs\Access.log F:\Programme\nginx\logs\Access%dt%.log
move F:\Programme\nginx\logs\Error.log F:\Programme\nginx\logs\Error%dt%.log
rem tell nginx to write new logfiles
cd F:\Programme\nginx\
call F:\Programme\nginx\nginx.exe -p F:\Programme\nginx\ -s reopen

Then you can create a basic windows scheduler task which starts this batch script.

If you run nginx as a windows service, make sure to execute the windows scheduler with the same user as the nginx windows service is running.


When you’re getting the following error:  could not open error log file: CreateFile() "F:\Programme\nginx\nginx.exe/logs/error.log" failed (3: The system cannot find the path specified), make sure to not add nginx.exe to the –p parameter value

Trackbacks

Comments

Display comments as Linear | Threaded

Custom essay writing service on :

Well, this is my first visit to your blog! But I admire the precious time and effort you put into it, especially into interesting articles you share here!

Linus Richardson on :

Quae vel sit voluptatum quo

<a href="https://www.w3schools.com">Visit W3Schools.com!</a> on :

Quos cumque quasi consequatur aperiam dolore elit consequuntur

CourseworkGeek.co.uk on :

I've discovered a lot of references on the web for pivoting the Nginx logs under Linux.. simply send the USR1 flag to the procedure. However... Unix like signs don't exist on windows and I haven't possessed the capacity to discover any data on this. How might I achieve a similar thing with nginx on windows??

CourseworkHelpPros.co.uk on :

Hic commodi eos eos quas vel distinctio Voluptatibus voluptatem aut ipsum explicabo Quos et

[geshi lang=lang_name [,ln={y|n}]][/geshi

www.courseworkbuzz.co.uk on :

It had particular necessity to stop , then duplicate log documents and after that restart benefit nighly premise. You can download the code and change it the way you need.

CourseworkHelpPros.co.uk on :

With courseworkhelppros web-based composition administrations, you don't have to look anyplace else as we are working round the clock to give you some assistance at your season of scholarly needs. Our written work organization has the best profile keeping in mind the end goal to supply you with quality coursework satisfying all your custom necessities

[url=https://australianwritings.net/]australian custom essay writing[/url] on :

Nice one.

godaddy 1 dollar domain on :

I have visit first time on your site and I extremely like all the data that you have put on your blog entry. A debt of gratitude is in order for setting up incredible substance on your site.

adamsnow on :

HOw do use this batch file I hope their will be a tutorial about this

lawn care lexington sc on :

I just encountered an error and I don't have any idea how to fix it. Do you have a video or a step by step tutorial of how to get rid of it?

192,168,0,1 on :

Je vous remercie de l'information! Je cherchais et ne pouvait pas trouver. Vous me aidé!

Lisa on :

Did you interested at social media essay ideas ?

pressure washing service on :

I'm not really sure I understand completely, I may need a little more insight and detail on how to execute this. Thanks!

watch game of thrones on :

I am not familiar about this one but I really appreciate the shared knowledge that the author gave us. Thank you so much!

https://pressurewasherofallonmo.com on :

Awesome! This will definitely give a helpful hands to programmers and web development departments in setting up logrotate in nginx specifically to Windows.

Expert power washing and pressure washing services in O'Fallon Missouri. If you want a home, deck, driveway or fence that looks brand new, give us a call today - 636-206-8083

Keith Reynolds on :

Great! Thanks for sharing this information with us. This can help everyone. If by chance you need a moving company to help you Fort Wayne Movers may help you with that problems.

deck companies on :

This is informative. Thank you for this! I will try to study this one.

deck design on :

I'll try to figure this out on my own. I am very interested to do this and experiment as well. Thanks!

micro macro dilemma definition on :

No idea how to create a basic windows scheduler task which starts this batch script. I would not mind being instructed.

Ken Coleman on :

Great! Thanks for sharing this. It helps a lot.

Neha Nainital Escorts on :

As soon as she knocks the door of your room your heart beat automatically gets faster. You welcome her with a long smooch and a warm hug. She gives you a girlfriend like feeling and readily come along with you on the bed. The moments of love never end and the Nainital escort keeps on grabbing your attention.

free robot review on :

Free Forex robot is now available, my newest and favorite creation is here to ignite your accounts. As you know I have promised to release another free system and all of you faithful Forex Robot Nation readers have been very patient.

shristi patni on :

information you have posted is very HELPFUL THANKS.

JAIPUR ESCORTS JYOTI NASANA on :

Book Best Jaipur Escorts Service with Jyoti Nasana. We Provide Model escorts in Jaipur, Russian, Housewife Escorts, Vip Call Girls in Jaipur.

claritywindowsltd.com on :

Thank you for sharing this valuable information. Cheers from the whole team in Victoria BC, Canada!

Escorts in Jaipur on :

Free classifieds in india - Schloka. Post Free ads For Al over Cities of india with Escorts And Call Girls category. and Find Here Perfect Escorts Girls Just one Click in all Over India With Schloka.

binarytoday.com on :

In every marketplace there are major shifts due to innovation and perseverance, today with the release of Binary Strategy, we have just that.

Add Comment

You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.
Markdown format allowed
Form options