4 months ago
My Postgres log is full of lines like this:
2026-02-22 13:48:44.068 UTC [76] LOG: checkpoint starting: time
2026-02-22 13:48:45.406 UTC [76] LOG: checkpoint complete: wrote 14 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.313 s, sync=0.007 s, total=1.338 s; sync files=7, longest=0.005 s, average=0.001 s; distance=40 kB, estimate=92 kB; lsn=0/EF0D4C8, redo lsn=0/EF0D470
And they all are treated as errors. I suppose Postgres writes them into STDERR. This is messing with Observability feature, because all these info lines polluting "Error logs" widget and make it pretty useless.
How do I make non-warn and non-error log messages from Postgres to go into STDOUT rather than STDERR?
Alternativ, if this is not possible, how do I instruct Postges service to only write warn/error logs for which it is expected to appear in "Error logs".
2 Replies
Status changed to Awaiting Railway Response Railway • 4 months ago
4 months ago
You can turn log_checkpoints off..this will kind of stop 2026-02-22 13:48:44.068 UTC [76] LOG: checkpoint starting: time
run this in your postgress DB ALTER SYSTEM SET log_checkpoints = off; also you need to restart postgres on railway after running this
4 months ago
I was able to add an environment variable LOG_TO_STDOUT as true to my Postgres service and now my checkpoint logs are not coming through as errors in the railway logs.
However, this may classify ALL postgres logs as severity level info. Something to keep in mind.
You can see this environment variable usage in the railway postgres wrapper.sh script:
https://github.com/railwayapp-templates/postgres-ssl/blob/main/wrapper.sh