Logging

Crunchy Bridge has logging integration to allow you to send your logs from your Postgres database to another logging-as-a-service provider.

All logs are sent over TLS and verify the provider’s certificate. You can configure your logging integration for a database in the logging configuration panel.

Crunchy Bridge currently supports any logging provider that has a public certificate available within AlmaLinux 8.

Datadog

Host: intake.logs.datadoghq.com
Template: <API_KEY> <${PRI}>1 ${ISODATE} ${HOST:--} ${PROGRAM:--} ${PID:--} ${MSGID:--} [[email protected] ddsource=\"test\" ddtags=\"env:test,user:test_user,<KEY:VALUE>\"] $MSG\n
Port: 10516

LogDNA (now Mezmo)

Host: syslog-a.logdna.com
Template: <${PRI}>1 ${ISODATE} ${HOST} ${PROGRAM} ${PID} ${MSGID} [[email protected] key=\"**INSERT-YOUR-INGESTION-KEY-HERE**\"] $MSG\n
Port: 6514

LogEntries (Rapid7 InsightOps)

Host: REGION.data.logs.insight.rapid7.com
(where REGION is us or eu)
Template: TOKEN_HERE $ISODATE $HOST $MSG\n
Port: 443

Loggly

Host: logs-01.loggly.com
Template: <${PRI}>1 ${ISODATE} ${HOST} ${PROGRAM} ${PID} ${MSGID} [[email protected] tag=\"TAG\" ] $MSG\n
Port: 6514

Papertrail

Hostname: logsN.papertrailapp.com
(Where N is some integer)
Port: per-user
Template: The default is accepted. Some plans support IP restrictions (which may work with AWS if IPv6 is supported)

SumoLogic

Host: syslog.collection.YOUR_DEPLOYMENT.sumologic.com
Template: <$PRI>1 $ISODATE $HOST $PROGRAM $PID $MSGID [[email protected]] $MSG\n
Port: 6514

Postgres log settings

These are system level changes you may need to review when setting up logs to make sure all the logs are flowing and you’re receiving the data you want.

log_min_duration_statement

By default Postgres will log errors only. To send all logs (and log long queries), and not just the errors, update log_min_duration_statement. To send every query:

ALTER system
SET log_min_duration_statement = 0;

log_min_messages

Log_min_messages can be set up to send different leves of warning. Warning is the default. To collect all logs, use:

SET log_min_messages = 'info'

log_line_prefix

log_line_prefix establishes the format of the prefix emitted with all log lines. Some providers have recommended settings for this. Here’s an example:

SET log_line_prefix= '%m [%p] %d %a %u %h %c '

log_statement log_statement controls which SQL statements are sent in the logs, including DDL changes and queries. To log everything:

SET log_statement = 'all'

log_lock_waits

log_lock_waits logs when the database needs to wait on a lock:

SET log_lock_waits = 'on'

Reloading configuration changes

If you changed any settings, you’ll need to reload the Postgres config:

SELECT pg_reload_conf()

See more in the Postgres docs about log settings.