Skip Navigation
Show nav
Heroku Dev Center Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
Heroku Dev Center Dev Center
  • 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

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log in or Sign up
View 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
    • Buildpacks
  • 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
    • Working with AI
    • Heroku Inference
      • Inference API
      • Inference Essentials
      • AI Models
      • Heroku Inference Quick Start Guides
    • Tool Use
    • Vector Database
    • AI Integrations
  • 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
  • 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
    • Heroku AppLink
      • Heroku AppLink Reference
      • Getting Started with Heroku AppLink
      • Working with Heroku AppLink
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
    • Other Salesforce Integrations
  • 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 September 03, 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.

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, or your logging add-on in your log drain in Cedar-generation apps or telemetry drain in Fir-generation apps.

Cedar-Generation Apps

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.

Fir-Generation Apps

Heroku Postgres signals are available through OpenTelemetry for log collection. Both logs and metrics are emitted in real time with the heroku-postgresql source type:

$ heroku logs -s heroku-postgresql -a example-app
2025-08-20T19:16:10.000000+00:00 heroku-postgresql[logs]: [ORANGE] [13-1]  sql_error_code = 42P01 time_ms = "2025-08-20 19:16:10.974 UTC" pid="28248" proc_start_time="2025-08-20 17:02:06 UTC" session_id="68a5ff8e.6e58" vtid="242/403" tid="0" log_line="8" database="dbjjab162vq6qo" connection_source="204.14.236.211(53777)" user="uf99bg1ci79f3c" application_name="psql" ERROR:  relation "salesforce" does not exist at character 15

2025-08-20T19:16:09.000000+00:00 heroku-postgresql[logs]: source=HEROKU_POSTGRESQL_ORANGE addon=postgresql-curved-71720 sample#service-available=1 sample#current_transaction=1496 sample#db_size=8883347bytes sample#db-max-size=68719476736bytes sample#db-size-percentage-used=0.00013 sample#tables=7 sample#active-connections=15 sample#waiting-connections=0 sample#max-connections=200 sample#connections-percentage-used=0.07500 sample#index-cache-hit-rate=0.99889 sample#table-cache-hit-rate=1 sample#load-avg-1m=0.065 sample#load-avg-5m=0.075 sample#load-avg-15m=0.05 sample#read-iops=0 sample#write-iops=0.023529 sample#max-iops=3000 sample#iops-percentage-used=0.00001 sample#tmp-disk-used=543633408 sample#tmp-disk-available=72435159040 sample#memory-total=3944372kB sample#memory-free=809860kB sample#memory-percentage-used=0.79468 sample#memory-cached=2485000kB sample#memory-postgres=30936kB sample#wal-percentage-used=0.06402297744064274 sample#rollback-from=2025-08-19T17:21
...

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