Log Analyzer
by holsee
|
Skill Details
Repository Files
5 files in this skill directory
name: log-analyzer description: | Production log analysis and diagnostics skill. Use this skill when asked to:
- Fetch logs from a monitoring API
- Analyze log patterns and errors
- Diagnose production issues
- Generate log summaries and statistics license: MIT compatibility: python3, requests allowed-tools: Bash(python3:*) Read Write
Log Analyzer Skill
A production monitoring skill for fetching, analyzing, and diagnosing issues from application logs.
Available Scripts
1. Fetch Logs (fetch_logs.py)
Fetches logs from a REST API endpoint.
# Fetch last 100 logs
python3 scripts/fetch_logs.py --endpoint "http://localhost:8080/api/logs" --limit 100
# Fetch logs with time range
python3 scripts/fetch_logs.py --endpoint "http://localhost:8080/api/logs" \
--start "2024-01-15T00:00:00" --end "2024-01-15T23:59:59"
# Fetch logs by severity
python3 scripts/fetch_logs.py --endpoint "http://localhost:8080/api/logs" \
--level ERROR
Options:
--endpoint- REST API URL for logs (required)--limit- Maximum number of logs to fetch (default: 100)--start- Start time (ISO 8601 format)--end- End time (ISO 8601 format)--level- Filter by log level (DEBUG, INFO, WARN, ERROR)--output- Output file (default: stdout)
2. Parse Logs (parse_logs.py)
Parses log files in various formats.
# Parse JSON logs
python3 scripts/parse_logs.py --format json logs.json
# Parse text logs with pattern
python3 scripts/parse_logs.py --format text --pattern "%(timestamp)s %(level)s %(message)s" app.log
# Parse and filter by level
python3 scripts/parse_logs.py logs.json --level ERROR
Supported Formats:
json- JSON lines formattext- Plain text with patternauto- Auto-detect format
3. Analyze Logs (analyze.py)
Analyzes logs for patterns, errors, and anomalies.
# Full analysis
python3 scripts/analyze.py logs.json
# Error analysis only
python3 scripts/analyze.py logs.json --errors-only
# Generate summary
python3 scripts/analyze.py logs.json --summary
# Find patterns
python3 scripts/analyze.py logs.json --patterns
Analysis Types:
- Error frequency and patterns
- Response time anomalies
- Request volume trends
- Common error messages
- Suggested diagnostics
Example Workflow
-
Fetch recent logs:
python3 scripts/fetch_logs.py --endpoint "http://api.example.com/logs" \ --limit 500 --output recent_logs.json -
Analyze for errors:
python3 scripts/analyze.py recent_logs.json --errors-only -
Get summary:
python3 scripts/analyze.py recent_logs.json --summary
Log Format Reference
See references/log_formats.md for supported log formats and examples.
Tips
- Always start by fetching recent logs with a reasonable limit
- Use
--errors-onlyfor quick triage - Use
--summaryto understand overall health - Check
--patternsto find recurring issues
Related Skills
Attack Tree Construction
Build comprehensive attack trees to visualize threat paths. Use when mapping attack scenarios, identifying defense gaps, or communicating security risks to stakeholders.
Grafana Dashboards
Create and manage production Grafana dashboards for real-time visualization of system and application metrics. Use when building monitoring dashboards, visualizing metrics, or creating operational observability interfaces.
Matplotlib
Foundational plotting library. Create line plots, scatter, bar, histograms, heatmaps, 3D, subplots, export PNG/PDF/SVG, for scientific visualization and publication figures.
Scientific Visualization
Create publication figures with matplotlib/seaborn/plotly. Multi-panel layouts, error bars, significance markers, colorblind-safe, export PDF/EPS/TIFF, for journal-ready scientific plots.
Seaborn
Statistical visualization. Scatter, box, violin, heatmaps, pair plots, regression, correlation matrices, KDE, faceted plots, for exploratory analysis and publication figures.
Shap
Model interpretability and explainability using SHAP (SHapley Additive exPlanations). Use this skill when explaining machine learning model predictions, computing feature importance, generating SHAP plots (waterfall, beeswarm, bar, scatter, force, heatmap), debugging models, analyzing model bias or fairness, comparing models, or implementing explainable AI. Works with tree-based models (XGBoost, LightGBM, Random Forest), deep learning (TensorFlow, PyTorch), linear models, and any black-box model
Pydeseq2
Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.
Query Writing
For writing and executing SQL queries - from simple single-table queries to complex multi-table JOINs and aggregations
Pydeseq2
Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.
Scientific Visualization
Meta-skill for publication-ready figures. Use when creating journal submission figures requiring multi-panel layouts, significance annotations, error bars, colorblind-safe palettes, and specific journal formatting (Nature, Science, Cell). Orchestrates matplotlib/seaborn/plotly with publication styles. For quick exploration use seaborn or plotly directly.
