0

nginx v 1.13.0 (windows) OS WS 2012 R2

I want to limit the size of the access log to 10MB.

What are the parameters for that on Windows nginx 1.13.0?

David Ringsmuth
  • 325
  • 1
  • 12

1 Answers1

0
rem rotate nginx access.log, error.log, rejects.log

CD C:\nginx

for /f "tokens=1,2" %%u in ('date /t') do SET d=%%v

for /f "tokens=1" %%u in ('time /t') do SET t=%%u

if "%t:~1,1%"==":" SET t=0%t%

SET DATESTR=%d:~6,4%-%d:~0,2%-%d:~3,2%

SET TIMESTR=%t:~0,2%-%t:~3,2%

rem quit nginx to close the logs

nginx.exe -s quit

CD C:\nginx\logs\

IF EXIST access.log (
MOVE access.log access_closed_%DATESTR%%TIMESTR%.log
)

IF EXIST error.log (
MOVE error.log error_closed_%DATESTR%%TIMESTR%.log
)

IF EXIST rejects.log (
MOVE rejects.log rejects_closed_%DATESTR%%TIMESTR%.log
)

CD C:\nginx
start nginx.exe
M at
  • 1,020
  • 1
  • 12
  • 26
David Ringsmuth
  • 325
  • 1
  • 12