⚙️ Send deduplicated Kubernetes(EKS/GKE/AKS) error logs from Grafana Loki to Slack

332 views · ⚙️ DevOps & CI/CD

Description

✨ Summary

Efficiently monitor Kubernetes environments by sending only unique error logs from Grafana Loki to Slack. Reduces alert fatigue while keeping your team informed about critical log events.

🧑‍💻 Who’s it for

🔍 What it does

This n8n workflow queries your Loki logs every 5 minutes, filters only the critical ones (error, timeout, exception, etc.), removes duplicate alerts within the batch, and sends clean alerts to a Slack channel with full metadata (pod, namespace, node, container, log, timestamp).

🧠 How it works

🕒 Schedule Trigger

Every 5 minutes (customizable)

🌐 Loki HTTP Query

Pulls logs from the last 10 minutes Keyword match: error, failed, oom, etc.

🧹 Log Parsing

Extracts log fields (pod, container, etc.) Skips empty/malformed results

🧠 Deduplication

Removes repeated error messages (within query window)

📤 Slack Notification

Sends nicely formatted message to Slack

⚙️ Requirements

Tool Notes

Loki- Exposed internally or externally Slack App- With chat:write OAuth n8n- Cloud or self-hosted

🔧 How to Set It Up

Import the JSON file into n8n

Update:

🛠 How to Customize

Grafana Loki logs to Slack Output

image.png

🔗 Nodes Used

HTTP Request, Schedule Trigger

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup