Route Heroku Logs to Cube
First install Cube, along with Node.js and MongoDB, if you haven’t already. This process is described on the Cube wiki. I recommend cloning the Cube git repository so that you can easily customize the dashboard.
Then, install cube-logplex globally:
npm install -g cube-logplex
Lastly, cd
to the directory containing your heroku application, and start the log emitter by running cube-logplex &
. This uses heroku logs -t
internally, so you’ll need to have the Heroku toolbelt installed, too.
Currently the emitter assumes that you have the Cube collector running on localhost:1080. You can then access the Cube dashboard at localhost:1081.
When the emitter is running, you should see your Heroku router info logs mapped to heroku_info
events in Cube. For example:
If your app also logs custom events as JSON objects with a type
property, these will be mapped to Cube events as well. For example, the following app logs will be transformed to api_request
and api_response
events:
2013-05-02T00:40:43.439953+00:00 app[web.1]: {"type":"api-request","path":"/gists/5001347"}
2013-05-02T00:40:43.649308+00:00 app[web.1]: {"type":"api-response","path":"/gists/5001347","duration":210}
2013-05-02T00:40:47.485454+00:00 app[web.1]: {"type":"api-request","path":"/gists/3077915"}
2013-05-02T00:40:47.714644+00:00 app[web.1]: {"type":"api-response","path":"/gists/3077915","duration":229}
As follows:
If you want to design a custom dashboard for your Heroku app, use the "random" example in Cube’s static
directory.