Documentation forSolarWinds Observability SaaS

Collect Heroku logs (SolarWinds Observability SaaS)

You can forward logs from a Heroku application to SolarWinds Observability SaaS by configuring a Heroku log drain. A log drain sends your application logs directly to the SolarWinds Observability SaaS HTTPS logs collector without using a Heroku add-on.

How Heroku log forwarding works

  1. Your application writes log lines to stdout and stderr. Heroku's log routing system (Logplex) captures these logs automatically, along with Heroku's own router and system messages.

  2. When a log drain is configured, Logplex periodically sends batches of log lines to the SolarWinds Observability SaaS HTTPS logs collector in the application/logplex-1 format (RFC 5424 syslog messages with byte-count framing).

  3. The logs collector authenticates the request using the API ingestion token included in the drain URL.

Prerequisites

  • An API ingestion token. To create a token or copy an existing one, see API tokens.

  • The Heroku CLI installed on your local computer. The drains:add command is available only in the Heroku CLI, not in the Heroku Dashboard. For installation instructions, see The Heroku CLI in the Heroku Dev Center.

  • The data center your organization uses (na-01, eu-01, or ap-01). See Data centers and endpoint URIs.

Add a Heroku log drain

  1. Log in to Heroku from the command line:

    heroku login
  2. Run the following command to add the log drain, replacing the following values:

    • Replace YourDataCenter with the data center your organization uses, such as na-01.

    • Replace YourApiToken with your API ingestion token.

    • Replace YourHerokuAppName with the name of your Heroku application.

    heroku drains:add \
      "https://logs.collector.YourDataCenter.cloud.solarwinds.com/v1/logs/logplex/YourApiToken?hostname=YourHerokuAppName" \
      -a YourHerokuAppName

    Heroku starts forwarding logs within seconds.

  3. (Optional) Confirm that the drain was added:

    heroku drains -a YourHerokuAppName
  4. Open the Logs Explorer to view the logs sent from your Heroku application.

Remove a Heroku log drain

To stop forwarding logs, remove the drain using the same URL you used to add it:

heroku drains:remove \
  "https://logs.collector.YourDataCenter.cloud.solarwinds.com/v1/logs/logplex/YourApiToken?hostname=YourHerokuAppName" \
  -a YourHerokuAppName

The drain is removed immediately, and Heroku stops forwarding logs to SolarWinds Observability SaaS. Your application is not affected.

The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.