# Memcached logging and setup question

**URL:** <https://www.ruby-forum.com/t/memcached-logging-and-setup-question/210561>\
**Category:** NGINX\
**Created:** [August 10, 2011, 10:00pm UTC](https://www.ruby-forum.com/t/memcached-logging-and-setup-question/210561 "2011-08-10T22:00:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [August 10, 2011, 10:00pm UTC](https://www.ruby-forum.com/t/memcached-logging-and-setup-question/210561/1 "2011-08-10T22:00:47Z")

</div>

Hello fellow Nginx-ers,

We have our nginx server set up with a “maintenance mode” (for  
upgrades) that will display an error page until the maintenance mode  
is turned off.

However, I’d like memcached to bypass this and serve anything it has  
cached even when the maint mode is on. So I’ve made the following  
modification (moved the if statement), which doesn’t seem to work:

# maintenance mode old setup

# if ( $maintenance ) { return 503; }

location / {

```
     if ($request_method != GET) {
        proxy_pass http://backend;
        break;
     }
    default_type "text/html";
    set $memcached_key "http://<SERVER_NAME>$uri";
    memcached_pass <SERVER_IP>:<MEMCACHE_PORT>;
    error_page 404 502 = @cache_miss;

```

}

location @cache\_miss { proxy\_pass [http://backend](http://backend);  
# new maintenance mode if statement location  
if ( $maintenance ) { return 503; }  
}

Now, when the maintenance flag is set, nginx returns 503 for  
everything, as if it were missing the cache every time.

Any suggestions?

Also, is there a way for me to enable nginx logging of these memcached  
results? For debugging I’d like to be able to see hits, misses, keys,  
etc.

Thanks!

Joel
