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. Install mongosh

Advanced collection requires mongosh on the agent's host. Without it the agent falls back to basic metrics only.

mongosh --version

If it is missing, install the MongoDB Shell from the MongoDB download centre and make sure its directory is on the system PATH — the agent runs as a service, so a PATH set only for your user account will not be visible to it.

2. Create a monitoring user

mongosh --host 127.0.0.1 --port 27017

use admin
db.createUser({
  user: "watchlog_monitor",
  pwd: "your_password",
  roles: [
    { role: "clusterMonitor", db: "admin" },
    { role: "readAnyDatabase", db: "admin" }
  ]
})

3. Configure the agent

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

{ "service": "mongodb", "monitor": false, "host": "localhost", "port": "27017", "username": "", "password": "", "authDatabase": "admin", "tls": false }

3. Change `"monitor"` to `true` and fill in the credentials:
```diff
-  "monitor": false
+  "monitor": true

authDatabase is where the user is defined — admin for the user created above, not the database you want to monitor. 4. Restart the service:

Restart-Service -Name "WatchlogAgent"

Verify

mongosh --host localhost --port 27017 `
  -u watchlog_monitor -p 'your_password' `
  --authenticationDatabase admin `
  --quiet --eval 'db.adminCommand({ serverStatus: 1 }).ok'

1 means the agent will connect.

If this works from your PowerShell session but the agent still reports nothing, the service account most likely cannot see mongosh on its PATH. Confirm with:

[Environment]::GetEnvironmentVariable("Path", "Machine") -split ';' | Select-String mongosh

TLS

{
  "service": "mongodb",
  "monitor": true,
  "host": "mongo.internal",
  "port": "27017",
  "username": "watchlog_monitor",
  "password": "your_password",
  "authDatabase": "admin",
  "tls": 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 — the agent runs as a service.

Slow queries (optional)

The profiler is off by default and Watchlog never enables it. Turn it on yourself for the databases you want traced:

use myapp
db.setProfilingLevel(1, { slowms: 100 })

Then in integration.json:

"slowQuery": {
  "enabled": true,
  "threshold": 100,
  "maxPerScrape": 100
}

See the integration overview for what is stored and what is deliberately normalized away.

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