Opened 6 years ago
Closed 6 years ago
#1787 closed task (invalid)
Documentation about log rotation?
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | other | Version: | 1.15.x |
Keywords: | documentation | Cc: | |
uname -a: | Linux vps683692 4.15.0-50-generic #54-Ubuntu SMP Mon May 6 18:46:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux | ||
nginx -V: |
nginx version: nginx/1.14.0 (Ubuntu)
built with OpenSSL 1.1.0g 2 Nov 2017 TLS SNI support enabled configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-FIJPpj/nginx-1.14.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module |
Description
Hi, I'm new to nginx, and I don't know where to post this, so excuse me if it's not the right place.
My problem is that I have a nginx instance running on a server, and it has produced the following files:
-rw-r----- 1 www-data adm 744 Jun 1 07:20 access.log
-rw-r----- 1 www-data adm 31162 Jun 1 05:49 access.log.1
-rw-r----- 1 www-data adm 3204 May 23 06:19 access.log.10.gz
-rw-r----- 1 www-data adm 3296 May 22 06:19 access.log.11.gz
-rw-r----- 1 www-data adm 9873 May 21 06:24 access.log.12.gz
-rw-r----- 1 www-data adm 10789 May 20 05:44 access.log.13.gz
-rw-r----- 1 www-data adm 23381 May 19 06:15 access.log.14.gz
-rw-r----- 1 www-data adm 2460 May 31 06:24 access.log.2.gz
-rw-r----- 1 www-data adm 10966 May 30 06:18 access.log.3.gz
-rw-r----- 1 www-data adm 8335 May 29 06:17 access.log.4.gz
-rw-r----- 1 www-data adm 19000 May 28 05:55 access.log.5.gz
-rw-r----- 1 www-data adm 3254 May 27 05:59 access.log.6.gz
-rw-r----- 1 www-data adm 8284 May 26 06:21 access.log.7.gz
-rw-r----- 1 www-data adm 8185 May 25 05:48 access.log.8.gz
-rw-r----- 1 www-data adm 13997 May 24 05:46 access.log.9.gz
-rw-r----- 1 www-data adm 0 Jun 1 06:25 error.log
-rw-r----- 1 www-data adm 503 May 31 14:47 error.log.1
-rw-r----- 1 www-data adm 375 May 16 04:30 error.log.10.gz
-rw-r----- 1 www-data adm 393 May 15 05:48 error.log.11.gz
-rw-r----- 1 www-data adm 303 May 14 05:58 error.log.12.gz
And, I'm trying to find some information about how those files are created in nginx, but I can't find anything on the nginx documentation (I've been searching for "nginx log rotation"). The closest I could find is this page: https://docs.nginx.com/nginx/admin-guide/monitoring/logging,
but it does not explain anything about log rotation.
I also downloaded the nginx free book (Complete-NGINX-Cookbook-2019.pdf), but again nothing about log rotation.
I just want to know more about log rotation in nginx, so that I can eventually try to organize them better (for instance, 1 log per day). Right now, I don't even know whether nginx changes the access log file based on the day, the size of the log, or another criterion.
For now I will simply open the files one by one and make an educated guess for myself, but I'm suggesting that the nginx documentation should provide a section about log rotation.
Cheers.
Log rotation is something provided by the OS, by programs like
newsyslog
orlogrotate
. Refer to your OS documentation to find out which one is used and how to configure it. Features provided by nginx to simplify log rotation are documented here.