⚙️ Aggregate error alerts and send consolidated reports via Email and Jira

21 views · ⚙️ DevOps & CI/CD

Description

Error Alert Aggregator – Email and Jira

This workflow aggregates error logs arriving from multiple sources, deduplicates identical events within a configurable time-window, and sends a single consolidated notification via Email and Jira. It prevents alert fatigue by batching similar errors and guarantees that responsible teams are informed through both channels.

Pre-conditions/Requirements

Prerequisites

Required Credentials

Specific Setup Requirements

SettingRecommended ValueNotes
Batch window (Wait node)10 minutesTime allowed to collect & deduplicate errors
Deduplication key (Code)error_id or message fieldChoose a unique attribute representing the same incident
Email recipientsSecurity & DevOps distribution listUse semicolons for multiple addresses
Jira project keySECProject where alert tickets should be filed

How it works

This workflow aggregates error logs arriving from multiple sources, deduplicates identical events within a configurable time-window, and sends a single consolidated notification via Email and Jira. It prevents alert fatigue by batching similar errors and guarantees that responsible teams are informed through both channels.

Key Steps:

Set up steps

Setup Time: 15-20 minutes

  1. Import template: Download the JSON template and drag & drop it into your n8n editor.
  2. Configure Schedule Trigger: Set polling interval (e.g., every 5 minutes).
  3. HTTP Request Node:
    • Enter the URL of your log endpoint.
    • Add authentication if required.
  4. Adjust IF filter: Modify the condition to match your log’s error severity field (status === "error").
  5. Customize Code Node:
    • Replace error_id with the field that uniquely identifies an error.
    • Optionally tweak deduplication TTL.
  6. Wait Node: Set the batch time (e.g., 600 seconds).
  7. Set Node: Edit the email subject/body and Jira issue summary/description placeholders.
  8. Credentials:
    • Add or select your Email credential in Email Send.
    • Add or select your Jira credential in Jira node.
  9. Test run the workflow to verify that:
    • Duplicate events are collapsed.
    • Email and Jira tickets show combined information.
  10. Activate the workflow to start production monitoring.

Node Descriptions

Core Workflow Nodes:

Data Flow:

  1. Schedule TriggerHTTP RequestIFCode
  2. CodeWaitMergeSet
  3. SetEmail Send & Jira

Customization Examples

Change Deduplication Strategy

// Code Node snippet
// Use error 'stacktrace' + 'service' for uniqueness
const signature = `${item.json.stacktrace}_${item.json.service}`;
if ($workflow.staticData.signatureCache?.includes(signature)) {
  // duplicate, skip
  return [];
}
$workflow.staticData.signatureCache = [
  ...( $workflow.staticData.signatureCache || [] ),
  signature
];
return item;

Update Existing Jira Issue Instead of Creating New

// Jira Node settings
// Search for an open ticket with the same summary
// If found, add a comment instead of creating
{
  "operation": "comment",
  "issueKey": "={{$node['Set'].json['jiraIssueKey']}}",
  "comment": "New occurrences: {{$json.errorCount}}"
}

Data Output Format

The workflow outputs structured JSON data:

{
  "errors": [
    {
      "id": "ERR123",
      "message": "Database timeout",
      "count": 5,
      "firstSeen": "2024-03-14T10:12:00Z",
      "lastSeen": "2024-03-14T10:22:00Z"
    }
  ],
  "emailStatus": "success",
  "jiraStatus": "issue_created"
}

Troubleshooting

Common Issues

  1. No data returned from HTTP Request – Verify endpoint URL, authentication headers, and that your monitoring tool actually has recent error events.
  2. Duplicate alerts still coming through – Increase the Wait node’s batching window or refine the deduplication key in the Code node.

Performance Tips

Pro Tips:


This is a community-contributed n8n workflow template provided “as-is.” Thoroughly test in a non-production environment before deploying to production.

🔗 Nodes Used

Send Email, HTTP Request, Jira Software, Schedule Trigger

📥 Import

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

📖 Importing guide · 🔑 Credential setup