Heroku Log Format
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 use your Sandbox repository.
The command to set up logging for your Heroku app is then
heroku drains:add https://$INGEST_TOKEN@$YOUR_LOGSCALE_URL/api/v1/ingest/logplex -a myapp
Where:
$YOUR_LOGSCALE_URL
— is the URL of your LogScale server (humio.example.com
)$INGEST_TOKEN
— is the ingest token for your repository, (for example, a string such asfS6Kdlb0clqe0UwPcc4slvNFP3Qn1COzG9DEVLw7v0Ii
).
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.
Finally, you can apply a parser by assigning a specific parser to the Ingest API Token used to authenticate the client.