Exporting statistics


I would like to know if there is a way to export my statistisc (www.mydomain.com/stats) to any format in my PC.



The raw data that analog (the statistics program) uses is just the access.log under your /logs/domain/http folder. You can use this but you’d have to write some sort of procedure to import it into whichever program you want to use on your PC.

Analog produces a lot of stats and you can edit the list via the control panel.

What are you ultimately trying to do?



I have a podcast in Spanish (www.cabreados.org) and would like to have a record of how many times each mp3 file has been downloaded.

When I access to my statistics in www.cabreados.org/stats I look at the “Request Report”. That’s the information I would like to have all the days in a local file.

Is there any way to extract that information from the access.log or from other place?.



Well it’s a start but…

grep -c ‘.mp3’ /home/username/logs/domain/http/access.log

will produce a total number of the times .mp3 appears in the access.log.

But I suppose you’d want the total number of each .mp3.

You could use grep to list the lines of downloads to a temp file like grep ‘.mp3’ pathto/access.log > tempfile

Perhaps you could get someone to write a small perl program for you to do it or you could google for such a script.

Have a look here to see if you can get any ideas using grep egrep etc.



I’ve thought some more. Might be useless!

If access.log contains a line like:

[07/Mar/2006:06:24:22 -0800] “GET /mp3/song.mp3 HTTP/1.0” 200 - “-” “Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)”

Then a command line like:-

cat pathto/access.log| cut -d’/’ -f4 | sort | uniq > tempfile

Should create a unique sorted list of mp3’s by name.

The cut command uses -d’/’ to mean use a / as a delimiter and -f4 is the fourth field (i.e. counting 4 /'s)so the rest of the command continues from the fourth field and sort sorts the list. If you add the uniq command it removes duplicates. The command list is saved into tempfile.

You might have to jiggle it a bit and change the -f number depending on what your access.log line looks like.