Step 5: Configure Collector

To complete the setup, we can now go to your virtual machine that is running the collector, and enable access to the Azure Event Hub.

Next, update the collector configuration for this server. Note the values need to match what you created in Step 2.

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

azure_eventhub_namespace = [namespace from step 2]
azure_eventhub_name = [name from step 2]

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

  • AZURE_EVENTHUB_NAMESPACE=[namespace from step 2]
  • AZURE_EVENTHUB_NAME=[name from step 2]

Thanks to the Managed Identity that's assigned to the VM, we don't need to specify any credentials here. If the VM has multiple Managed Identities assigned, specify the client ID of the specific Managed Identity created in Step 1 using the azure_ad_client_id / AZURE_AD_CLIENT_ID setting.

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 --reload
I [server1] Testing log collection (Azure Database)...
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 Log-based EXPLAIN as 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 →