Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Just thinking here from performance perspective that maybe turning access_log off; for my websites would improve the loading speed (even though it could be very minimal) but yea anyway how could access_log come in handy really cause I have checked the access logs like twice in my life time?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The access_log can be helpful for statistics (it is usually necessary for packages such as awstats or webalizer). Depending on your objectives, you may wish to disable the access_log for small files (e.g. .ico) or based on filename.

For instance, for me, I do not run statistics for static files, and I use nginx as a proxy to apache. Therefore, I disable the access_log for select static file types, as well as for dynamic (php) files (since apache logs those).

The following is a sample of my config file:

    location ~  \.(jpg|jpeg|png|gif|swf|ico|js|css|txt|htm|html|xml|bmp|pdf|doc|docx|ppt|pptx|zip)$     {
        expires     30d;
        access_log off;
        break;
    }

    location ~ \.php$ {
        access_log off;
        proxy_pass   http://127.0.0.1:8080;
    }

In terms of performance, the gains should really be minimal. Nginx is a very efficient web-server, and unless you are really serving a large volume of pages/files, you are unlikely to notice the difference. The possible advantage though is that your logs won't fill up quite as much with entries you are not interested in. Ideally, you should combine a more targeted log (only the entries you want) with log-rotate, so that you can compress and get rid of older log entries.

share|improve this answer
    
Yea, I use nginx as proxy for apache and static server for static content too. I guess I'll disable then the access log. Thanks! –  Richards Jul 4 '11 at 14:18
    
2 quick additional points - i) access logs can be helpful for diagnostics (e.g. if your server is compromised, a particular page is being maliciously targetted etc - it will provide IP data as well as timeline data that can be very helpful. ii) You can disable/enable the logs on a per-directory/per-site basis; for instance, the above configuration is from my 'global' config file. I have other per-site configs that override that, or are more specific. –  cyberx86 Jul 4 '11 at 14:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.