Webhook receiver for taking logs from metriks and sending them to Librato Metrics via a Papertrail webhook.
To get anything useful out of this, you have to already be using metriks.
Once you've done that, setup a logger reporter. For example:
# Setup metriks logger
require 'metriks/reporter/logger'
metriks_logger = ActiveSupport::BufferedLogger.new(Rails.root.join('log/metriks.log').to_s)
metriks_logger.level = Logger::INFO
Metriks::Reporter::Logger.new(:logger => metriks_logger).start
Once you've done that, send the log to Papertrail. The easiest way would be to use remote_syslog:
$ remote_syslog -p <your_papertrail_port> /srv/www/app/shared/log/metriks.log
The easiest way to run this is to grab the code and run a copy on heroku:
$ git clone git://github.com/eric/metriks_log_webhook.git
$ cd metriks_log_webhook
$ heroku create --stack cedar
$ heroku addons:add memcache
$ git push heroku master
$ heroku config:add METRICS_EMAIL=<librato_metrics_email> METRICS_TOKEN=<librato_metrics_token>
Then create a saved search in Papertrail for:
"metriks: "
Create a Search Alert in Papertrail to fire every minute pointed at /submit
.
For instance:
http://holler-mountain-37.herokuapp.com/submit
Once you've done that, you should start to see metrics in your Librato Metrics dashboard.
Copyright (c) 2012 Eric Lindvall
Published under the MIT License, see LICENSE