Logging from Heroku


Loggly is a cloud-based log management service. Our goal is to provide you with a quick, easy, and fun way to store, retain, and search your log files and application events in near-realtime.

Step 1. Add a syslog drain

cd to the directory where your heroku app is located & use the following command in the heroku toolbelt

$ heroku drains:add https://logs.loggly.com/inputs/$$CUSTOMER_TOKEN$$/tag/$$TAG1,TAG2$$ --app $$HEROKU_APP_NAME$$
  • Replace $$CUSTOMER_TOKEN$$ with your Loggly input key.(See screenshot below.)
  • Replace $$TAG1,TAG2$$ with a comma separated list of any tags you'd like to apply to your data.​
  • Replace $$HEROKU_APP_NAME$$ with your Heroku Application Name


Step 2. Verify the drain

$ heroku drains

Step 3. Log

Any standard output will be logged.
Ruby sample

 puts 'hello logs'

Java sample

 System.out.println("hello logs");

If you're using a logger library in your respective technology, set it up on Heroku to log to stdout.

Removing Drains

Note that if you currently have a Heroku Loggly add-on you will see another syslogdrain, if you're comfortable removing that add-on you can use the following:

$ heroku addons:remove Loggly:mole

The following command will not remove the add-on but will stop the forwarding of logs to your Loggly add-on:


$ heroku drains:remove https://logs.loggly.com/inputs/$$CUSTOMER_TOKEN$$/tag/$$TAG1,TAG2$$ --app $$HEROKU_APP_NAME$$

See if those drains were actually removed:

$ heroku drains

For reference the docs from where the above was compiled from are:
-> Heroku Add-ons
-> Heroku Logging Docs