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:
- in the Heroku app directory, like this:
heroku drains:add https://logsene-heroku-receiver.sematext.com/LOGSENE_TOKEN
- 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:
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. 🙂