Skip to content

wal: WAL volume, retention, and archiving

Check WAL LSN position, sys_wal directory size, retention blockers (slots, wal_keep_segments), and archiver health.

Inspects current WAL/replay position, sys_wal disk footprint, retention factors (replication slots, wal_keep_segments, pending .ready files), and archiver status (kbdiag wal archive). Read-only: never switches, deletes, or checkpoints WAL.

Usage

kbdiag wal
kbdiag wal archive
kbdiag wal --json
kbdiag wal archive --json

Subcommands & Options

Command / OptionEffect
kbdiag walShow WAL/replay LSN, sys_wal size, max_wal_size, wal_keep_segments, slots, and .ready count
kbdiag wal archiveShow archive_mode, archive_command, archiver counts/timestamps, and .ready/.done queue
--jsonEmit structured JSON (wal.position, space.wal, slot.list, archive.ready, archive.status)

Verdict & Reading Output

  • wal:
    • OK (exit=0): All WAL probes collected cleanly; retention items with [NEXT] guide follow-up to kbdiag slots or kbdiag wal archive.
    • UNKNOWN (exit=3): Non-monitoring roles (kbdiag_ro) skip sys_ls_waldir() and sys_ls_archive_statusdir().
  • wal archive:
    • WARN (exit=1): archive.failing when archive_mode is active (primary, or standby with always), archive_command is non-empty, and last_failed_time is newer than last_archived_time (or never succeeded).
    • OK (exit=0): Archiving healthy, intentionally disabled (off or standby on).
    • UNKNOWN (exit=3): archive.status or archive.ready failed/skipped.

Example (KES V9 Primary, COLUMNS=80)

wal  OK  (primary, system@local, endpoint=/tmp/.s.KINGBASE.54321,
    2026-12-02T16:08:12Z)
[POSITION]
  lsn   10/400FB580
  file  000000010000001000000040
[SYS_WAL]
  58 files, 912 MB
[WHAT KEEPS WAL HERE]
  max_wal_size       1024 MB
  wal_keep_segments  0 bytes  (0 x 16 MB)
  archiving          0 .ready files waiting
  slots (1):
    repmgr_slot_2: 12 MB (inactive)
[NEXT]
  kbdiag slots  # inspect inactive replication slot retaining WAL
archive  OK  (primary, system@local, endpoint=/tmp/.s.KINGBASE.54321,
    2026-12-02T16:08:12Z)
[SETTINGS]
  archive_mode     always
  archive_command  exit 0
  archive_timeout  0 (off)
[ARCHIVER  (COUNTING SINCE 2026-11-29T09:11:20Z)]
  archived  6  last 00000001000000100000003F  8m 35s ago
  failed    0
[WAITING]
  0 .ready, 2 .done
  • kbdiag slots — inspect inactive replication slots and xmin / WAL retention
  • kbdiag checkpoint — checkpoint vs bgwriter vs backend buffer writes
  • kbdiag space — filesystem free space for data_directory, sys_wal, and tablespaces