Collapsing Empty Variables in Nginx Access Log When Using TAB Delimiter

adamchal nginx-forum at nginx.us
Fri Mar 9 17:23:28 UTC 2012


What I've done for now is replace the lines at 675 and 676 of
(src/http/modules/ngx_http_log_module.c):

674:     if (value == NULL || value->not_found) {
675:        *buf = '-';
676:        return buf + 1;
677:    }

with:

674:     if (value == NULL || value->not_found) {
675:        *buf = 0;
676:        return buf;
677:    }

I hope this won't cause any issues.  It seems to be working very nicely.
 Here's a see one-liner if anyone is interested in doing the same
thing:

sed -n '1h;1!H;${;g;s/buf = \W-\W;\(\s*return buf\) + 1;/buf =
0;\1;/g;p;}' src/http/modules/ngx_http_log_module.c >
src/http/modules/ngx_http_log_module.c.new && mv -f
src/http/modules/ngx_http_log_module.c.new
src/http/modules/ngx_http_log_module.c

It would be nice in the future to be able to set the "NULL" character
for the log module.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,223532,223680#msg-223680



More information about the nginx mailing list