Welcome! Log In Create A New Profile

Advanced

disable logging for certain response

Richard Kearsley
June 11, 2012 02:48AM
Hi
I am using nginx lua to return a 302 for certain requests - probably about 50% of total requests

e.g. (lua code)

if (res.status == ngx.HTTP_MOVED_TEMPORARILY) then
local loc = res.header["X-Location"]
if (ngx.var.is_args == '?') then
loc = loc .. '?' .. ngx.var.args
end
return ngx.redirect(loc)

The other 50% are processed normally and a full reponse is returned

I do not need to log the 302 responses, and indeed it is causing a much waste of processor time when I come to analyse/process the logs (this is 100s of gigabytes of logs per day - so is a HUGE waste)

Is there any way to set a var prior to returning the 302 which will cause nginx not to log it?

Richard Kearsley
Systems Developer | M247 Limited
Internal Dial 2210 | Mobile +44 7970 621236

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

disable logging for certain response

Richard Kearsley June 11, 2012 02:48AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 172
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready