Awstats and web compression

As I mentioned way back in January in the this post, I enabled compression on my website using mod_deflate in Apache2. While searching for something else, I came across the fact that Awstats will report on the compression functionality as well. It took a bit of twiddling, but I got everything to work correctly.

For awstats to generate the statistics, you first have to modify the log format of Apache in a certain way then update the config of awstats. The Apache config looks like this:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" (%{ratio}n)" combined-compress
CustomLog logs/access_log combined-compress
DeflateFilterNote Ratio ratio

The awstats.conf required this change:

LogFormat = "%host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot %deflateratio"

The process was to first stop the httpd server, then update Awstats, next implement the changes above to the config files. Next you must rotate the httpd log files. Then finally restart the httpd server. After all that you are in business and can now update Awstats once again and you’ll see your compression stats

Previous Post
Leave a comment


  1. Hello, I just found awstats and while looking for a logformat line for postfix came across your site. Looks like we fight some of the same battles. But, I have a question for you… Have you incorporated postfix into awstats? and if so, could you share your logformat= line? I’m having a heck of a time getting that to work.


  2. While I don’t currently have the mail portion of awstats running on this box, I do (did) have it running on a box at the office. The following config options were for awstats 6.0 running with postfix-1.1.12. It worked well then, but I have not tested with postfix 2.0 or awstats 6.1 (I know that there have been changes to the program in 6.1 which is still in beta). Hope these help.

    LogFile=”perl /usr/local/awstats/tools/ standard < /var/log/maillog|”

    LogFormat=”%time2 %email %email_r %host %host_r %method %url %code %bytesd”

  3. Wow, thanks for such a quick response. I’ll try that and see what happens. As a side item, looking through your blog, the topics you talk about kind of parallel the ones I talk about. So, When I get back to the house I’ll put you in my blogroll so people can get to your site from mine.

    Thanks again,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: