Error counters in nginx

Alexey Ivanov savetherbtz at
Fri Jun 12 10:26:04 UTC 2015


I have a feature request: from system administrator point of view it would be nice to have counters for each type of error log message.

For example right now nginx error.log consists of myriad of different error message formats:
	open() “%s” failed
	directory index of “%s” is forbidden
	SSL_write() failed
	zero size but in output chain
	client intended to send too large body

To plot that stuff on a dashboard sysadmin needs to increase error_log verbosity, write custom daemon that tails it and then manually write parser for every “interesting” log entry.
It would be nice if `ngx_log_error()` did all that work for us.

So that one could just specify following config:
	location /error_status {
		error_status_format csv;
and then following command…
	$ curl localhost/error_status
...would return:

Apache Traffic Server for example has an abstraction for error stats so we quickly implemented statistics for various TLS alerts[1] received from clients/upstreams (after that rolling out of preferred ciphersuite list changes and openssl upgrades became basically painless).

FreeBSD for example has a nice kernel API for counters: counter(9)[2]. Similar approach can be applied to nginx: with each worker maintaining it’s counters in separate part of shared memory, so updates to them can be lockless (and even non-atomic because there is no preemption inside one worker).

So questions are:
* Would Nginx Inc. be interested in adding such functionality?
* How much it interferes with Nginx Plus selling points? If somebody else writes that code, will it be possible to "upstream” it?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <>

More information about the nginx-devel mailing list