This skill analyzes application logs and identifies issues.
Overview
Detects errors, warnings, and patterns from large volumes of log files, and analyzes root causes.
Key Features
- Error Detection: Exceptions, stack traces, error messages
- Pattern Recognition: Recurring issues
- Time Series Analysis: Error occurrence trends
- Root Cause Analysis: Estimate the cause of issues from logs
- Statistics: Error rate, response time, etc.
- Alert Generation: Anomaly detection and notification
- Log Level Classification: ERROR、WARN、INFO、DEBUG
Usage
以下のログを分析:
[ログファイルの内容]
分析項目:
- エラーの種類と頻度
- 根本原因の推定
- 解決策の提案
Analysis Examples
Error Log Analysis
Input Log:
2024-06-15 10:23:45 ERROR [database] Connection timeout after 30s
2024-06-15 10:23:50 ERROR [database] Connection timeout after 30s
2024-06-15 10:24:12 ERROR [database] Connection timeout after 30s
2024-06-15 10:25:33 ERROR [api] Failed to fetch user data: Database unavailable
2024-06-15 10:25:34 ERROR [api] Failed to fetch user data: Database unavailable
Analysis Results:
# ログ分析レポート
## サマリー
- **分析期間**: 2024-06-15 10:23:45 - 10:25:34 (2分間)
- **総ログ数**: 450行
- **エラー数**: 5件
- **警告数**: 12件
## 検出された問題
### [CRITICAL] データベース接続タイムアウト
**頻度**: 3回(10:23:45 - 10:24:12)
**影響**: API リクエスト失敗(2件)
**ログパターン**:
ERROR [database] Connection timeout after 30s
**根本原因(推定)**:
1. データベースサーバーの過負荷
2. ネットワーク接続の問題
3. コネクションプールの枯渇
**推奨アクション**:
1. データベースのCPU/メモリ使用率を確認
2. スロークエリログをチェック
3. コネクションプールサイズを確認
4. ネットワーク遅延を計測
### [HIGH] API エラー連鎖
**頻度**: 2回(DB タイムアウト後に発生)
**原因**: データベース障害の波及
## 時系列分析
10:23 ├─ DB connection timeout begins 10:24 ├─ DB connection timeout continues 10:25 ├─ API error occurs (DB unavailable) └─ User request fails
## 統計情報
| メトリクス | 値 |
|----------|-----|
| エラー率 | 1.1% (5/450) |
| 平均レスポンス | 245ms |
| 最大レスポンス | 30,012ms (timeout) |
| 成功率 | 98.9% |
## 推奨対応
### 即時対応
1. データベース接続状況の確認
2. アプリケーション再起動(接続プールリセット)
3. データベースのパフォーマンス確認
### 短期対応
1. コネクションプールサイズの最適化
2. タイムアウト値の見直し
3. リトライロジックの実装
### 長期対応
1. データベースのスケーリング
2. 読み取りレプリカの追加
3. キャッシュ層の導入
Supported Log Formats
- General Format: syslog, Apache, Nginx
- Application: Log4j, Winston, Python logging
- Cloud: CloudWatch, Stackdriver
- JSON: Structured logs
Best Practices
- Structured Logs: Standardize in JSON format
- Appropriate Levels: Use ERROR, WARN, and INFO appropriately
- Context: Include request ID and user ID
- Aggregation: Use log aggregation tools (ELK, Splunk)
Version Information
- Skill Version: 1.0.0
- Last updated: 2025-01-22