Flush access log buffer

lists at lazygranch.com lists at lazygranch.com
Tue Feb 27 02:32:12 UTC 2018


On Fri, 23 Feb 2018 18:54:48 -0800
"lists at lazygranch.com" <lists at lazygranch.com> wrote:

> On Thu, 22 Feb 2018 18:40:12 -0800
> "lists at lazygranch.com" <lists at lazygranch.com> wrote:
> 
> > When I was using FreeBSD, the access log was real time. Since I went
> > to Centos, that doesn't seem to be the case. Is there some way to
> > flush the buffer?
> > _______________________________________________
> > nginx mailing list
> > nginx at nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx  
> 
> I found a flush=x option on the command line. I set it for 1m for
> testing. Note that you need to specify a buffer size else nginx will
> choke.
> 
> _______________________________________________

This flush=time option isn't working. I'm at a loss here. 

Here is some of a ls -l:
-rw-r----- 1 nginx adm    12936 Feb 27 02:17 access.log
-rw-r--r-- 1 nginx root    4760 Feb 24 03:06 access.log-20180224.gz
-rw-r----- 1 nginx adm  1738667 Feb 26 03:21 access.log-20180226

This is the ls -l on /var/log/nginx:
drwxr-xr-x. 2 root   root       4096 Feb 27 02:11 nginx

I'm not requesting a compressed log, so I assume centos is creating the
gunzip files. Usually the access.log file has content, but sometimes it
is empty and the log data is on the access.log-"date" file, which I
suspect is a roll over from access.log. That is maybe centos rolls it
but doesn't zip it right away.


http {
    log_format  main  '$status $remote_addr - $remote_user [$time_local] "$request" '
                      '$body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main buffer=32k flush=1m;


uname -a
Linux 3.10.0-693.17.1.el7.x86_64 #1 SMP Thu Jan 25 20:13:58 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

nginx -V
nginx version: nginx/1.12.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx
--modules-path=/usr/lib64/nginx/modules
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid
--lock-path=/var/run/nginx.lock
--http-client-body-temp-path=/var/cache/nginx/client_temp
--http-proxy-temp-path=/var/cache/nginx/proxy_temp
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
--http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx
--group=nginx --with-http_ssl_module --with-http_realip_module
--with-http_addition_module --with-http_sub_module
--with-http_dav_module --with-http_flv_module --with-http_mp4_module
--with-http_gunzip_module --with-http_gzip_static_module
--with-http_random_index_module --with-http_secure_link_module
--with-http_stub_status_module --with-http_auth_request_module
--with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic
--with-http_geoip_module=dynamic --with-http_perl_module=dynamic
--add-dynamic-module=njs-1c50334fbea6/nginx --with-threads
--with-stream --with-stream_ssl_module --with-http_slice_module
--with-mail --with-mail_ssl_module --with-file-aio --with-ipv6
--with-http_v2_module --with-cc-opt='-O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic'
--with-ld-opt=-Wl,-E





More information about the nginx mailing list