Skip to content
share library_books

Installation on Heroku

Run Logagent as Heroku Log Drain

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

heroku drain:add --app HerokuAppName URL

Here are the steps:

To ship your Heroku logs to Logsene 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 Logsene App to obtain the Logsene Token
  3. Deploy logagent-js 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

Now you can see your logs in Logsene, define Alert Queries or use Kibana for Dashboards.

  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 Logsene / Managed ELK Stack