Vaulstein
Vaulstein

Reputation: 22071

How do I Redirect Heroku Error logs to Slack

What I want to achieve is:

  1. Filter Error logs from Heroku logs
  2. Send only the Error logs to a Slack Channel

I have checked deployhooks but these only work for Deployments and also Heroku ChatOps is also only for Deployments.

Is there a way to constantly tail the logs and redirect the error log to Slack?

One way I can achieve this is using:

heroku logs -t --app app-name | grep "error" > redirect to slack based on webhook

But this requires configuring Heroku cli on a machine and also allowing messages to be posted to slack from that machine. Can this be directly configured to Heroku itself?

Upvotes: 1

Views: 538

Answers (2)

Vaulstein
Vaulstein

Reputation: 22071

As @RangerRanger mentioned there is no way to do this on Heroku without using addons.

I found two add-ons which are easy to configure and allow filtration of logs in real-time and sends messages to slack.

You can use PaperTrail which is easier to configure or use Coralogix which gives you Kibana support.

Upvotes: 0

RangerRanger
RangerRanger

Reputation: 2493

No. Sorry to say that there's nothing baked into the platform to support streaming exceptions/errors to Slack. That said, you should be able to accomplish this a number of ways. Some more work than others.

For instance, on the low-effort ends you can set up Rollbar for the application in question and it looks like Rollbar natively supports a Slack integration. It's more work but you could also build a custom application to more or less pipe things directly to Slack while listening to the log stream.

Upvotes: 1

Related Questions