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

Does it slow down a website if your webserver (in my case, nginx) is writing to an access log?

I'm mostly wondering if it's noticeable.

Plus, what's the point of knowing the user agents / ips that have visited?

share|improve this question
add comment

2 Answers 2

up vote 5 down vote accepted

I don't believe you will notice any hit in performance. Log writes will likely be buffered and then flushed out to disk. So unless you have high disk load you will be fine. If you do have high disk load than you probably want more memory (if this is only a webserver) so web data is served from a memory cache.

Nginx is programmed with an event driven methodology so log writes shouldn't block the serving of pages. I imagine threaded / forking web servers probably use a different thread or process for this as well.

You could also send logs to an external host with syslog (or perhaps even using a Nginx directive).

User-Agents help you know where the traffic comes from and the browser. Good crawlers will set a UA like "Googlebot" and browsers should be specified in the UA. IPs also help identify traffic sources. You will want this information if you ever want some analytics from the logs with something like awstats.

share|improve this answer
add comment

Compared to the resources necessary to process a request, the writing of one line of log is usually not a big deal and the file is opened once (Unless you are the victim of some DOS attacks, where the log - written to the disk after a number of accesses - will keep your machine pretty busy).

Regarding the logs, I keep my Nginx outputs to make some statistics (where are the accesses, from which country, which browser etc...).

If you don't need them, and/or worry about the disk space they take, check the logrotate configuration for nginx (should be in /etc/logrotate.d, file nginx). The Ubuntu default is rotate for 52 weeks, meaning that logs older than a year are deleted.

share|improve this answer
add comment

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.