'PostgreSQL'
or include the instance name such as 'PostgreSQL-15'
. Use consistent naming across your Windows environments for easier log management and monitoring.'stderr,csvlog'
provides both human-readable and machine-processable logs. For Windows: 'eventlog,csvlog'
. Include jsonlog
if you use JSON-based log processing tools. Avoid using only stderr
without the logging collector./var/log/postgresql
or /pglogs
. Ensure the directory exists and the PostgreSQL user has write permissions. Use dedicated storage with sufficient capacity for your log retention needs.0600
(read/write for owner only) is recommended for security. Use 0640
if you need to allow group read access for monitoring tools. Never use permissive settings like 0666
in production environments.'postgresql-%Y-%m-%d_%H%M%S.log'
for detailed timestamps or 'postgresql-%a.log'
for daily rotation. Include enough timestamp information to avoid filename collisions while keeping names manageable.1d
(daily rotation) is standard. For very busy systems, consider 12h
or 6h
. For troubleshooting periods, temporary smaller values like 1h
can help isolate issues to specific timeframes.10MB
is often too small for production. Set to 100MB
or 500MB
depending on your log volume. Balance between file manageability and having too many small files.off
. Set to on
for fixed-size log rotation cycles. When using timestamped filenames, off
is usually better as filenames won't conflict. For fixed names, on
prevents unlimited growth.off
on some systems. Set to on
for all production deployments. This ensures reliable log capture regardless of how PostgreSQL is started or restarted.local0
. Use local0
through local7
based on your organization's syslog conventions. Coordinate with your system administrators to ensure proper integration with existing log management systems.'postgres'
or include the instance name like 'postgres-main'
. Use consistent naming across your environment for easier log management and monitoring.on
is recommended. Disable only if you have specific reasons and understand your syslog's duplicate handling behavior. Keeping this on ensures no messages are lost to suppression.on
is recommended. This ensures complete messages are preserved rather than truncated. Only disable if you have modern syslog implementations that support larger message sizes.Start your journey toward a healthier PostgreSQL with pghealth.
You can explore all features immediately with a free trial β no installation required.
π Start Free Trial