# Need to exclude file from server logs

**URL:** <https://www.ruby-forum.com/t/need-to-exclude-file-from-server-logs/203540>\
**Category:** NGINX\
**Created:** [February 22, 2011, 4:28pm UTC](https://www.ruby-forum.com/t/need-to-exclude-file-from-server-logs/203540 "2011-02-22T16:28:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 22, 2011, 4:28pm UTC](https://www.ruby-forum.com/t/need-to-exclude-file-from-server-logs/203540/1 "2011-02-22T16:28:36Z")

</div>

Dont know if this is even possible but I have a healthcheck file that is  
checked by a load balancer every 30 seconds. However, I really do not  
want the webserver to be logging this. Is there some way to configure  
the server to ignore a file or directory as far as the logging is  
concerned??

Running nginx 0.7.65 on Ubuntu 10.04

Brian

Posted at Nginx Forum:

> **[Need to exclude file from server logs](https://forum.nginx.org/read.php?2,177477,177477#msg-177477)**
>
> Dont know if this is even possible but I have a healthcheck file that is checked by a load balancer every 30 seconds. However, I really do not want the webserver to be logging this. Is there some way to configure the server to ignore a file or...

---

<div class="post-metadata">

**Author:** ![bindsocket](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/898d66/32.png) [@bindsocket](https://www.ruby-forum.com/u/bindsocket)\
**Post date:** [February 22, 2011, 4:31pm UTC](https://www.ruby-forum.com/t/need-to-exclude-file-from-server-logs/203540/2 "2011-02-22T16:31:43Z")

</div>

once in 30 seconds… Do you really need that?  
Anyway, cat access.log | grep -v “loadbalanced.check.txt” should help  
you.

---

<div class="post-metadata">

**Author:** ![bindsocket](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/898d66/32.png) [@bindsocket](https://www.ruby-forum.com/u/bindsocket)\
**Post date:** [February 22, 2011, 4:34pm UTC](https://www.ruby-forum.com/t/need-to-exclude-file-from-server-logs/203540/3 "2011-02-22T16:34:51Z")

</div>

location = /healthcheckfile {  
access\_log off;  
}  
should do the trick.

Posted at Nginx Forum:

> **[Re: Need to exclude file from server logs](https://forum.nginx.org/read.php?2,177477,177479#msg-177479)**
>
> Dont know if this is even possible but I have a healthcheck file that is checked by a load balancer every 30 seconds. However, I really do not want the webserver to be logging this. Is there some way to configure the server to ignore a file or...

---

<div class="post-metadata">

**Author:** ![bindsocket](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/898d66/32.png) [@bindsocket](https://www.ruby-forum.com/u/bindsocket)\
**Post date:** [February 22, 2011, 4:39pm UTC](https://www.ruby-forum.com/t/need-to-exclude-file-from-server-logs/203540/4 "2011-02-22T16:39:15Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

On 02/22/2011 12:26 PM, bindsocket wrote:

> Dont know if this is even possible but I have a healthcheck file  
> that is checked by a load balancer every 30 seconds. However, I  
> really do not want the webserver to be logging this. Is there some  
> way to configure the server to ignore a file or directory as far as  
> the logging is concerned??
> 
> Running nginx 0.7.65 on Ubuntu 10.04

I don’t know if it’s the best way to configure a healthcheck, but:

```
    location = /healthcheck_nginx.html {
            access_log off;
            root /usr/share/nginx/html;
            index healthcheck_nginx.html;
    }

```

hope this helps.  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.10 (GNU/Linux)  
Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org/](http://enigmail.mozdev.org/)

iEYEARECAAYFAk1j2CUACgkQNRQApncg296c9gCdFQ15ofUwV1lsrqMv72fRcQn2  
0xgAn10L3OT0f2rlvabrOriLz3kYk0UC  
=3UMW  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![bindsocket](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/898d66/32.png) [@bindsocket](https://www.ruby-forum.com/u/bindsocket)\
**Post date:** [February 22, 2011, 4:58pm UTC](https://www.ruby-forum.com/t/need-to-exclude-file-from-server-logs/203540/5 "2011-02-22T16:58:43Z")

</div>

On 22 Fev 2011 15h26 WET, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Dont know if this is even possible but I have a healthcheck file  
> that is checked by a load balancer every 30 seconds. However, I  
> really do not want the webserver to be logging this. Is there some  
> way to configure the server to ignore a file or directory as far as  
> the logging is concerned??

Try: [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/NginxHttpStubStatusModule)

— appa

---

<div class="post-metadata">

**Author:** ![bindsocket](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/898d66/32.png) [@bindsocket](https://www.ruby-forum.com/u/bindsocket)\
**Post date:** [February 22, 2011, 5:04pm UTC](https://www.ruby-forum.com/t/need-to-exclude-file-from-server-logs/203540/6 "2011-02-22T17:04:21Z")

</div>

Thanks all. Access log is much prettier now.  
And as far as the every 30 seconds thing, the suggestion from the server  
was 15 seconds. Probably be changing it to much longer as we are going  
to be doing something else for a health check eventually anyways. Still  
dont want to bother with logging it regardless.  
Just the simple:

location /hc {  
access\_log off;  
}

worked just fine for this application.

Posted at Nginx Forum:

> **[Re: Need to exclude file from server logs](https://forum.nginx.org/read.php?2,177477,177490#msg-177490)**
>
> Dont know if this is even possible but I have a healthcheck file that is checked by a load balancer every 30 seconds. However, I really do not want the webserver to be logging this. Is there some way to configure the server to ignore a file or...

---

<div class="post-metadata">

**Author:** ![bindsocket](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/898d66/32.png) [@bindsocket](https://www.ruby-forum.com/u/bindsocket)\
**Post date:** [February 22, 2011, 9:08pm UTC](https://www.ruby-forum.com/t/need-to-exclude-file-from-server-logs/203540/7 "2011-02-22T21:08:19Z")

</div>

On Tue, Feb 22, 2011 at 12:37:11PM -0300, Flavio Torres wrote:

> > Running nginx 0.7.65 on Ubuntu 10.04
> 
> hope this helps.

“index healthcheck\_nginx.html” is useless here: it’s required for  
requests with trailing slash, but this location works only for  
“/healthcheck\_nginx.html”.

Also “root” probably can be inherited from server level.

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![bindsocket](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/898d66/32.png) [@bindsocket](https://www.ruby-forum.com/u/bindsocket)\
**Post date:** [February 24, 2011, 8:41pm UTC](https://www.ruby-forum.com/t/need-to-exclude-file-from-server-logs/203540/8 "2011-02-24T20:41:56Z")

</div>

I ended up using the root command for this since I wanted to put the  
healthcheck file in a different directory than the root of the main web  
content.

Posted at Nginx Forum:

> **[Re: Need to exclude file from server logs](https://forum.nginx.org/read.php?2,177477,178120#msg-178120)**
>
> Dont know if this is even possible but I have a healthcheck file that is checked by a load balancer every 30 seconds. However, I really do not want the webserver to be logging this. Is there some way to configure the server to ignore a file or...

---

<div class="post-metadata">

**Author:** ![bindsocket](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/898d66/32.png) [@bindsocket](https://www.ruby-forum.com/u/bindsocket)\
**Post date:** [February 22, 2011, 9:08pm UTC](https://www.ruby-forum.com/t/need-to-exclude-file-from-server-logs/203540/9 "2011-02-22T21:08:57Z")

</div>

On Tue, Feb 22, 2011 at 11:02:47AM -0500, bindsocket wrote:

> worked just fine for this application.

If you request exactly “/hc”, then it’s better to use

location = /hc {  
access\_log off;  
}

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**
