Mobile app version of vmapp.org
Login or Join
Dunderdale272

: How can I parse Amazon S3 log files? What are the best options for parsing Amazon S3 (Simple Storage) log files? I've turned on logging and now I have log files that look like this: 858e709ba90996df37d6f5152650086acb6db14

@Dunderdale272

Posted in: #AmazonS3 #Analytics #Logging

What are the best options for parsing Amazon S3 (Simple Storage) log files? I've turned on logging and now I have log files that look like this:

858e709ba90996df37d6f5152650086acb6db14a67d9aaae7a0f3620fdefb88f files.example.com [08/Jul/2010:10:31:42 +0000] 68.114.21.105 65a011a29cdf8ec533ec3d1ccaae921c 13880FBC9839395C REST.GET.OBJECT example.com/blog/wp-content/uploads/2006/10/kitties_we_cant_stop_here_this_is_bat_country.jpg "GET /example.com/blog/wp-content/uploads/2006/10/kitties_we_cant_stop_here_this_is_bat_country.jpg HTTP/1.1" 200 - 32957 32957 12 10 "http://atlanta.craigslist.org/forums/?act=Q&ID=163218891" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.19) Gecko/2010031422 Firefox/3.0.19" -


What are the best options for automating the log files? I'm not using any other Amazon services other than S3.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Dunderdale272

2 Comments

Sorted by latest first Latest Oldest Best

 

@Welton855

We are about to launch Qloudstat which will give you analytics for your S3 account as a service.

10% popularity Vote Up Vote Down


 

@Goswami781

Amazon recommends using AWStats and includes instructions on how to set up an AWStats configuration file. You will also need to set up some method to automate downloading the logs to where your AWStats installation is.

Personally I use cron to set off a Python script that uses boto to grab the files.

"""s3logDL.py

Downloads S3 logs and deletes old logs

Usage: python s3logDL.py"""

import sys
import os
from boto.s3 import Connection
import boto.s3

########################


########################

def main(argv):
s3 = Connection('ACCESS_ID', 'PASSWORD')
logsBucket = s3.get_bucket('logbucket')

for b in logsBucket:
#Download log
print b.name
key = logsBucket.get_key(b.name)
fp = open("/PATH/TO/SAVE/POINT/" + b.name, "w")
key.get_file(fp)

#Delete log
key.delete()

exit(0)


########################

if __name__ == '__main__':
main(sys.argv)

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme