Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I get Heroku Logs to return only lines outlining errors?

The heroku logs are a great resource to check what happened to your app when things go wrong.. Unfortunately, they also log a great deal of information. Is there some way I can filter the logs just for error messages?

like image 905
jay Avatar asked Dec 22 '11 17:12

jay


4 Answers

Try this:

heroku logs -t | grep 'error'

To get a running list of errors as and when they occur.

The inverted commas around 'error' did it for me.

like image 186
Steven de Salas Avatar answered Sep 23 '22 14:09

Steven de Salas


heroku logs | grep -i error

You can also install the New Relic add-on, which reports detailed error traces. I've heard good things about Loggly, too.

See also heroku - how to see all the logs

like image 35
rkb Avatar answered Sep 23 '22 14:09

rkb


Personally I think that logs aren't the best place to look as the error and the detail are easily missed. I would ensure that my code was raising errors to an external location to ensure that they don't get missed.

There's a number of options ranging from the simple ExceptionNotifier, to more advanced systems such as Airbrake (which is what I use myself).

Not only will these notify you of the errors, but they'll also given you a stack of meta information that you can use.

like image 39
Neil Middleton Avatar answered Sep 23 '22 14:09

Neil Middleton


We manage a high traffic website hosted on Heroku and he combination of NewRelic and Airbrake is such a big #win.

Have you tried these? Totally worth it and Heroku makes it dead easy to integrate them in your app.

like image 24
leonardoborges Avatar answered Sep 22 '22 14:09

leonardoborges