Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am pretty new to awstats and have configured Awstats on my apache webserver to analyze nginx access logs(nginx webserver is for my django app), I am able to take the stats from LogFile=/var/log/nginx/access.log but how do I analyze multiple Logs that are gzip format. Such as access.log.1.gz...access.log.40.gz. I have a lot of logs to analyze.

share|improve this question
up vote 23 down vote accepted

What you probably want to do here is to analyze all these logfiles once, then keep analyzing only the current logfiles from then on.

The simplest thing to do is unzip all those files into a single file, then have awstats run over it once, then point awstats at your access.log file from then on.

awstats normally has a script called, which can read the compressed files, and will merge them appropriately for awstats to do analsyis.

To merge all your existing ones, run

perl /usr/share/awstats/tools/ /var/log/nginx/access.log* > /tmp/nginx.tmplog

This will probably take a while.

You can then have awstats run once over this file (set LogFile appropriately).

From then on, you should have awstats run over the most recent logfile - which is what your current configuration is doing.

Depending on how often you are running awstats vs rotating nginx logfiles, you may want to have it read both the current logfile and the previous one. (eg, if you rotate nginx logfiles every day at 12, but have awstats run every day at 1, then whenever awstats runs the logfile will only contain what's been written since the last rotation). You can use inside your LogFile command like this:

LogFile="/usr/share/awstats/tools/ /var/log/nginx/access.log /var/log/nginx/access.log.1.gz |"

This tells awstats to run the command with the two logfiles as parameters, and awstats will read in the output of that script (that's what the pipe | does)

share|improve this answer
I didn't know the awstats script could handle pipes in the config file. Nice+1. – d-_-b May 22 '13 at 4:37
Agreed - piping output to awstats is a great solution. – Jez Oct 10 '13 at 20:33
about piping, see… – brauliobo Aug 14 '15 at 0:11

Alternatively, you can use a real-time log analyzer, such as GoAccess. It's really fast and you don't need to unzip any log. apache & nginx

zcat -f access.log* | goaccess -a -s -b


zcat access.log.*.gz | goaccess -a -s -b
share|improve this answer

Your Answer


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.