Project

s3_log

0.0
No commit activity in last 3 years
No release in over 3 years
Log misc events to Amazon S3
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.2.0

Runtime

~> 0.1.1
 Project Readme

S3Log

Naively log events to a file on S3

Gem Setup

gem install s3_log

# Gemfile
gem 's3_log'

Configuration

S3Log requires an AWS access key id, AWS secret access key, and a S3 bucket (preferably created in advance) name to function. It can be configured (in a Rails initializer or what have you) like so:

S3Log.configure(
  access_key_id: 'YOUR AWS ACCESS KEY ID',
  secret_access_key: 'YOUR AWS SECRET ACCESS KEY',
  bucket: 'YOUR S3 BUCKET'
)

Usage

Basically, logging an event is a matter of using S3Log.write to write content to a given file location on S3. The file does not have to exist prior to writing, and a write always appends to an existing file.

S3Log.write('path/to/file', 'Some content')

Caveats

There is no locking in this process, and an existing file will always be read and appended rather than blindly replaced. That being the case, near-simultaneous writes are won by the most recent write, and you would do well to do one of the following to avoid data loss:

  • Ensure that only one process writes to a given file at a time
  • Use a new file path for each write (ie models/user/1/TIMESTAMP.log rather than models/user/1.log)

Formal Documentation

The actual library docs can be read over on rubydoc.

Contributing

Do you use git-flow? I sure do. Please base anything you do off of the develop branch.

  1. Fork it.
  2. Perform some BDD magic. Seriously. Be testing.
  3. Submit a pull request.

License

MIT License. Copyright 2015 Dennis Walters