Ubuntu
- Ensure the Watchlog agent is installed. You can follow the Installation Guide.
- Open the watchlist configuration file:
sudo nano /opt/watchlog/agent/src/log-watchlist.json
- Define the logs you want to monitor. For example:
{ "logs": [ { "name": "Nginx Access Logs", "path": "/var/log/nginx/access.log", "service": "nginx", "format": "auto" }, { "name": "Redis Logs", "path": "/var/log/redis/redis.log", "service": "redis", "format": "custom", "pattern": "^(\\d{2} \\w{3} \\d{2}:\\d{2}:\\d{2}) (\\w+): (.*)$" } ] }
- Explanation of fields:
name
: A friendly name for this log stream.path
: Full filesystem path to the log file.service
: The service name used for categorization.format
:auto
: Watchlist auto-detects common log formats.custom
: Use thepattern
field to define a regular expression.
pattern
: A regex with three capture groups for:- Date/Time
- Log Level (e.g., INFO, ERROR, DEBUG)
- Message content.
- Save the file and reload the agent:
sudo pm2 reload watchlog-agent