Getting Heroku logs for past few weeks - heroku

I'm trying to get the production logs for the past few weeks off of heroku but when I do heroku logs, it just returns a few lines showing the production log for today.
Any way to get heroku logs for the past few weeks?
Thanks.

Any number up to 500 lines can now be retrieved using the -n flag.
heroku logs -n 420
As well you can also run:
heroku logs -t
And let that run for a while.
EDIT: And you can use third party tools like papertrail. See : papertrail link

(Correcting my own old response) Previously, Heroku only provided you with access to the last 100 lines. Now this limit apppears to have been raised.
There's also this pretty cool sounding logentries addon, with generous free offerings.

Not sure about going back given their limitations - but going forward you can forward your logs to an external syslog server.
Syslog drains - Premium Add-on

Related

Heroku Connect: Extend Error Log Duration, and UNABLE_TO_LOCK_ROW error

I'm not too familiar with Heroku Connect so excuse me if these are newbie questions.
Is there a way to view Salesforce Error logs beyond a day old? I get the email notification for errors writing to Salesforce but if I don't check on them within a day, I can't access them anymore.
If the problem is "UNABLE_TO_LOCK_ROW", should we configure for the Retry stated here: https://devcenter.heroku.com/articles/heroku-connect-faq#can-i-retry-records-that-failed-to-write-to-salesforce ?
Thanks
In case of writes toward Salesforce, all the changes are kept into Postgres: on the _trigger_log table once occurred and then moved to _trigger_log_archive once processed. On demo plan these records are preserved up to 7 days, on paid plan up to 30 days. You can then look at the archive table to have more insights of the failure and manually resubmit the change, as explained in the link you have mentioned.

Heroku get logs of particular date

I am using Heroku and now i need to see old logs by date.I googled but i didn't got any solution .any one know how to get logs of particular date ?
heroku logs --app myproject -n 200000
also tail command i tried
heroku logs --source app --tail
But above command only return max of 1500 lines even if i increase then i get only 2k lines.
Even i read document
https://devcenter.heroku.com/articles/logging
The Heroku Logplex only stores the last 1500 log lines from your application dynos and add-ons. To store and search logs long-term, you'll need to stream your logs to an external service provider. Heroku provide many logging add-ons: https://elements.heroku.com/addons, or you can use your own service by setting up a log drain: https://devcenter.heroku.com/articles/log-drains.

tailing aws lambda/cloudwatch logs

Found out how to access lambda logs from another answer
Is it possible to tail them? (manually pressing refresh is cumbersome)
Since you mentioned tail-ing, I'm expecting that you are comfortable with working on the terminal with CLI tools.
You can install awslogs locally and use it to tail Cloudwatch.
e.g.
$ awslogs get /aws/lambda/my-api-lambda ALL --watch --profile production
Aside from not needing to refresh anything anymore (that's what tail is for), I also like that you don't have to worry about jumping between different LogGroups (unlike in the CloudWatch console).
Aside: We've noticed that tailing logs gets really slow after an AWS Lambda Function has had a lot of invocations. Even looking at logs through the AWS Console is incredibly slow. This is because "tail" type utilities need to connect to each log stream. Log events get expired due to the policy you set on the Log Group itself, but the Log Streams never get cleaned up. I made a few little utility scripts to help with that:
https://github.com/four43/aws-cloudwatch-log-clean
Hopefully that save you some agony over waiting for those logs.
Actually, there is a better way with Insights (in the same CloudWatch).
Run query like on a log group and you will get what you want:
fields #timestamp, #message
| sort #timestamp desc
| limit 20
You can also add it to Dashboard to always have it "nearby"
If you are using the awscli
From the command line you can also do:
aws logs tail <your_log_group_name> --follow
The --follow flag will pull for new logs continuously
You can also use --since to set from what time to begin displaying logs
It supports:
s - seconds
m - minutes
h - hours
d - days
w - weeks
i.e
aws logs tail <your_log_group_name> --since 20m

parse server 502 bad gateway after 1st request

I've made some research (googled and search stackoverflow) for this issue.
My local parse works perfectly, but when I'm using pm2 on hosting, I'm having 502 bad gateway after doing successful 1st request to Parse.
How to resolve this issue? Thank you.
Very simple fix i think, because its a common fault with PM2 and parse-server. When you print the PM2 logs you will see that there is restart taking place due to PM2 wanting to write to the parse-server logs.
To avoid that, you can totally disable this behavior (watch: false) or just ignore the logs and hidden PM2 directories via ignore_watch.
eg:
"watch" : true,
"ignore_watch" : ["node_modules", "logs"]
Then restart parse-server and you should be good to go.
If its not that,then set VERBOSE = 1 and print the logs and post it here.

How does Redis client/connection limit work on Heroku RedisCloud?

So, I have a Java app on Heroku that uses RedisCloud addon.
The addon clearly states that the free version comes with a maximum of 30 Connections:
The problem is that Im getting this error:
ERR max number of clients reached
So the first thing I did obviously was check the RedisCloud monitor and to my surprise, It establishes a limit of 10 Connections:
The question:
Why are we getting a connection limit of 10 on RedisCloud when the limit on the Heroku addon says it should be 30?
It appears that your add-on is using an old version of the plan from before we launched our Bigger and Imporved XXXL Free plan earlier this year.
The easiest way to resolve that is to use the Heroku toolkit belt and run the command:
heroku addons:upgrade rediscloud:30 -a <your app's name>

Resources