2021-11-16

Monitoring Heroku Applications with Axiom

Tola Ore-Aruwaji
@thecraftman_

Heroku is a platform as a service that lets developers build and operate cloud-based applications. Using Heroku log drains, you can transport logs from your applications and deployments to Axiom by sending them via HTTPS.

Whether you are running complex workloads, hosting your applications on Heroku, and configuring your web servers Axiom provides you with that monitoring capability tool that gives you a 360-degree view across your Heroku applications, application code, and eventually allows your team to collaborate. You will get insights from your Heroku application and visualize and analyze your data using Axiom Data Explorer.

Prerequisites

Let's roll ✨

  1. To ship logs from Heroku to Axiom, you need a dataset and an Ingest token. To create a new dataset, go to Settings → Datasets on the Axiom UI.

1

  1. Generate your ingest token, Visit our docs to learn how you can generate ingest tokens.

  2. Create your sample-app on Heroku. You can either create your sample-app using the Heroku CLI or on your Heroku dashboard. If you want to create your app using the Heroku dashboard, click on New, and select Create new app.

  • In this tutorial, we will be creating our sample-app using the Heroku CLI.
  1. In your terminal, login to your Heroku dashboard by typing heroku login in your terminal.

1

  • Wait for some seconds, it will redirect you to Heroku page to login.
  1. Create your Heroku app using heroku create <NAME_OF_YOUR_APPLICATION> if you don't give your app a name, a random name will be generated for you by Heroku.

1

  • You can see that our app is created with the git URL and deployment URL.
  • Visit your application URL, to confirm if you can see it.

1

  1. In your sample-app source code, you need to commit and deploy your changes to your git app that was created.
  • initialize a git repository in your existing sample-app directory.
git init

heroku git:remote -a axiomcloudselfhost
  • Deploy your application and commit your code to the repository and deploy it to Heroku using Git.
git add .

git commit -am "commit heroku app"

git push heroku master
  1. Refresh your application URL, you will see your sample app has been deployed and the changes have been reflected.

1

  1. Back in Axiom, you can forward your logs from your Heroku application to Axiom via HTTPS using our Heroku log drains data shipper. Copy, update the configuration below and paste it into your terminal.
heroku drains:add https://:xait-xxxx-xxx-xxxxx-xxx-xxxx@cloud.axiom.co/api/v1/datasets/herokuapp/ingest -a axiomcloudselfhost

Where:

  • xait-xxx-xxxx-xxxx-xxxx-xxxx: is my ingest token, I created in step 1.
  • herokuapp is my dataset name on Axiom dashboard I created in step 2.
  • axiomcloudselfhost is my Heroku application I created using the Heroku CLI.

You will need to update the parameters above using your own values.

  1. In your Axiom dashboard, select the dataset you configured for your Heroku log drains configuration in step 8. You will see the logs from your Heroku application. You can now analyze your events, extract insights and get queries from your application using Axiom Analytics, Data Explorer, and Axiom Stream.

1

  1. Run aggregations across all or a subset of events in your herokuapp dataset to visualize the output:

1

  1. Get detailed statistics into the way your Heroku application is performing and run super-fast queries in seconds using Axiom Data Explorer.

1

  1. You can also stream your Heroku logs on Axiom. This lets you inspect individual events from your Heroku application and watch as they are ingested live.

1

  • View your Event Properties on the Stream UI

1

Wrapping up ⬆️

You can see how straightforward it is to monitor, analyze, and run queries on your Heroku application directly on Axiom.

If you want to explore Axiom and learn more about our integrations and data shippers, visit the links below:

Good luck!

Join us in changing how developers think about data