How LoggiFly Simplifies Docker Log Monitoring and Automated Alerts
LoggiFly is a lightweight Docker log monitoring tool that detects predefined keywords or regex patterns, supports multi‑channel notifications, can automatically restart or stop containers, and offers flexible deployment via environment variables or YAML configuration, helping ops teams maintain stable containerized environments.
What Is LoggiFly?
LoggiFly is a lightweight container‑log monitoring tool designed for Docker. It watches container logs for predefined keywords or regular expressions and can trigger container restart or stop actions when issues are detected.
Key Features
Flexible detection: supports keywords, regex, and multi‑line log analysis.
Multi‑channel alerts: integrates with Ntfy, Apprise, Slack, Discord, Email, and other services.
Proactive control: can automatically restart or stop containers to prevent fault propagation.
Ease of use: offers quick deployment via environment variables and advanced YAML configuration.
Log attachment: automatically includes relevant log files in notifications.
How to Use LoggiFly
1. Choose a Deployment Method
Environment variables: simple and fast for basic needs.
YAML configuration: supports complex regex, per‑container keywords, and custom restart/stop actions.
Below is a minimal
docker‑composeconfiguration to get started:
<code>version: "3.8"
services:
loggifly:
image: ghcr.io/clemcer/loggifly:latest
container_name: loggifly
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
# - ./config.yaml:/app/config.yaml # optional when using env vars only
environment:
# At least one notification service must be set
NTFY_URL: "https://ntfy.sh"
NTFY_TOPIC: "your_topic"
# Optional credentials
# NTFY_TOKEN: "..."
# NTFY_USERNAME: "..."
# NTFY_PASSWORD: "..."
APPRISE_URL: "discord://..."
CONTAINERS: "vaultwarden,audiobookshelf"
GLOBAL_KEYWORDS: "error,登录失败,密码错误"
GLOBAL_KEYWORDS_WITH_ATTACHMENT: "严重错误"
restart: unless-stopped
</code>For more advanced configurations, visit the GitHub repository: github.com/clemcer/loggifly .
2. Configuration Details
The
config.yamlfile is divided into four main sections:
settings: global options such as cooldown periods and log levels (optional, defaults provided).
notifications: configure Ntfy or Apprise service details.
containers: define which containers to monitor and their specific keywords or actions.
global_keywords: keywords that apply to all monitored containers.
3. Practical Tips
Ensure the container name exactly matches the output of
docker ps --format "{{.Names}}".
Define
container_nameexplicitly in your Compose file for reliable identification.
action_keywordsare only supported via
config.yaml; the minimum
action_cooldownis 60 seconds (default 300 seconds).
Test regular expressions with regex101.com before deployment.
Docker socket proxy issues may cause log streams to disconnect roughly every 10 minutes; LoggiFly will attempt reconnection, but proxy solutions are not officially recommended.
For multi‑line logs, ensure LoggiFly can recognize the log start pattern (e.g., timestamps or log levels).
Conclusion
LoggiFly provides a powerful yet easy‑to‑use solution for Docker container log monitoring and notification. Its flexible detection methods, wide range of alert channels, automated container control, and fine‑grained configuration help operations teams efficiently monitor logs and improve the stability and reliability of containerized applications.
Official repository: https://github.com/clemcer/loggifly
Efficient Ops
This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.