Log Analyzer Skill
Analyze log files for errors and patterns.
Find Errors
grep -i "error\|exception\|fatal\|critical" {logfile} | tail -20
Count by Level
python3 -c "
import re, collections
with open('{logfile}') as f:
levels = re.findall(r'\b(ERROR|WARN|INFO|DEBUG|FATAL)\b', f.read())
counts = collections.Counter(levels)
for level, count in counts.most_common():
print(f'{level:8s} {count}')
"
Time Range Filter
awk '/2024-01-15 10:00/,/2024-01-15 11:00/' {logfile}
Top Error Messages
grep -i error {logfile} | sort | uniq -c | sort -rn | head -10
Notes
- Summarize findings in a clear format
- Highlight the most critical issues first
- Suggest likely root causes when possible