NGINX syslog-ing without breaking the bank or patching the code
1–10 of 47 posts
Re: NGINX syslog-ing without breaking the bank or patching the code
#2Referring to a human as a "devop" is equivalent to calling someone an "agile".
Re: NGINX syslog-ing without breaking the bank or patching the code
#3Re: NGINX syslog-ing without breaking the bank or patching the code
#4" CloudFlare generates 50gb/s of logs globally and have handled collecting this volume in two ways. Historically the logs are sent to a local syslog-ng through the use of a PIPE and the forwarded to central logger. This can be done with nginx with no patches by just treating the PIPE as file. Just make sure you do a little buffering inside nginx.
access_log /dev/nginx_access log_format_name buffer=64k flush=10s;
Since this is a pipe there is still some blocking IO, but no worse off then writing to local file."
Re: NGINX syslog-ing without breaking the bank or patching the code
#5Re: NGINX syslog-ing without breaking the bank or patching the code
#6Re: NGINX syslog-ing without breaking the bank or patching the code
#7If the other side of the pipe closes (e.g. syslog-ng), your process will hang once the I/O buffer fills up, which is generally 4KB.
You especially need to keep this in mind, when syslog-ng restarts (pipe closed, pipe reopened). You'll probably glance quickly to see that syslog-ng is running, and the pipe is present, but wonder why nginx is not serving traffic.
Or worse, be fooled into thinking nginx is fine because it was serving traffic up until it served 50 requests (or however many reqs it takes to generate 4,000 bytes of access logs), then stopped.
Re: NGINX syslog-ing without breaking the bank or patching the code
#8This seems dangerous -- if rsyslog crashes then the pipe is left without a consumer and all writes to it block indefinitely, exactly the opposite of how you would expect syslog to work.
Re: NGINX syslog-ing without breaking the bank or patching the code
#9This seems dangerous -- if rsyslog crashes then the pipe is left without a consumer and all writes to it block indefinitely, exactly the opposite of how you would expect syslog to work.