Limit NGINX log size
J Carter
jordanc.carter at outlook.com
Sun Jan 28 07:15:39 UTC 2024
Hello,
On Sat, 27 Jan 2024 15:55:42 +0530
Rakshith Kumar <rakshith.2302 at gmail.com> wrote:
> Hello Team,
>
> I would like to know how to limit the NGINX limit size.
> We would like to set size limit for Nginx log files on App Volumes Manager
> since it consume disk space over time. Can we add any parameters to
> nginx.conf to limit or rotate the logs.
>
> Location: ..\Program Files (x86)\CloudVolumes\Manager\nginx\logs
>
> Ex: error_https.log, error.log, access.log files.
>
> Regards,
> Rakshith
Nginx does not have log rotation capabilities built in, nor can you
limit the size of logs. The logrotate utility is used for this task on
unix/unix-like platforms.
The best choice would be to either write your own utility to do the
rotation, or use a premade windows native utility.
Something like this powershell clone of logrotate might work well:
https://github.com/theohbrothers/Log-Rotate
It's necessary for nginx to reopen the logs post rotation, on Windows I
believe you'll need to use the CLI for that '<nginx-exe-here> -s
reopen' - or restart the service if you have it running as a service.
More information about the nginx
mailing list