# Disable logging for certain response

**URL:** <https://www.ruby-forum.com/t/disable-logging-for-certain-response/220470>\
**Category:** NGINX\
**Created:** [June 11, 2012, 8:47am UTC](https://www.ruby-forum.com/t/disable-logging-for-certain-response/220470 "2012-06-11T08:47:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [June 11, 2012, 8:47am UTC](https://www.ruby-forum.com/t/disable-logging-for-certain-response/220470/1 "2012-06-11T08:47:32Z")

</div>

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 K.  
Systems Developer | M247 Limited  
Internal Dial 2210 | Mobile +44 7970 621236
