Heroku

To get logs from Heroku, you need to follow the guide lines to set up a HTTPS Drain.

First you need to make sure you have a repository ready to send your logs to. Either create a dedicated repository or if you are on a Free Humio Cloud account use your Sandbox Repository.

The command to set up logging for your Heroku app is then:

heroku drains:add https://$INGEST_TOKEN@$HOST/api/v1/dataspaces/$REPOSITORY_NAME/logplex -a myapp
Where:

  • $BASEURL - is the base URL of your Humio server (e.g. https://cloud.humio.com:443 or http://localhost:8080)
  • $INGEST_TOKEN - is the ingest token for your repository, (e.g. a string such as fS6Kdlb0clqe0UwPcc4slvNFP3Qn1COzG9DEVLw7v0Ii).

Extra: Parsing Heroku Logs

You can configure a parser to deal with the contents of your specific logs. In the example below, the logplex ingester only deals with the log up to the - in the middle. Anything after that is specific to the particular kind of log.

<40>1 2012-11-30T06:45:29+00:00 host app web.3 - State changed from starting to up
<40>1 2012-11-30T06:45:26+00:00 host app web.3 - Starting process with command `bundle exec rackup config.ru -p 24405`

To deal with this, you can define a parser with the name of the application and the process (sans the .3) "heroku_${app}_${process}" (in this case heroku_app_web). If such a parser exists in the repository, then it will be used to do further data extration in the log’s message.