Heroku Logs
Loggly provides the infrastructure to aggregate and normalize log events so they are available to explore interactively, build visualizations, or create threshold-based alerting. In general, any method to send logs from a system or application to an external source can be adapted to send logs to Loggly. The following instructions provide one scenario for sending logs to Loggly.
You can send your Heroku logs by adding a drain to Loggly. We will automatically parse the logs as well. For alternatives on Heroku log analysis, please see the Advanced Options section.
Heroku Logging Setup
1. Add A Drain
Use drain to send your heroku application logs to loggly. Follow below command to send logs.
heroku drains:add https://logs-01.loggly.com/bulk/TOKEN/tag/heroku --app HEROKU_APP_NAME
Replace:
- TOKEN: your customer token from the source setup page
- HEROKU_APP_NAME: the name of your Heroku application
2. Send Test Logs
Send some test logs to Loggly. If you’re using a logger library in your respective technology, set it up on Heroku to log to stdout.
Ruby sample
puts 'hello logs'
Java sample
System.out.println("hello logs");
3. Verify Events
Search Loggly for events with the heroku tag over the past 20 minutes. It may take a few minutes to index the event. If it doesn’t work, see the troubleshooting section below.
tag:heroku
Click on one of the logs to show a list of syslog fields. If you don’t see them, please check that you are using one of our automatically parsed formats.
Advanced Heroku Logging Options
- Heroku Automated Parsing – We automatically parse the source, dyno, and more
- Search or post your own Heroku tail logs questions in the community forum, read more about the Heroku app here, or visit Heroku.
Troubleshooting Heroku Logs
If you don’t see any data show up in the verification step, then check for these common problems.
Check heroku:
- Wait a few minutes in case indexing needs to catch up
- Run the "heroku drains" command to verify Heroku has created the drain
- Run the "heroku logs" command to verify Heroku has received the logs you sent
- Try curling an event to the bulk endpoint to verify Loggly is able to receive your events
Still Not Working?
- Search or post your own question in the community forum.
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.