简体   繁体   English

需要Nginx access_log大小限制

[英]Nginx access_log size limit is needed

nginx v 1.13.0 (windows) OS WS 2012 R2 nginx v 1.13.0(windows)OS WS 2012 R2

I want to limit the size of the access log to 10MB. 我想将访问日志的大小限制为10MB。

What are the parameters for that on Windows nginx 1.13.0? 在Windows nginx 1.13.0上有哪些参数?

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

CD C:\\nginx CD C:\\ nginx

for /f "tokens=1,2" %%u in ('date /t') do SET d=%%v 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 for / f“tokens = 1”%% u in('time / t')执行SET t = %% u

if "%t:~1,1%"==":" SET t=0%t% 如果“%t:~1.1%”==“:”SET t = 0%t%

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

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

rem quit nginx to close the logs rem退出nginx以关闭日志

nginx.exe -s quit nginx.exe -s退出

CD C:\\nginx\\logs\\ CD C:\\ nginx \\ logs \\

IF EXIST access.log ( MOVE access.log access_closed_%DATESTR%%TIMESTR%.log ) 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 error.log(MOVE error.log error_closed_%DATESTR %% TIMESTR%.log)

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

CD C:\\nginx start nginx.exe CD C:\\ nginx启动nginx.exe

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM