On Thu, Sep 10, 2015 at 06:51:18PM +0530, gaurav gupta wrote: Hi there,
> How can we remove request url being logged in nginx error logs. For example > it looks something like: I don't think you can control the details of what nginx writes. Perhaps you could process the logs yourself before passing them on to whoever should not see the details? > 2015/09/01 15:26:03 [error] 30547#0: *208725 upstream prematurely closed > connection while reading response header from upstream, client: > 123.123.50.44, server: test.example.com, request: "GET > /v1.3/status.json?...." > > is it possible to drop request from the log(if present) so it looks > something like: > > 2015/09/01 15:26:03 [error] 30547#0: *208725 upstream prematurely closed > connection while reading response header from upstream, client: > 123.123.50.44, server: test.example.com I believe there are a limited number of error log patterns; possibly a script to "s/, request: .*//" would work for you? (Test your logs against the output that you want, to see whether it is enough and not too much.) > I was able to configure access logs but couldn't find a way to customize > error logs. If there is no way to drop just request, is it possible to drop > complete error logs matching a particular format something similar to what > https://github.com/cfsego/ngx_log_if does for access logs. I think that the error logs are deliberately not configurable (other than by setting the error log level). When something goes wrong, you generally want all of the information available, to be able to see what is needed to make it go right. And when you ask someone else to interpret the error logs, it is convenient if they don't have to guess which pieces are different due to your configuration. Obviously, you're welcome to write (or encourage someone to write for you) your code to do whatever you want. But I think that stock nginx doesn't have this facility, and won't have this facility. f -- Francis Daly fran...@daoine.org _______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx