⚙️ Analyze error logs with GPT-4o and create GitHub issues plus Slack alerts

⚡ 53 views · ⚙️ DevOps & CI/CD

💡 Pro Tip — If you need GitHub data beyond what the REST API gives you, ScraperNode has a repository scraper that extracts metadata at scale without token rate limits.

View All Scrapers

Description

Analyze error logs with AI and auto-create GitHub issues with fix suggestions


Who is this for

DevOps engineers, SREs, and development teams who want to automate error monitoring and reduce mean time to resolution (MTTR). Ideal for teams using GitHub for issue tracking and Slack for incident response.

What this workflow does

This workflow automates the entire error management lifecycle - from log ingestion to GitHub issue creation and Slack notification - using GPT-4o-powered root cause analysis. When an application error log is received, it parses the payload, checks for duplicates against existing GitHub issues, generates a structured root cause analysis with fix suggestions, creates a formatted GitHub Issue, and routes Slack notifications by severity. A 30-minute Wait node prevents notification flooding.

How to set up

  1. Add your GitHub Personal Access Token (repo scope) credential
  2. Add your OpenAI API credential to the AI analysis node
  3. Add your Slack OAuth2 credential (chat:write scope) to all Slack nodes
  4. Configure n8n Variables: GITHUB_OWNER and GITHUB_REPO
  5. Update Slack channel names (#incident / #dev-alerts) to match your workspace
  6. Activate the workflow and copy the webhook URL for your application logger

Requirements

How to customize

Adjust the duplicate detection score threshold (default 60) in the Code node. Modify the GPT-4o prompt to focus on specific error categories. The Wait node duration (30 minutes) can be tuned to match your alerting policy.


Key features


Node List

#Node NameTypePurpose
1Webhook for Error LogsWebhookAccepts error log payload via HTTP POST
2Parse and Enrich LogCodeNormalizes level, extracts error type, builds duplicate search keyword
3Search GitHub IssuesGitHubFetches open issues labeled bug,auto-generated from the target repo
4Score GitHub Issue DuplicatesCodeScores each issue for similarity; flags duplicates at threshold ≥ 60
5Check for DuplicatesIfRoutes to skip path (true) or analysis path (false)
6Notify Duplicate to SlackSlackPosts link to existing issue when duplicate detected
7Respond with Duplicate StatusRespond to WebhookReturns 200 OK JSON acknowledgment for duplicate path
8OpenAI Error AnalysisOpenAIGPT-4o analyzes root cause and returns structured JSON fix suggestions
9Build GitHub Issue BodyCodeParses AI JSON and builds Markdown issue body with tables and code blocks
10Create GitHub IssueGitHubCreates GitHub issue with title, body, and dynamic labels
11If Critical ErrorIfChecks isCritical flag to route Slack notification channel
12Post Critical Alert to SlackSlackPosts @here alert to #incident with full error details
13Post Error Summary to SlackSlackPosts summary to #dev-alerts with GitHub issue link
14Wait 30 MinutesWaitEnforces 30-minute cooldown to prevent notification flooding

Total: 14 nodes (+ 6 Sticky Notes)


Sticky Note Compliance

#Sticky Note TitleColorRole
1Main Sticky Note (Overview)YellowWorkflow overview, How it works, Setup steps, Customization
2Receive and parse logWhiteCovers webhook reception and log parsing
3Check for duplicate GitHub issuesWhiteCovers GitHub search and duplicate scoring
4Handle duplicates and notifyWhiteCovers duplicate branch (notification + webhook response)
5Analyze error and suggest fixesWhiteCovers AI analysis and issue creation
6Send alerts and summarizeWhiteCovers severity check, Slack notifications, and wait

All sticky notes use H2 headings (## ) and follow n8n public guidelines.


Webhook payload schema

{
  "service": "payment-api",
  "level": "CRITICAL",
  "message": "NullPointerException at PaymentProcessor.java:142",
  "stack_trace": "java.lang.NullPointerException...",
  "environment": "production",
  "timestamp": "2025-01-15T09:23:45Z",
  "trace_id": "abc-123-xyz",
  "endpoint": "/api/v2/payments",
  "http_method": "POST",
  "status_code": 500,
  "user_id": "user_98765"
}

Required fields: service, level, message Optional fields: All others - missing values are handled gracefully with fallbacks.


How duplicate detection works

Match conditionPoints
Service name found in issue title+40
Error type found in issue title+40
Keyword overlap (words > 4 chars)+5 per word (max +20)

Threshold: Score ≥ 60 → duplicate detected → skip issue creation, notify Slack.


Tags

ai gpt-4 openai github slack error-monitoring devops automation

🔗 Nodes Used

GitHub, Slack, Webhook, OpenAI

📥 Import

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

📖 Importing guide · 🔑 Credential setup