Heroku logging: Logplex, heroku logs, and log drains

Read and filter Heroku logs, understand Cedar Logplex retention and Fir OTLP differences, and forward logs through a receiver that handles framing, retries, and application identity.

Best practices
Illustration of event records and log data analysis

An empty router filter does not necessarily mean the router produced no logs. On Heroku Cedar, router is the component in heroku[router]; the source is heroku. That distinction matters both when tailing an incident and when mapping a drain into a log platform.

Cedar generally uses Logplex to combine application, router, and platform log streams. It provides transport and a short history buffer. Fir uses OpenTelemetry/OTLP instead, has no equivalent log history, and does not use Logplex. Shield Spaces with Private Space Logging are another exception. This guide focuses on Cedar's Logplex and log drains, with generation differences called out where they change the procedure.

The logs and commands below are documentation examples. No live Heroku application was queried or drain configured. See Heroku Logging and Heroku Telemetry.

The essentials

  • Logplex is transport, not long-term storage. Applicable Cedar apps retain at most the latest 1,500 lines, and entries expire after one week. The first limit reached removes the older data; 1,500 lines do not represent an approximate week's worth of traffic.
  • Keep source and dyno separate. Application output generally uses app; Cedar platform components use heroku. router is the dyno/component field. Build logs have their own build records, so the runtime stream is not every log the platform has.
  • Start with heroku logs --tail. Cedar supports source/dyno filtering and a limited history with --num. Fir has no history, and heroku logs defaults to a live tail.
  • Match the receiver to the generation. Cedar HTTPS/syslog drains and Fir OTLP telemetry drains use different protocols. Framing, fields, failures, and delivery gaps need deliberate handling.

1. Understand the Logplex envelope

On Cedar, collected stdout/stderr, router requests, and platform events enter Logplex. This synthetic example shows the CLI display format, not an HTTPS drain request body:

2026-08-25T14:55:22.123+00:00 heroku[router]: at=info method=GET path="/api/orders" host=example.com request_id=7f3a status=200 ...
2026-08-25T14:55:22.456+00:00 app[web.1]: INFO Order created {"order_id":1024}
2026-08-25T14:55:30.000+00:00 heroku[web.1]: Restarting

After the timestamp comes source[dyno], then the message. The second message appends JSON to ordinary text; the whole line is not a JSON object. Logs also arrive from multiple nodes, so delivery order need not match event-time order.

Logplex history is bounded by both 1,500 lines and one week. A busy application can replace old entries quickly. Configure a logging add-on or log-drain backend before relying on long-term search. Fir's OTLP telemetry path does not inherit that history buffer.

2. Tail and filter with heroku logs

These examples target a Cedar app named my-app. Substitute the application you are authorized to read:

heroku logs --app my-app --tail                         # Follow new logs
heroku logs --app my-app --num 500                      # Read up to 500 recent buffered lines
heroku logs --app my-app --source heroku --dyno router   # Select the router component
heroku logs --app my-app --source app                   # Select the app source
heroku logs --app my-app --dyno web.1                   # Select one dyno
heroku logs --app my-app --source app --dyno worker.1 --tail

Use --source heroku --dyno router for request status and routing durations, then inspect application records with --source app. Platform crash information and applicable runtime events such as R14 belong in the heroku source. Cedar returns 100 lines by default; --num can request at most 1,500, without recovering entries already removed. A live tail is not an archive either, and it closes after one hour of inactivity.

On Fir, heroku logs defaults to tailing. Use heroku logs --app my-fir-app --process-type web to filter a process type. Internal platform sources have a heroku- prefix, such as heroku-router. Cedar's web.1 naming, source values, and historical-query behavior do not transfer unchanged. CLI filtering

3. Five practices that make logs usable

  1. Write to stdout/stderr. A file is not automatically part of the platform stream; configure the framework or an explicit forwarder. File output does not disappear immediately just because it is a file, but a dyno's ephemeral filesystem is not reliable long-term storage.
  2. Structure the message and configure parsing. JSON or logfmt helps when the receiver understands it. Handle Heroku's envelope separately from the application payload rather than expecting every field to appear automatically.
  3. Carry context. Record appropriate user identifiers, request_id, and business-event fields, with minimization and redaction. An HTTP request ID is not automatically an APM trace_id.
  4. Separate severity from component errors. Use INFO for appropriate business events and ERROR for failures. Router H12 and runtime R14 describe different components and conditions; neither proves a root cause by itself.
  5. Keep credentials out of logs. Avoid passwords, usable authentication credentials, and full card numbers, and handle user data under the applicable policy. Keep application authentication credentials separate from drain-identification values in the receiver configuration.

