Automated Log Imports FROM Amazon S3


I’m interested in coming up with a script or process that would take my bucket logs from Amazon S3 Storage, transfer them to my local server (where Piwik resides), and import them on a daily basis.

Is there anything out there like that already? I’ve searched quite extensively but had no luck.

I’m guessing the script would be as follows:

  1. Log into s3 via a CLI tool and compare the contents of my ‘logs/’ bucket with already parsed records (To avoid duplicate entries).

  2. Download unparsed logs into local subfolder

  3. Call the Piwik’s log importer script to parse the new log files

  4. Delete logs that have already been imported.

This script should ideally run daily, but manually when required. I’m thinking a CRON job would achieve that.

While i might know the process, I don’t know the syntax, so any help would be appreciated. I currently pay for s3stat, but they don’t offer me the features of Piwik.

Thanks so much!