Wednesday, January 12, 2011

Counting downloads from an RPM repository

My company hosts an open source RPM repository and would like to start counting RPM downloads per day. The repository is hosted on Apache httpd. Can anyone recommend a good way to count the downloads of just the RPM files (which will have URLs of the form http://packages.mycompany.com/packages/continuous/trunk/fedora/10/RPMS/package1.rpm) while excluding any other accesses to the repository URLs for index browsing, etc. ?

  • The simplest answer would be something along these lines:

    grep ".rpm" /var/log/httpd/access_log | wc -l

    This would give you the number of files accessed with .rpm in their name. Simple I know, but effective.

  • If you don't want to go with classic apache log analyzers like awstats or webalizer, you might want to try visitors, a simple CLI log file analyzer.

    visitors -o text ACCESS.LOG | grep " /" | grep ".rpm"

    will give you a list of requested RPMs sorted by popularity with the number of downloads included after the file name. Non-RPM downloads will be ignored, so the order might look a little funny.

    1)    /rpm/example.rpm: 4
    3)    /rpm/example2.rpm: 2
    

    for example.

    From Aaron K.

0 comments:

Post a Comment