At the end of November, we’ll be migrating the Sematext Logs backend from Elasticsearch to OpenSearch

5 Minute Recipe: Heroku Log Drain Setup

May 31, 2016

Table of contents

Since we wrote about how to ship Heroku Logs to Elastic Stack we’ve received good feedback from Heroku users and, encouraged by that feedback, deployed a log ingestion service for apps running on Heroku. This makes it super easy to get structured Heroku Logs into Sematext Logs, the hosted ELK logging service.  Let’s see how that’s done in under five minutes (check the current time!):

Step 1 – Create your Logs App

If you don’t have a Sematext account already simply get a free account and create a Logs App. This will get you a Logs App Token.

Step 2 – Configure Log Drain for your Heroku App

Once you create your Logs App you’ll see a command to set up the Heroku Log Drain including the Logs App Token.

Simply copy that command and run it in one of the two places:

  1. in the Heroku app directory, like this:

heroku drains:add https://logsene-heroku-receiver.sematext.com/LOGSENE_TOKEN

  1. alternatively, specify your app name in the command instead of calling the command from your Heroku app directory:

heroku drains:add https://logsene-heroku-receiver.sematext.com/LOGSENE_TOKEN -a YOUR_HEROKU_APP_NAME

Step 3 – Watch your Logs in Sematext

If you now access your Heroku App, Heroku should log your HTTP request and a few seconds later the logs will be visible in Sematext.  And not in just any format!  You’ll see PERFECTLY STRUCTURED HEROKU LOGS:

heroku-logs-in-logsene

Parsed Heroku Logs in Sematext

 

Check the time!  Under five minutes?  If you like your Heroku app logs in Sematext tweet us your setup time. 🙂

Java Logging Basics: Concepts, Tools, and Best Practices

Imagine you're a detective trying to solve a crime, but...

Best Web Transaction Monitoring Tools in 2024

Websites are no longer static pages.  They’re dynamic, transaction-heavy ecosystems...

17 Linux Log Files You Must Be Monitoring

Imagine waking up to a critical system failure that has...