Use this powerful n8n workflow to monitor Kubernetes logs stored in Grafana Loki, automatically deduplicate recurring errors using a custom n8n node, and send unique, actionable alerts directly to Slack.
Download this n8n workflow template and start using it instantly.
Managing logs from large Kubernetes clusters (EKS, GKE, AKS) can quickly overwhelm monitoring channels like Slack if the same error repeats hundreds of times. This advanced n8n workflow solves the problem of alert fatigue by acting as an intelligent intermediary between Grafana Loki and Slack. The core value of this n8n template lies in its custom deduplication logic. After fetching the raw error logs, a specialized n8n node processes them, normalizing the log text (e.g., stripping unique timestamps and IDs) to identify truly similar errors within the batch. Only unique, parsed errors are forwarded, ensuring that your team receives clear, actionable alerts without being flooded by spam. This robust n8n automation provides a clean, scheduled monitoring solution.
This n8n workflow operates on a fixed schedule, functioning as a pull-based alerting mechanism:
"error" within the specified time range (the last 10 minutes).debug or info that might have been accidentally caught by the initial Loki query.Set to filter out any identical alerts found within the current 5-minute batch, ensuring that this n8n automation only passes truly unique events.chat.postMessage method to deliver the remaining deduplicated alerts to the specified #k8s-alerts channel. The message is richly formatted, including critical metadata (Pod, Namespace, Timestamp) and the full error log.To deploy this powerful n8n workflow, follow these steps:
📥 Query Loki for Error Logs n8n node.query parameter if you need to target different namespaces or specific error patterns.📤 Send Alerts to Slack n8n node requires 'HTTP Bearer Auth'.xoxb-).channel value (#k8s-alerts) matches your target Slack channel. 🕒 Every 5 Min Trigger (Schedule Trigger n8n node):
Function: Serves as the primary n8n trigger, initiating the data collection process every 5 minutes.
Key Configuration: Runs on a fixed interval of 5 minutes.
📥 Query Loki for Error Logs (HTTP Request n8n node):
Function: Executes the necessary PromQL query against the Loki API to fetch raw error logs.
Key Configuration: Uses a GET method; dynamically calculates start (10 minutes ago) and end (now) using n8n expressions for effective time-boxing.
🧹 Extract Log Fields (Code n8n node):
Function: Custom JavaScript logic to parse complex nested log data, extract critical fields (log message, pod, namespace, container), and filter out unwanted log levels (debug, info). This is a complex logic n8n node crucial for data preparation.
🧠 Remove Duplicate Alerts (Code n8n node):
Function: Implements the custom deduplication algorithm. It normalizes logs by masking dynamic values (timestamps, IDs) before comparing them. This ensures that the n8n workflow sends only one alert per unique error pattern in the time window.
📤 Send Alerts to Slack (HTTP Request n8n node):
Function: Sends the final, cleaned, and deduplicated alert messages to the configured Slack channel using a Bearer Token credential.
* Key Configuration: Uses a POST method, httpBearerAuth for authentication, and constructs a detailed message payload using dynamic n8n expressions ({{$json["pod"]}}, {{$json["log"]}}).
Use this n8n workflow to automatically fetch daily weather updates for any city using OpenWeatherMap and send them directly to your phone via Plivo SMS, scheduled with an n8n trigger.

Automate daily weather reports using the Meteosource API and Gmail. This n8n workflow template runs daily, delivering key forecasts directly to your inbox.

Use this powerful n8n workflow to automate fetching daily comics, translating the dialogue using OpenAI's vision model, and sending the results directly to Discord. Explore complex n8n templates for content delivery and language processing.

Use this robust n8n workflow to send personalized 10-minute interview reminders from Google Calendar events directly to Slack DMs, utilizing a static data ledger to prevent duplicate messages.








































