Access to heroku logs without access to app itself - heroku

Say, i have a team of developers. I want them to have access to production logs, but nothing else. Preferably they shouldn't even know the heroku's internal app name.
How do i do that?

I don't think it's possible (at the moment) with Heroku command line. You have two options:
Use one of the logging addons and give your teammates access to the logging app only
Write yourself a log drain for Heroku logplex route the logs to AWS S3, your own DB or other, then give your teammates some way to view the logs.

Related

Is there a Heroku webhook for Heroku Postgres credential rotation?

I'm following the instructions in the Heroku Postgres docs for creating an external application that connects to Heroku Postgres for its data layer. The instructions mention that the credentials are automatically rotated and I must handle this myself.
I read more docs to learn about webhooks existing to help notify the rest of your system that changes have happened in your Heroku services. This made sense to me to be an area where the Heroku devs would have implemented this. There must be a webhook that exists that I could use to be notified when the credential rotation happens. I found that there was the api:addon webhook which had the update event. I tested this webhook, expecting this to be what I was looking for, but I found that it was not fired upon credential rotation. It was only fired when I provisioned or deleted more Heroku Postgres add-ons.
Since the webhook I need doesn't exist, I coded a workaround where I expect a PostgreSQL library auth error to be thrown while my AWS Lambda executes. If an error is thrown, I assume it's from the rotation and I have the still running Lambda function fetch new credentials using the Heroku API and try the PostgreSQL query again, at which point it works unless there are other errors. I tested this while manually rotating my credentials and it worked okay, but it's kind of ugly code. See here for a detailed example.
So at this point, I'm wondering if the webhook I'm looking for does exist and I just wasn't able to find it. Or, if it doesn't exist, I would like to request it as a new feature. I understand that the Heroku team may not want people picking their add-ons a la carte, and they want people to use the entire Heroku platform, but I think it would add a lot of value to the Heroku platform. Personally, I've enjoyed getting into more and more cloud services as I learn since I'm usually able to choose them a la carte. For example, AWS doesn't forbid me from only using S3 and nothing else from them. They do as much as they can to make it easy for me to link my applications to it, no matter what other cloud services I use.
I contacted Heroku directly to ask if this type of webhook existed and I received a useful response from them:
There isn't a webhook specifically for credential rotations, although
with a bit of logic you can sort of recreate the same thing. Whenever
you Postgres credentials rotate, it will trigger a new release, which
does trigger a webhook. You can use that to inspect the release via
the API to determine if the values changed.

Heroku logs cluttered

I just started using Heroku for one of my node apps.
When I run the heroku logs command it is so cluttered that i cant pick out the data I want from all the other information I don't need.
Is there a way to clean up that log output so it's more human friendly?
It's like it just dumps a wall of text at me.
Thanks!
I am using Papertrail add-on on Heroku for viewing the logs.
It has a free plan which is enough for small application. It gives you flexibility for searching your logs by text and time. A browser URL is provided by Papertrail to view the logs, which is convenient to access from mobile also. Adding this add-on to your application is quite simple, no app changes are required. Below filters are available out of the box on its dashboard to view the logs-
All events
Deploys
Dyno state changes
Platform errors
Web app output

Same add-on for multiple Heroku apps

What are the best practices with Heroku add-ons? I manage multiple Heroku apps. I want them to share a common add-on. how to do that?
For example, first I signed up for Mandrill on their website. When I added Mandrill add-on on Heroku, they created a new Mandril account for me. I wanted to merge them but Mandril support said that they can't merge accounts!
Another example, I added Logentries add-on to one Heroku app. A Logentries account was created. Then I added another Logentries add-on to another Heroku app, then another Logentries account was created.
It's getting messy. Am I doing it right? How to make several Heroku apps share one add-on account?
Sharing add-ons between apps is possible.
Once the add-on is added to one of the apps, an environment variable will be created containing the account information. You can copy the variable to other apps and they will start sharing the same 3rd party resource.
The add-on will remain listed only under the first app, where it was initially added, but this will not prevent the other apps to use it.
In the general case it isn't possible to share add-ons between Heroku apps. However with some specific add-ons this is possible, depending on the add-on.
For example with Logentries you can have one Logentries account and then configure each Heroku app to send its logs to Logentries via a syslog drain.
https://logentries.com/doc/heroku/ (See the "Alternatively: Point your syslog drain to Logentries" section)
To set up syslog drain, you have to create a new log in Logentries UI
with the source type “Syslog TCP, UDP” (select Hosts, then click on a
button in right top corner). Logentries will assign you a port number
PORT and set the log in discovery mode to match your log with source.
Then, let Heroku know where to send you log entries. Add a Heroku
syslog drain and point it at api.logentries.com:PORT:
heroku drains:add syslog://api.logentries.com:PORT
Yes, you're doing it right. Each Heroku app is a separate instance and will get its own add-ons. There is no way to share add-ons across multiple Heroku apps, as far as I know.

Restore a Redis To Go DB on Heroku

Has anyone been able to restore a Redis DB on Heroku? They have instructions for regular accounts, but the "Edit" option is not available through the Heroku dashboard.
http://support.redistogo.com/kb/info/restore-from-a-backup
I beleive we worked on this through the Redis To Go support site I will still answer for others. This feature is only for Direct accounts, Redis To Go is working on releasing the same options for heroku add-on accounts, but for now switching to a direct account is fastest. If you are hooked on heroku, making a support request support.redistogo.com to have your back-up uploaded by the support staff is also an option for you!
-Morgan

Heroku web UI log viewer

I wonder if there is a more friendly way ( using some GUI) to view Heroku application's logs than through a console?
I think papertrail (heroku addon) is the best option, it is similar to console logs, with search, and you can achive the logs daily to amazon S3.
Not at the moment.
You can however use the logs drain add-on to pipe your applications to a running syslog on a separate server, like outlined in the heroku docs.
After that, you could use a tool like Splunk to analyze your logs in a nice Web UI.
Hope this helps.
The Loggly Heroku add-on might be a good option.

Resources