Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Visit the Heroku Blog

    Find news and updates from Heroku in the blog.

    Visit Blog
  • Log inorSign up
Hide categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Working with Node.js
      • Troubleshooting Node.js Apps
      • Node.js Behavior in Heroku
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • PHP Behavior in Heroku
      • Working with PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Vector Database
    • Heroku Inference
      • Quick Start Guides
      • AI Models
      • Inference Essentials
      • Inference API
    • Working with AI
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Databases & Data Management
  • Heroku Postgres
  • Postgres Getting Started
  • Getting Started: Monitoring a Heroku Postgres Database

Getting Started: Monitoring a Heroku Postgres Database

English — 日本語に切り替える

Last updated January 28, 2025

Table of Contents

  • Before You Begin
  • Explore Heroku Postgres Logs
  • Install a Monitoring Add-on
  • Review Database Metrics
  • Next Steps

Heroku Postgres is a managed SQL database service provided directly by Heroku. You can access a Heroku Postgres database from any language with a PostgreSQL driver, including all languages officially supported by Heroku.

Heroku Postgres provides database and server metrics that give information on the status of your instance. Understanding and monitoring these metrics ensures the health of your database as your applications run and scale. Monitoring can also help you tune, debug, and troubleshoot your application. If you have a production database, make sure you’re monitoring it.

In this getting started, you learn how to:

  • View PostgreSQL logs
  • Review monitoring add-on options
  • Identify which database metrics to track

Logs are available on Standard-tier or higher databases. They aren’t available on Essential-tier databases.

Heroku Postgres service logs and metrics logs are unavailable on Fir-generation apps. Subscribe to our changelog to stay informed of when we add features to Fir.

Before You Begin

You must have a Heroku Postgres database provisioned before you can proceed. Use the heroku addons command to determine whether your app already has Heroku Postgres provisioned:

$ heroku addons
Add-on                                               Plan        Price                           Max Price                       State
───────────────────────────────────────────────────  ──────────  ──────────────────────────────  ──────────────────────────────  ───────
heroku-postgresql (postgresql-elliptical-12345)      standard-0  ~$0.069/hour                    $50/month                       created

To learn how to create a Heroku Postgres database, see Provisioning Heroku Postgres.

Explore Heroku Postgres Logs

You can view logs with the Heroku CLI, the dashboard, your logging add-on, or in your log drain.

Heroku Postgres logs to the logplex, which collates and publishes your application’s log-stream. You can isolate Heroku Postgres events with the heroku logs command by filtering for the postgres process type with the -p flag.

Heroku Postgres metrics logs are emitted with heroku-postgres as the process type:

$ heroku logs -p heroku-postgres -a example app
2022-04-21T07:46:55.000000+00:00 app[heroku-postgres]: source=HEROKU_POSTGRESQL_COBALT addon=postgresql-demo sample#current_transaction=509 sample#db_size=8426031bytes sample#tables=0 sample#active-connections=11 sample#waiting-connections=0 sample#index-cache-hit-rate=0 sample#table-cache-hit-rate=0 sample#load-avg-1m=0.02 sample#load-avg-5m=0.005 sample#load-avg-15m=0 sample#read-iops=0 sample#write-iops=0.10204 sample#tmp-disk-used=543600640 sample#tmp-disk-available=72435191808 sample#memory-total=3958708kB sample#memory-free=69612kB sample#memory-cached=3405616kB sample#memory-postgres=22080kB sample#wal-percentage-used=0.06428126026622091
...

PostgreSQL logs are emitted with the postgres process type:

$ heroku logs -p postgres -a example app
2024-03-15T12:37:36.000000+00:00 app[postgres.2966211]: [DATABASE] [12-1]  sql_error_code = 42703 (...)" application_name="psql interactive" ERROR:  column "haiku" does not exist at character 8
...

Use the --tail option to access real-time log entries:

$ heroku logs -p heroku-postgres -a example-app  --tail

When you’re done, press Ctrl+C to return to the prompt. A real-time tail session automatically terminates after one hour of inactivity.

If you don’t want to manually sift through logs, you can install a monitoring add-on.

Install a Monitoring Add-on

The most effective way to track database metrics is to install a platform monitoring add-on.

A full list of monitoring add-ons can be found on the Heroku Elements Marketplace. Many of these add-ons offer a free plan to get started. See your add-on’s documentation for instructions on retrieving logs.

Review Database Metrics

Heroku Postgres provides database and server metrics that give information on the status of your instance. Understanding and monitoring these metrics ensures the health of your database as your applications run and scale. Monitoring can also help you identify bottlenecks, bugs, and performance issues. You can look for these metrics in the log or in the dashboard for your monitoring add-on.

You can track metrics for the following:

  • Database attributes apply to a particular database.
  • Server come directly from the server operating system.
  • pg_bouncer metrics are included for any Heroku Postgres server that has a PgBouncer pooler attachment. These metrics are a subset of those viewable by running the SHOW POOLS; command when connected to PgBouncer’s special internal database.

For more information about the different available metrics, see Heroku Postgres Metrics Logs. For a list of suggested metrics, see Monitoring Heroku Postgres.

Next Steps

Learn more about monitoring Heroku Postgres databases with the following content:

  • Monitoring Heroku Postgres
  • Managing Heroku Postgres using the CLI
  • Understanding Heroku Postgres Log Statements and Common Errors

Keep reading

  • Postgres Getting Started

Feedback

Log in to submit feedback.

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices