# Conditional logging

**URL:** <https://www.ruby-forum.com/t/conditional-logging/209381>\
**Category:** NGINX\
**Created:** [July 13, 2011, 12:30am UTC](https://www.ruby-forum.com/t/conditional-logging/209381 "2011-07-13T00:30:53Z")\
**Posts on this page:** 2\
**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:** [July 13, 2011, 12:30am UTC](https://www.ruby-forum.com/t/conditional-logging/209381/1 "2011-07-13T00:30:53Z")

</div>

Hello,

My app has lots of image files, and client requests for these images are  
bloating up the access log a lot.

I was wondering if there is a way to log conditionally; for example, if  
there is a request for an image file and it is processed with code 200,  
don’t bother logging it.

Is this possible?

Thanks

Posted at Nginx Forum:

> **[Conditional logging](https://forum.nginx.org/read.php?2,212305,212305#msg-212305)**
>
> Hello, My app has lots of image files, and client requests for these images are bloating up the access log a lot. I was wondering if there is a way to log conditionally; for example, if there is a request for an image file and it is processed with...

---

<div class="post-metadata">

**Author:** ![Mushin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/df788c/32.png) [@Mushin](https://www.ruby-forum.com/u/Mushin)\
**Post date:** [July 13, 2011, 1:10am UTC](https://www.ruby-forum.com/t/conditional-logging/209381/2 "2011-07-13T01:10:19Z")

</div>

Look here [1] for the line location ~\* ^.+.(jpg|jpeg|gif)$ {  
and here [2]

[1] [http://wiki.nginx.org/FullExample2](http://wiki.nginx.org/FullExample2)  
[2] [Module ngx\_http\_core\_module](http://wiki.nginx.org/NginxHttpCoreModule#location)

Am 2011-07-13 00:30, schrieb Mushin:
