Skip to content

feat(tamanu/logs): add postgres pseudo-service#432

Open
passcod wants to merge 1 commit into
mainfrom
logs-postgres
Open

feat(tamanu/logs): add postgres pseudo-service#432
passcod wants to merge 1 commit into
mainfrom
logs-postgres

Conversation

@passcod
Copy link
Copy Markdown
Member

@passcod passcod commented May 29, 2026

🤖 Adds a postgres pseudo-service to bestool tamanu logs, analogous to the existing caddy one, so Postgres logs can be tailed cross-platform with a single command.

  • Fuzzy name matching: any of postgres, postgresql, postgre, pg, psql, or pgsql triggers it.
  • On Linux, tails BOTH the journald units matching postgresql* AND the files under /var/log/postgresql/*.log. When such files exist, the journalctl stream and the file tails are fanned into a shared channel so their output interleaves; with no files present the original single-stream journalctl path is unchanged.
  • On Windows, tails the .log files from the Postgres data directory (probing data\log and data\pg_log under each version in C:\Program Files\PostgreSQL).
  • Passing only postgres does not imply tailing every tamanu service, mirroring the caddy-alone behaviour.

The shared journalctl line-filtering (blank-line and inverted-grep handling) was factored into a helper so both the direct and channelled paths use it.

Recognise a postgres pseudo-service alongside caddy, fuzzily matched so
any of postgres, postgresql, postgre, pg, psql or pgsql triggers it.

On Linux it tails BOTH the journald units matching postgresql* AND the
files under /var/log/postgresql/*.log; when such files exist the
journalctl stream and the file tails are fanned into a shared channel so
their lines interleave in arrival order. On Windows it tails the .log
files from the Postgres data directory, probing the versioned install
roots under C:\Program Files\PostgreSQL\<ver>\data\{log,pg_log}.

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant