Heroku Postgres Metrics Logs | Heroku Dev Center (original) (raw)

English — 日本語に切り替える

Last updated April 29, 2025

Table of Contents

Heroku Postgres Standard and Premium Tier database users see database-related events on their app’s log stream. These events are useful for recording and analyzing usage over time.

You can view your Postgres logs with the Heroku CLI, the dashboard, your logging add-on, or in your log drain. You can also install a platform monitoring add-on to help monitor these metrics.

Heroku Postgres metrics that appear via heroku-postgres are separate from standard alerts emitted from Postgres itself that appear for all applications via postgres.

For example, to get postgres logs, run the command heroku logs -p postgres -a app-name. To get heroku-postgres logs, run the command heroku logs -p heroku-postgres -a app-name for Cedar-generation apps and heroku logs -s heroku-postgresql -a app-name for Fir apps.

Log Format

You can view Heroku Postgres metrics logs with heroku logs.

For example, the Heroku Postgres metrics logs can look like:

2024-03-15T12:10:39.000000+00:00 app[heroku-postgres]: source=HEROKU_POSTGRESQL_SILVER addon=postgresql-devcenter-123456 sample#current_transaction=54017686 sample#db_size=16012956319bytes sample#tables=97 sample#active-connections=7 sample#waiting-connections=0 sample#index-cache-hit-rate=0.9239 sample#table-cache-hit-rate=0.93609 sample#load-avg-1m=0 sample#load-avg-5m=0 sample#load-avg-15m=0 sample#read-iops=0 sample#write-iops=0.13333 sample#tmp-disk-used=33849344 sample#tmp-disk-available=72944943104 sample#memory-total=4044960kB sample#memory-free=46920kB sample#memory-cached=3667532kB sample#memory-postgres=20824kB sample#wal-percentage-used=0.06512959334021144

For Fir-generation apps, the logs appear as heroku-postgresql[logs] instead.

The following attributes appear in application logs for all Standard and Premium-tier databases:

Filtering Logs

You can filter for Heroku Postgres metrics logs on a specific app.

For Cedar-generation apps:

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

For Fir-generation apps:

$ heroku logs -s heroku-postgresql -a example-app

Database Metrics

These attributes apply to a particular database:

Server Metrics

These metrics come directly from the server operating system:

The operating system is designed to maximize the amount of memory it uses for its page cache, but can sometimes release that memory if an application requests it. For an estimate of the total amount of memory available to your server, add sample#memory-free and sample#memory-cached together.

PgBouncer Metrics

We include these metrics for any Heroku Postgres server that has a PgBouncer pooler attachment. These metrics are a subset of the metrics viewable by running the SHOW POOLS; command when connected to PgBouncer’s special internal database:

Replication Slot Metrics

These metrics display in the logs if you have pg-replication-slot-logs set to on.