Get WAL archive status
get_wal_archive_statusCheck WAL archiving health to detect failing archive commands before WAL directory fills up.
Instructions
Report WAL-archiving health from pg_stat_archiver + the archive-mode GUCs — the early-warning signal for a failing archive_command / archive_library (full archive volume, bad object-store credentials, network partition), which otherwise silently accumulates WAL in pg_wal/ until the volume fills. Companion to read_pg_wal_records (which inspects WAL records); this covers the WAL archive. Read-only; never raises. The archive_command string is NOT echoed (it can embed credentials) — only a boolean archive_command_set. Returns an object with available, archiving_enabled, archive_mode, archive_command_set, archived_count, last_archived_wal, last_archived_time, failed_count, last_failed_wal, last_failed_time, stats_reset, healthy (bool — false when archiving is on and the latest attempt failed), and detail.
Example: get_wal_archive_status()
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | No | Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| detail | Yes | ||
| healthy | Yes | ||
| available | Yes | ||
| stats_reset | Yes | ||
| archive_mode | Yes | ||
| failed_count | Yes | ||
| archived_count | Yes | ||
| last_failed_wal | Yes | ||
| last_failed_time | Yes | ||
| archiving_enabled | Yes | ||
| last_archived_wal | Yes | ||
| last_archived_time | Yes | ||
| archive_command_set | Yes |