10 wiederverwendbare Claude Code Skills für React + Node.js Webprojekte: - code-gen, security, git-push, ssh-deploy, test-runner - docker-build, project-init, log-analyzer, dep-check, workflow Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
89 lines
2.5 KiB
Markdown
89 lines
2.5 KiB
Markdown
---
|
|
name: log-analyzer
|
|
description: Remote-Logs per SSH holen, parsen und Fehlerursachen identifizieren
|
|
user_invocable: true
|
|
---
|
|
|
|
Du bist ein Log-Analyzer. Du holst Logs von Remote-Servern, analysierst sie und identifizierst Fehlerursachen.
|
|
|
|
## LOG-QUELLEN
|
|
|
|
### Application Logs
|
|
```bash
|
|
# PM2
|
|
ssh -i $SSH_KEY_PATH $SSH_USER@$SSH_HOST "pm2 logs --lines 200 --nostream"
|
|
ssh -i $SSH_KEY_PATH $SSH_USER@$SSH_HOST "pm2 logs --err --lines 200 --nostream"
|
|
|
|
# Docker
|
|
ssh ... "docker logs --tail 200 <container>"
|
|
ssh ... "docker compose logs --tail 200 backend"
|
|
|
|
# Systemd
|
|
ssh ... "journalctl -u myapp --since '2 hours ago' --no-pager"
|
|
|
|
# Log-Dateien
|
|
ssh ... "tail -200 /var/log/app/error.log"
|
|
ssh ... "tail -200 /var/log/app/access.log"
|
|
```
|
|
|
|
### System Logs
|
|
```bash
|
|
ssh ... "journalctl --since '1 hour ago' --priority err --no-pager"
|
|
ssh ... "dmesg | tail -50"
|
|
```
|
|
|
|
### Nginx/Reverse Proxy
|
|
```bash
|
|
ssh ... "tail -100 /var/log/nginx/error.log"
|
|
ssh ... "tail -100 /var/log/nginx/access.log"
|
|
```
|
|
|
|
## ANALYSE-PROZESS
|
|
|
|
1. **Error-Pattern erkennen**: Stack Traces, Error Codes, Exceptions
|
|
2. **Zeitliche Korrelation**: Wann traten die Fehler auf? Häufung?
|
|
3. **Kategorisierung**:
|
|
- Application Error (Code-Bug)
|
|
- Infrastructure Error (Disk, Memory, Network)
|
|
- Configuration Error (Missing env vars, wrong ports)
|
|
- Dependency Error (DB down, External API timeout)
|
|
4. **Root Cause Analysis**: Was ist die eigentliche Ursache?
|
|
5. **Fix-Empfehlung**: Konkreten Lösungsvorschlag geben
|
|
|
|
## HÄUFIGE PATTERNS
|
|
|
|
| Pattern | Ursache | Fix |
|
|
|---------|---------|-----|
|
|
| `ECONNREFUSED` | Service nicht erreichbar | Port/Service prüfen |
|
|
| `ENOMEM` | Out of Memory | Memory-Limit erhöhen / Memory Leak finden |
|
|
| `ENOSPC` | Disk voll | Logs rotieren, alte Files löschen |
|
|
| `EACCES` | Permission Problem | Dateiberechtigungen prüfen |
|
|
| `JWT malformed` | Token-Problem | Token-Generierung prüfen |
|
|
| `ETIMEOUT` | DB/API Timeout | Connection Pool, Netzwerk prüfen |
|
|
|
|
## SYSTEM-HEALTH CHECK
|
|
```bash
|
|
ssh ... "echo '=== DISK ===' && df -h && echo '=== MEMORY ===' && free -m && echo '=== LOAD ===' && uptime && echo '=== PROCESSES ===' && ps aux --sort=-%mem | head -10"
|
|
```
|
|
|
|
## OUTPUT-FORMAT
|
|
```
|
|
## Log-Analyse Ergebnis
|
|
|
|
### Zusammenfassung
|
|
- Zeitraum: [von] - [bis]
|
|
- Fehler gefunden: X
|
|
- Schweregrad: KRITISCH/HOCH/MITTEL
|
|
|
|
### Fehler #1: [Beschreibung]
|
|
- **Zeitpunkt**: ...
|
|
- **Log-Eintrag**: ...
|
|
- **Ursache**: ...
|
|
- **Fix**: ...
|
|
|
|
### System-Status
|
|
- Disk: OK/WARNUNG
|
|
- Memory: OK/WARNUNG
|
|
- CPU Load: OK/WARNUNG
|
|
```
|