Notice: We've updated our Privacy Policy, effective November 14, 2024.

Step 4: Configure Collector

Next, update the collector configuration for this server.

If using the config file, make the following changes, typically in /etc/pganalyze-collector.conf:

gcp_pubsub_subscription = projects/PROJECT_ID/subscriptions/SUBSCRIPTION_ID

If running the collector in a container, set these environment variables instead:

  • GCP_PUBSUB_SUBSCRIPTION=projects/PROJECT_ID/subscriptions/SUBSCRIPTION_ID

The value for the setting should be set to the "Subscription name" you can see when clicking on the details for the Pub/Sub subscriber we created earlier.

When the collector is installed in a virtual machine, you can now test and apply the collector configuration (for container environments, simply restart the collector):

sudo pganalyze-collector --test
...
I [server1] Testing log collection (Google Cloud SQL and AlloyDB)...
I [server1]   Log test successful
I Successfully reloaded pganalyze collector (PID 123)

For additional help when you get an error please check our troubleshooting documentation.

You will start seeing log data in pganalyze Log Insights within a few minutes.

We recommend setting up Automated EXPLAIN as a follow-up step, to automatically EXPLAIN slow queries in Postgres.


Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →