Amazon CloudFront Log Processing Using Awstats

The article on Solution Expert Online Blogs gives a great tip on using Awstats for the CloudFront logs. Unfortunately, the suggested change of LogFormat parameter was a good start but wasn’t really working. I’ve found few more issues that had to be fixed:

  • Log separator is the tab character, not space.

  • The first tab separates date and time and had to be converted to space in order to be accepted by Awstats as a single field.

  • Awstats will drop log records if site name doesn’t mach those in your log files.

Here arethe changes I made in my awstats.config to make it work:

1
2
3
4
5
6
7
8
9
LogFile="/path_to/logresolvemerge.pl /path_to/logs/cloudfront_logs/* | sed 's/\t/ /' $

LogFormat="%time2 %cluster %bytesd %host %method %virtualname %url %code %referer %ua"

LogSeparator="\t"

SiteDomain="public.site-domain.com"

HostAliases="REGEX[.cloudfront\.net]"

Hope this helps!

Comments