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.
New relic
Host: newrelic.syslog.nr-data.net
Template:
YOUR_LICENSE_KEY <${PRI}>1 ${ISODATE} ${HOST:--} ${PROGRAM:--} ${PID:--} ${MSGID:--} ${SDATA:--} $MSG\n
Port: 6514
Documentation
Datadog
Host: intake.logs.datadoghq.com
Template:
YOURAPIKEY <${PRI}>1 ${ISODATE} ${HOST:--} ${PROGRAM:--} ${PID:--} ${MSGID:--} ${SDATA:--} $MSG\n
Port: 10516
Documentation
LogDNA (now Mezmo)
Host: syslog-a.logdna.com
Template:
<${PRI}>1 ${ISODATE} ${HOST} ${PROGRAM} ${PID} ${MSGID} [logdna@48950 key=\"**INSERT-YOUR-INGESTION-KEY-HERE**\"] $MSG\n
Port: 6514
Documentation
LogEntries (Rapid7 InsightOps)
Host: data.logentries.com
(where REGION is us
or eu
)
Template: TOKEN_HERE $ISODATE $HOST $MSG\n
Port: 443
Documentation
Loggly
Host: logs-01.loggly.com
Template:
<${PRI}>1 ${ISODATE} ${HOST} ${PROGRAM} ${PID} ${MSGID} [TOKEN@41058 tag=\"TAG\" ] $MSG\n
Port: 6514
Documentation
Logtail (Better Stack)
Host: in.logtail.com
Template:
<$PRI>1 $ISODATE $HOST $PROGRAM $PID ${MSGID:--} [logtail@11993 source_token=\"YOUR_LOGTAIL_SOURCE_TOKEN\"] $MSG\n
Port: 6514
Documentation
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)
Documentation
SumoLogic
Host: syslog.collection.YOUR_DEPLOYMENT.sumologic.com
Template:
<$PRI>1 $ISODATE $HOST $PROGRAM $PID $MSGID [TOKEN@41123] $MSG\n
Port: 6514
Documentation
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.