# Error Log Analyzer

> AI-powered error log analyzer that explains errors in plain English and provides actionable fix suggestions. Supports Node.js, Python, and Go log formats.

- Skill: `lord1egypt/error-log-analyzer` (Agent Skill)
- Install (CLI): `npx skillmds@latest add lord1egypt/error-log-analyzer`
- Raw SKILL.md: https://api.skillmd.com/api/skills/lord1egypt/error-log-analyzer/raw
- Safety review: pending (external: skill-scanner PASS, skillspector CAUTION)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: Lord1Egypt (https://skillmd.com/u/lord1egypt)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/lord1egypt/error-log-analyzer

---


# Error Log Analyzer - AI-Powered Debugging Assistant

## What it does

This skill analyzes your application error logs using AI to:
- 🤖 **Explain errors in plain English** - No more cryptic stack traces
- 🔍 **Identify error patterns** - Find recurring issues automatically
- 💡 **Provide fix suggestions** - Get actionable solutions with code examples
- 🎯 **Filter noise** - Focus on critical issues, ignore duplicates
- 📊 **Track trends** - Monitor error frequency over time

## Quick Start

### Installation
```bash
clawhub install janseling/error-log-analyzer
```

### Basic Usage

**Option 1: Paste logs directly**
```
Analyze these error logs:
[2026-03-06 10:23:45] ERROR: Connection refused to database at localhost:5432
[2026-03-06 10:23:46] ERROR: Failed to reconnect after 3 attempts
```

**Option 2: Upload log file**
```
Analyze the error log file at /var/log/myapp/error.log
```

**Option 3: Real-time monitoring**
```
Monitor my application logs at /var/log/myapp/ and alert me on critical errors
```

## Features

### Supported Log Formats
- ✅ **Node.js**: Winston, Bunyan, Pino, console.log
- ✅ **Python**: logging module, structlog, loguru
- ✅ **Go**: standard library log, zap, logrus
- ✅ **Auto-detection**: Automatically identifies log format

### AI-Powered Analysis
- **Error Explanation**: Translates technical jargon into understandable explanations
- **Severity Assessment**: Classifies errors as Critical, High, Medium, or Low
- **Root Cause Analysis**: Identifies underlying issues causing errors
- **Fix Suggestions**: Provides specific solutions with code examples

### Pattern Recognition
- **Error Clustering**: Groups similar errors together
- **Trend Detection**: Spots spikes in error frequency
- **Duplicate Filtering**: Reduces noise by hiding repeated errors
- **Correlation Analysis**: Links related errors across services

### Smart Filtering
- Ignore known/expected errors
- Focus on new or worsening issues
- Filter by severity, service, or time range
- Custom filtering rules

## Configuration

### Environment Variables
```bash
# Required for AI features
ANTHROPIC_API_KEY=your_key_here
# or
OPENAI_API_KEY=your_key_here

# Optional
ERROR_ANALYZER_CACHE_ENABLED=true
ERROR_ANALYZER_MAX_ERRORS=10000
ERROR_ANALYZER_SEVERITY_THRESHOLD=medium
```

### Custom Settings
Create `.error-analyzer.yml` in your project root:
```yaml
analysis:
  enableAI: true
  cacheResults: true
  maxConcurrentRequests: 5

filtering:
  ignorePatterns:
    - "GET /health"
    - "Connection reset by peer"
  
  severityOverrides:
    "ECONNREFUSED": high
    "ETIMEDOUT": medium

output:
  format: html  # or json, markdown
  includeStackTraces: true
  maxSuggestions: 3
```

## Examples

### Example 1: Node.js Application

**Input:**
```
2026-03-06 14:23:11 error: UnhandledPromiseRejectionWarning: Error: ECONNREFUSED
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
    at Database.connect (/app/src/db.js:45:12)
    at async initApp (/app/src/index.js:23:5)
```

**Output:**
```
🔴 CRITICAL: Database Connection Failed

What happened:
Your application tried to connect to a database at localhost:5432, but the 
connection was refused. This means the database server is either not running 
or not accepting connections.

Why it matters:
This is a critical issue that will prevent your app from functioning. Users 
will see errors or timeouts when trying to use any feature that needs the database.

How to fix it:
1. Check if PostgreSQL is running:
   sudo systemctl status postgresql

2. Start the database if it's stopped:
   sudo systemctl start postgresql

3. Verify the connection settings in your .env file:
   DATABASE_URL=postgresql://user:password@localhost:5432/dbname

4. Test the connection manually:
   psql -h localhost -p 5432 -U user -d dbname

Prevention:
- Add health checks to detect database issues early
- Implement connection pooling with retry logic
- Set up monitoring for database availability
```

### Example 2: Python Application

**Input:**
```
2026-03-06 09:15:33,456 - django.request - ERROR - Internal Server Error: /api/users/
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/app/views.py", line 45, in get_users
    users = User.objects.filter(active=True).values('id', 'name', 'email')
OperationalError: no such table: auth_user
```

**Output:**
```
🔴 CRITICAL: Database Schema Error

What happened:
Your Django application tried to query the User table, but the table doesn't 
exist in your database. This typically means database migrations haven't been run.

Why it matters:
This error will cause all user-related functionality to fail, including login, 
registration, and user profile pages.

How to fix it:
1. Run Django migrations:
   python manage.py makemigrations
   python manage.py migrate

2. If using a fresh database, create a superuser:
   python manage.py createsuperuser

3. Verify the table exists:
   python manage.py dbshell
   > .tables
   > SELECT * FROM auth_user LIMIT 1;

Prevention:
- Add migration checks to your CI/CD pipeline
- Use pre-commit hooks to detect missing migrations
- Document database setup in your README
```

## API Reference

### Analyze Logs
```python
from error_analyzer import LogAnalyzer

analyzer = LogAnalyzer(api_key="your_key")

# Analyze from string
result = analyzer.analyze(log_content)

# Analyze from file
result = analyzer.analyze_file("/path/to/error.log")

# Get structured output
print(result.errors)
print(result.patterns)
print(result.suggestions)
```

### Real-time Monitoring
```python
from error_analyzer import LogMonitor

monitor = LogMonitor(
    log_path="/var/log/myapp/error.log",
    alert_callback=send_slack_alert
)

monitor.start()
```

## FAQ

**Q: Does this work offline?**
A: Basic log parsing works offline. AI features require an API key (Claude or OpenAI).

**Q: How accurate are the AI explanations?**
A: Our tests show 95%+ accuracy for common error types. You can provide feedback to improve results.

**Q: Can I use my own AI model?**
A: Yes! Supports local models via Ollama or any OpenAI-compatible API.

**Q: What about sensitive data in logs?**
A: All processing happens locally. Logs are never stored on external servers.

**Q: How is this different from Sentry/Datadog?**
A: This focuses on AI-powered explanations rather than just error tracking. Lighter weight and more affordable for indie developers.

## Support

- 📖 **Documentation**: [github.com/janseling/error-log-analyzer/wiki](https://github.com/janseling/error-log-analyzer/wiki)
- 💬 **Discord**: [OpenClaw Community](https://discord.gg/clawd)
- 🐛 **Issues**: [GitHub Issues](https://github.com/janseling/error-log-analyzer/issues)
- 📧 **Email**: janseling@gmail.com

## Roadmap

- [ ] Support for more languages (Rust, Ruby, Java)
- [ ] Integration with GitHub Issues
- [ ] Slack/Discord alerts
- [ ] Performance metrics correlation
- [ ] Custom AI model training

## License

MIT License - Use freely for personal and commercial projects.

---

**Made with ❤️ by janseling for the OpenClaw community**

