To get logs from Heroku, follow the guidelines to set up a HTTPS Drain.
First, 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@$YOUR_HUMIO_URL/api/v1/ingest/logplex -a myapp
Where:
$YOUR_HUMIO_URL
— is the URL of your Humio server (cloud.humio.com
or humio.example.com
)$INGEST_TOKEN
— is the ingest token for your repository, (for example, a string such as fS6Kdlb0clqe0UwPcc4slvNFP3Qn1COzG9DEVLw7v0Ii
).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.
Finally, you can apply a parser by assigning a specific parser to the Ingest API Token used to authenticate the client.