November 16, 2021

#engineering

Monitor and Analyze Your Heroku Applications with Axiom


Blog Screenshot
Author
Tola Ore-Aruwaji

Developer Relations Engineer

Heroku is a platform as a service that lets developers build and operate cloud-based applications. Using Heroku log drains, you can transport logs, metrics, api logs, and service app logs from your applications and deployments to Axiom by sending them via HTTPS. Heroku app is a cloud config service dyno platform that is easy to use for real-time routing projects and has many built-in Linux development resources for your use case.

Whether you are running complex Heroku logs workloads, hosting your applications on Heroku, configuring dyno, log data, and logplex on Heroku resources, 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, API logs, system logs, and eventually allows your team to collaborate. You will get insights from your Heroku application and visualize your Heroku router logs from your applications, use case, and analyze your Heroku logs data using Axiom Data Explorer.

Prerequisites


Monitor and Analyze Your Heroku Applications with Axiom

  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. 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 logs 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.

  • 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.

  • 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. 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. 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@app.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. Run aggregations across all or a subset of events in your herokuapp dataset to visualize the output:

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

  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.

  • View your Event Properties on the Stream UI

Wrapping up ⬆️

You can see how straightforward it is to monitor, analyze, and run queries on your Heroku application directly on Axiom. With Axiom and Heroku logs, you can support your customer-focused logger apps, and enable application monitoring and analyze deployment dependencies.

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

Good luck!

Share
Get started with Axiom

Learn how to start ingesting, streaming, and
querying data into Axiom in less than 10 minutes.