Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

An extensible Amazon S3 and Cloudfront log parser.

Project Description

This python module uses the really nice goaccess utility to provide you with an amazing Amazon log file analyser tool that is relatively easy to install, and is extremely easy to extend. GOACCESS version needed: 0.8.5 (it doesn’t work with 0.9+)


pip install s3stat

This installs in your PYTHONPATH in case you would like to run it from the command line.


Install goaccess

You should install goaccess


Cloudfront log file processing requires goaccess 0.7.1+

Generating an AWS user

First you should create a user that has approriate rights to read your log files, and you should have its AWS access keys ready.

  1. Log in to the aws console

  2. Create a new user and select the option to generate an access key for the user

  3. Save the access key and secure keys, as these will be needed soon

  4. Open the Permissions tab for the user, and attach a new user policy. Select custom policy, and copy the following:

      "Statement": [
          "Sid": "Stmt1334764540928",
          "Action": [
          "Effect": "Allow",
          "Resource": [
          "Sid": "Stmt1334764631669",
          "Action": [
          "Effect": "Allow",
          "Resource": [

Set up logging in your buckets

First you should ask Amazon to generate logs for your buckets and cloudfront distributions.

Run this script <aws key> <aws secret> <bucket> <log_path>

This will download all the log files for today, and start a goaccess instance in your console.

For further options you might run: -h


Actually s3stat was designed to be easy to add to your pythonic workflow, as a result it defines a single class that you can subclass to process the results in json format.:

import s3stat

class MyS3Stat(s3stat.S3Stat):

    def process_results(self, json):
        print json

    def process_error(self, exception, data=None):
        print data
        raise exception

mytask = MyS3Stat(bucket, log_path, for_date, (aws_key, aws_secret))

Where the aws_* parameters are optional, if missing then they are taken from the environment variables as provided by boto. The process_error method currently is called only when the JSON decoding fails, thus data is the non-decodeable string, while exception is the ValueError raised by Python.


  • provide a command that adds logging to specified buckets and cloudfront distributions

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(5.7 kB) Copy SHA256 Hash SHA256
Source None May 13, 2015

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting