awstats

How can I direct awstats to count exe and dmg files as downloads?


Awstats apparently counts .exe and .dmg files as page views, instead of as downloads. I would like it to count them as downloads instead. How can I achieve that? How does Awstats determine whether something is a page view or a download?

I know about the extra section support, but I don't want a separate section, as I have downloads of many different types on my site, most of which are correctly listed as downloads. I would just like for .exe and .dmg files to appear there as well.


Solution

  • I figured it out myself by reading the code. It turns out that this information is in the mime.pm reference file which awstats reads at startup. On my Ubuntu system this file is in /usr/share/awstats/lib. It contains lines like this:

    'ini',['conf',''],
    'dtd',['dtd',''],
    # Program
    'exe',['runtime',''],
    'jnlp',['jnlp',''],
    

    It maps extensions to a family and a file type, which can be empty or p for a page, i for an image or d for a download. It's easy to change the file type here, and to add missing extensions. I just changed the '' next to 'exe' to 'd', and added a line for the dmg type.

    You'll have to reprocess your log files if you want to fix your existing statistics.