poniedziałek, 27 października 2008

Squid with AWStats

I've search a bit, but couldn't find any nice howto. All links told me to turn on "emulate_httpd_log" or change logformat in squid.conf. Cool, but I've got logs from last month with standard logformat - squid and like to know how much bandwidth at Amazon EC2 will cost.

Lets see, standard squid logs looks like that:

1224992424.377 0 TCP_MEM_HIT/200 1046 GET http://sitename/www/Etrade/js/translation.js? - NONE/- application/x-javascript

With little sed help, logs could looks like that:

1224992424 0 TCP_MEM_HIT 200 1046 GET /sitename/www/Etrade/js/translation.js? - NONE/- application/x-javascript

How ?

LogFile="cat /path/to/log/squid-access_log | sed 's/\.[0-9]\{3\}\s\{5\}//' | sed 's/\// /' | sed 's/http\:\///' |"

Now just few min generate report .. et voila ;)

Brak komentarzy: