Skip to content
share

Installing Logagent on Heroku

Run Logagent as Heroku Log Drain

You can forward your Heroku logs to Sematext using Heroku Log Drain like this:

heroku drain:add --app HerokuAppName URL

Here are the steps:

To ship your Heroku logs to Sematext or Elasticsearch deploy Logagent on Heroku. It will act as an HTTPS log drain.

  1. Get a free account apps.sematext.com
  2. Create a Logs App to obtain the App Token
  3. Deploy Logagent to Heroku using the Deploy to Heroku button

Deploy ... or use the following commands:

  git clone https://github.com/sematext/logagent-js.git
  cd logagent-js
  heroku login
  heroku create
  git push heroku master

  1. Add the log drain using the URL format like https://loggerAppName.herokuapps.com/LOGSENE_TOKEN. Use the following command to grab the dynamically assigned name from "heroku create" command.

  export LOGSENE_TOKEN=YOUR_LOGSENE_TOKEN
  heroku drains:add --app YOUR_HEROKU_MAIN_APPLICATION `heroku info -s | grep web-url | cut -d= -f2`$LOGSENE_TOKEN

When you see logs in Sematext you can define Alert Queries, build Dashboards, etc.

  1. Scale Logagent service on Heroku

To handle high log volume, scale Logagent on demand using

heroku scale web=3

See also: - How to Ship Heroku Logs to Sematext / Managed ELK Stack