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?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
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.
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
nginx). The Ubuntu default is rotate for 52 weeks, meaning that logs older than a year are deleted.