Heroku log drain

Send the logs of a Heroku app to Flowhawk with one HTTPS drain. No add-on and no code change.

Heroku keeps only the last 1,500 log lines of an app. An HTTPS drain streams every line, from the router, your dynos and Heroku itself, to Flowhawk, which reads Heroku's logplex format directly.

What you get

  • Heroku logs in Logs, next to your traces and metrics, searchable with the same query language (severity>=WARN service=checkout "timeout"), grouped into patterns or followed live.
  • A log line that names a request path joins the business flow of that route, so a failing checkout shows its platform logs on the checkout flow's page.
  • A line that carries a trace id opens its trace.
  • Alert on any search with Alert on this, and let the agent read these logs when it investigates an incident.

Router lines carry the method, path and status of every request, so even an app without any other instrumentation shows which flows are failing and how often.

Set it up

First create an ingest key: in the app, open Settings > API keys and pick Services. In the examples below, KEY stands for that key. Keep it out of your repository, like any other secret.

Heroku drains can only be configured with a URL, so the key goes in it as the password. ?service= names the app in Flowhawk:

heroku drains:add "https://drain:KEY@api.flowhawk.dev/v1/logs/heroku?service=my-app" -a my-app

Add one drain to each app.

The same steps, with your workspace's address filled in, are in the app under Settings > Integrations > Log drains.

What arrives

Heroku logIn Flowhawk
Router lines (method, path, status)Joined to the flow and step of that route. A status of 500 or more is an error
Heroku errors (at=error code=H12)Errors, so timeouts and crashed dynos can be alerted on
Your app's linesLogs of the service, with the dyno (web.1) as an attribute. logfmt fields become attributes
level=, trace_id= or traceparent= in a lineThe line's level, and a link to its trace

Common questions

Does the key end up in my logs?

No. Heroku sends it as the basic auth password, and Flowhawk never logs it. Flowhawk does not accept a key in ?key=, because query strings end up in logs.

Can I add traces later?

Yes. Add OpenTelemetry to the app (language guides) and keep the drain. Logs that carry a trace id then open their trace.