Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using oink gem with heroku

I've installed oink gem for monitoring the memory usage of my rails application. In order to see oink report I need to run this command in the terminal:

oink --threshold=75 /log/*

When I run it on my machine it shows the report for the development environment. The thing is that I'm more interested on seeing the report for my production environment. My app is hosted on heroku, is there a way I could run oink's terminal commands for the heroku's production environment?

Thanks

like image 623
Oded Harth Avatar asked Jan 24 '12 11:01

Oded Harth


1 Answers

I got oink working on heroku doing this:

You have to change your log_level to info for the oink logs to show up:

heroku config:add LOG_LEVEL=info

Add oink middleware to production.rb with a custom stdout logger

config.middleware.use( Oink::Middleware, :logger => Hodel3000CompliantLogger.new(STDOUT))

When you want to parse your logs, tail them to a local file, then remove heroku's prefix and filter to only the oink lines.

heroku logs --tail > log/production.log
cat log/production.log | cut -c 46- | grep 'Oink\|Memory\|Instantiation' > log/production-oink.log

Then run oink on your new local log

oink --threshold=0 log/production-oink.log

You could also download logs from logentries or paperclip

like image 180
Gabe Coyne Avatar answered Nov 01 '22 08:11

Gabe Coyne