A tiny server implementation that collects and aggregates logs generated by your application.
- Ruby 1.9.1 or higher
- MongoDB 1.8.x or higher
- Async web server (e.g. thin)
Set up and start server (rake test
is optional)
git clone git://github.com/giraffi/giraffi-applog.git giraffi-applog
cd giraffi-applog/
gem install bundler
bundle install --path vendor/bundle
mongod --nojournal --dbpath ~/mongodb-xxx-xxx_xx-2.0.0/your-dbpath
rake test
bundle exec rackup -s thin -p 3000 config.ru
Post logs to the server
curl -v -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{"applog":{"message":"foo bar hoge","time":1317623935,"type":"app","level":"debug"}}' http://localhost:3000/applogs.json
Retrieve logs from the server
curl -i -X GET -d 'message=bar&level=debug' http://localhost:3000/applogs.json
It may be better to post and retrieve logs with node-giraffi if your app is running on node.js.
Getting started with Heroku and MongoHQ
First, create your domain and repository on Heroku.
cd giraffi-applog/
heroku create
Created http://meetings-are-toxic-77.heroku.com/ | git@heroku.com:meetings-are-toxic-77.git
And configure server.rb
for connecting to your database running on MongoHQ.
Mongoid.configure do |config|
## Please change params below according to your environment.
## The settings below are for MongoHQ
host = 'staff.mongohq.com'
port = 10099
db_name = 'hq_database'
username = 'hq_username'
password = 'hq_password'
config.master = Mongo::Connection.new(host, port).db(db_name)
config.master.authenticate(username, password)
config.persist_in_safe_mode = false
end
azukiwasher, Github