2

I see how to view heroku logs live

heroku logs -t

and how to view the last n logs e.g.

heroku logs -n 500

would show the last 500 lines of logs. But the n can only be so large because heroku simply doesn't store them (forever). For example, I tried heroku logs -n 5000 and I get about 1500 lines of logs, but no more.

So suppose I wanted to be able to view logs from farther back, what would I have to do to make them available? Is there some heroku setting/addon I need to implement in order for them to be permanently made available? Or is it the application layer's responsibility to store logs somewhere (e.g. persist them in a database)?

stevec
  • 41,291
  • 27
  • 223
  • 311

2 Answers2

2

Heroku logs retain the last 1500 logging records, that are max 1 week old.

There are several add-ons you can use on Heroku, however they will all have some limitations (max logs, max days) when using a Free Plan.

Papertrail is a good solution I can recommend: nice dashboard for queries and alerting, saved searches, Free plan including the last 7 days logs. When purchasing a plan (starting from 8$ p/month) the limitations are 'relaxed' and you can keep logs for up to 1 year.

Beppe C
  • 11,256
  • 2
  • 19
  • 41
0

Not an answer, but just adding some advice I received in other forums:

  • Papertrail is awesome, it's a log management app (nothing to do with the ruby gem of the same name)
  • Some suggest not worrying about collecting all logs, but simply using something like Sentry so the errors are reported, which saves sifting through all the logs.
stevec
  • 41,291
  • 27
  • 223
  • 311