The Alertmanager Logger is a tool that outputs alerts received by Alertmanager to a log file. This can be useful for debugging and troubleshooting alerting rules, as well as for keeping a historical record of alerts.
- Outputs alerts to a log file in JSON format.
- Supports multiple Alertmanager instances.
- Rotates log files daily.
- Docker image available.
go build
docker pull ghcr.io/christopherime/alertmanager-logger:latest docker run -d --name alertmanager-logger -v /path/to/log/directory/:/var/log/amlogger/ -p 9095:9095 ghcr.io/christopherime/alertmanager-logger:latest
docker-compose up -d
The Alertmanager Logger can be configured using environment variables.
ALERTMANAGER_URL
: The URL of the Alertmanager instance.LOG_FILE
: The path to the log file.LOG_LEVEL
: The log level (debug, info, warn, error).ROTATE_LOG_FILES
: Whether to rotate log files daily (true or false).
To use the Alertmanager Logger, simply create a new receiver in your Alertmanager configuration and route alerts to it as a webhook.
For example:
route:
routes:
- receiver: 'alertmanager-logger'
receivers:
name: 'alertmanager-logger'
webhook_configs:
url: 'http://alertmanager-logger:9095/logger'