Watchlog DocsWatchlog Docs
Home
Get Started
Gen AI Monitoring
Integrations
Log Watchlist
Home
Get Started
Gen AI Monitoring
Integrations
Log Watchlist
  • All Integrations
  • NGINX

    • Nginx Integration
    • Connect NGINX to Watchlog
    • Docker
    • Windows
    • Kubernetes
    • Source Code
  • IIS

    • IIS Integration
    • Ubuntu
    • Docker Container
    • Windows
    • Kubernetes
    • Source Code
  • REDIS

    • Redis Integration
    • Ubuntu
    • Docker Container
    • Windows
    • Kubernetes
    • Source Code
  • POSTGRESQL

    • PostgreSQL Integration
    • Ubuntu
    • Docker Container
    • Windows
    • Kubernetes
    • Source Code
  • MONGODB

    • MongoDB Integration
    • Ubuntu
    • Docker Container
    • Windows
    • Kubernetes
    • Source Code
  • MYSQL

    • MySQL Integration
    • Ubuntu
    • Docker Container
    • Windows
    • Kubernetes
    • Source Code
  • PM2

    • PM2 Integration
    • Ubuntu
    • Docker Container
    • Windows
    • Kubernetes
    • Source Code
  • DOCKER

    • Docker Integration
    • Ubuntu
    • Docker Container
    • Windows
    • Kubernetes
    • Source Code
  • GITLAB

    • Gitlab Integration
    • Ubuntu
    • Docker
    • Windows
    • Kubernetes
    • Source
  • ELASTICSEARCH

    • Elasticsearch Integration
    • Ubuntu
    • Docker Container
    • Windows
    • Kubernetes
    • Source Code

Windows

1. Create a monitoring role

CREATE USER watchlog_monitor WITH PASSWORD 'your_password';
GRANT pg_monitor TO watchlog_monitor;

GRANT CONNECT ON DATABASE myapp TO watchlog_monitor;

pg_monitor exists from PostgreSQL 10. On 9.6 use pg_read_all_stats instead.

Allow the role to connect in pg_hba.conf, usually at:

C:\Program Files\PostgreSQL\16\data\pg_hba.conf
host    all    watchlog_monitor    127.0.0.1/32    scram-sha-256

Then reload:

Restart-Service -Name "postgresql-x64-16"

2. Install pg_stat_statements (optional but recommended)

This unlocks the Queries and Slow Queries tabs. Watchlog will never install it for you.

Edit postgresql.conf:

shared_preload_libraries = 'pg_stat_statements'
pg_stat_statements.track = top

shared_preload_libraries needs a full restart, not a reload:

Restart-Service -Name "postgresql-x64-16"

Then, once per database:

\c myapp
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;

3. Configure the agent

  1. Open the config file:
    C:\Program Files\watchlog-agent\integration.json
    
  2. Locate the PostgreSQL section:

{ "service": "postgresql", "monitor": false, "host": "localhost", "port": "5432", "username": "", "password": "", "database": [] }

3. Change `"monitor"` to `true` and update the fields:
```diff
-  "monitor": false
+  "monitor": true
  1. Populate the database array, e.g.:

    "database": ["myapp", "analytics"]
    

    Cluster-wide metrics need no list. This array decides which databases get per-table and per-index detail, because those views only describe the database you are connected to.

  2. Restart the service:

    Restart-Service -Name "WatchlogAgent"
    

Verify

$env:PGPASSWORD='your_password'
psql -h 127.0.0.1 -U watchlog_monitor -d postgres -c "SELECT current_setting('server_version');"
psql -h 127.0.0.1 -U watchlog_monitor -d postgres -c "SELECT count(*) FROM pg_stat_database;"
psql -h 127.0.0.1 -U watchlog_monitor -d myapp   -c "SELECT left(query,40) FROM pg_stat_statements LIMIT 1;"

If the last one returns <insufficient privilege>, the role is missing pg_read_all_stats — grant pg_monitor.

TLS

{
  "service": "postgresql",
  "monitor": true,
  "host": "pg.internal",
  "port": "5432",
  "username": "watchlog_monitor",
  "password": "your_password",
  "database": ["myapp"],
  "ssl": true
}

The agent uses the Windows certificate store. A private CA must be installed into Local Computer → Trusted Root Certification Authorities, not the current user's store, because the agent runs as a service.

Slow queries

Nothing to enable beyond the extension. Watchlog reads pg_stat_statements rather than a log file, so there is no threshold to configure server-side and no log write cost.

slowQuery.thresholdMs only decides what the dashboard labels slow. Query text is already normalized by PostgreSQL — see the integration overview for how utility statements are handled, since those are stored verbatim and need scrubbing.

Last Updated:: 8/13/26, 12:54 AM
Contributors: mohammad
Prev
Docker Container
Next
Kubernetes