Unfortunately I can't comment yet but in case someone else has this issue a few things seem to have changed since Gabe Coyne's (super helpful) answer above. I didn't need to change my heroku log_level, so to start generating the logs you can just use an initializer config/initializers/oink.rb
like so:
YourApp::Application.middleware.use( Oink::Middleware, :logger => Hodel3000CompliantLogger.new(STDOUT))
Or put that line in production.rb
if you only want the oink logs in production. Then you need to get the logs into a local log file, also mentioned in the previous answer:
heroku logs n500 --app app_name > log/production.log
Or you can grab them from Papertrail or your favorite log archiver. The local logs need to be updated to the format that oink expects, but I found that grep 'Oink|Memory|Instantiation'
didn't work as that string seems to have been removed from the logs, so I used this instead:
cat log/production.log | cut -c 46- | grep 'rails\[' > log/production-oink.log
Then you can use oink --threshold=0 log/production-oink.log
and it will work.
The only other thing that caught me up was the number of preceding characters to cut. Whereas cut -c 39-
seems to have worked before, I had to use cut -c 46-
. Obviously this varies, so in case its not obvious, you are just trying to get the lines in the raw logs that look like this:
2013-07-19T18:47:09.494475+00:00 app[web.1]: Jul 19 18:47:09 24ab5d5s-g46c-2d44-dss2-233sdfa99852wd rails[5]: Oink Action: welcome#about
To look like this:
Jul 19 18:47:09 24ab5d5s-g46c-2d44-dss2-233sdfa99852wd rails[5]: Oink Action: welcome#about
With the front part removed. Hope this helps!