4. Forward logs with a drain

Adding a drain changes a Cedar application's configuration. Prepare a compatible receiver, then replace the example URL and app name. These commands were not run for this guide:

# Cedar HTTPS drain configuration example
heroku drains:add https://logs.example.com/heroku --app my-app
heroku drains --app my-app          # List configured drains

Cedar supports HTTPS and TCP syslog drains, including TLS syslog. Syslog uses octet-counting framing. HTTPS sends batches in a POST body with content type application/logplex-1, also framed by byte length. It is not a JSON array, and splitting only on newlines is unsafe. Heroku's HTTPS variant also omits part of the standard syslog structure, so an arbitrary RFC 5424 parser is not necessarily compatible.

Validate Logplex-Msg-Count, retain Logplex-Frame-Id to identify retried batches, and map Logplex-Drain-Token to the configured application identity. A non-2xx response or network failure can trigger a retry and duplicates. Follow the documented response contract: no response body and Content-Length: 0. Decide whether acknowledgement means received, durably stored, or indexed. Logplex uses best-effort delivery and can discard entries when its finite buffers overflow.

Fir exports OTLP through telemetry drains managed with heroku telemetry. It is a different path, not the same Logplex HTTPS configuration with another destination URL. Heroku log drains

Check the receiver's actual format

With an authorized test application, compare batch counts, parsed frames, and indexed events. Preserve application identity, dyno, Heroku source, and event time. A shared endpoint can maintain a configured mapping from drain token to application; deleting and recreating a drain changes that token. The literal source app cannot identify which application sent the record. Keep event time separate from reception time to examine ordering and delay.

DataKit Log Streaming provides an HTTP log-ingestion endpoint for Guance, but it is not documented as a native Heroku Logplex-drain receiver. A compatible receiver needs to unpack the batch and convert it into a documented input format and fields. For example, preserve context in heroku_app, heroku_source, and dyno. These are mapping examples, not automatically generated built-in fields. DataKit's source identifies the log collection source/measurement; it is not interchangeable with Heroku's source field.

Then check event-time parsing, persistence and retry boundaries, deduplication, and overflow alerts. The existence of an HTTP endpoint does not prove reliable end-to-end indexing. Fir OTLP compatibility requires a separate check of supported signals, transport, and endpoints on both sides; a Logplex adapter does not establish it.

Common questions

How long does Heroku keep logs?

For Cedar apps using Logplex, the latest 1,500 lines are retained and entries expire after one week, whichever limit is reached first. Yesterday's events might remain or might already be gone. Fir has no history; Shield Spaces with Private Space Logging do not offer the same CLI history either. Configure external collection and storage before relying on historical investigations. Entries removed without another saved copy cannot be collected retroactively.

What do H12 and R14 mean?

In the Cedar examples, H12 is a router request timeout, normally because no response data arrived within the initial 30-second window. It does not mean every streaming response must finish within 30 seconds: a rolling idle timeout applies after the first byte. The application can continue processing after the router returns an error. Check current generation-specific routing and error-code documentation for Fir rather than assuming every Cedar rule applies.

R14 indicates a memory-quota overrun and relates to swap in applicable Cedar Common Runtime environments. Private Spaces do not swap and do not emit R14. Current Fir apps do not emit R14 either; its absence is not evidence that memory is healthy. Error codes · Request timeouts

Can multiple applications share a logging backend?

Yes. Send compatible drains to a shared receiver, retain each application's identity and corresponding drain/resource identifier, and verify queries by application. Cedar and Fir use different protocols and need the appropriate receiver or adapter. A shared URL alone does not unify them.

What happens if a drain cannot deliver?

Logplex has bounded buffering and retry behavior, not a durable queue with guaranteed delivery. If a consumer stays behind, buffers can overflow and entries can be discarded, with warnings such as L10. Check receiver persistence, retries, and duplicate handling. Do not promise lossless or exactly-once delivery, or expect Cedar's L-series warnings to be emitted by Fir.

Continue reading

Documentation checked: November 5, 2026.


Get a tailored plan

Contact us

Join the community

Scan with WeChat
to join the community

Try Guance

Start online and pay only for what you use.

Get started

Choose a Guance plan

Code hosting