log-analyzer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Log Analyzer Skill

Log Analyzer Skill

アプリケーションログを分析し、問題を特定するスキルです。
A skill for analyzing application logs and identifying issues.

概要

Overview

大量のログファイルからエラー、警告、パターンを検出し、根本原因を分析します。
Detects errors, warnings, and patterns from large volumes of log files, and analyzes root causes.

主な機能

Key Features

  • エラー検出: 例外、スタックトレース、エラーメッセージ
  • パターン認識: 繰り返し発生する問題
  • 時系列分析: エラーの発生傾向
  • 根本原因分析: ログから問題の原因を推定
  • 統計情報: エラー率、レスポンスタイム等
  • アラート生成: 異常検知と通知
  • ログレベル分類: ERROR、WARN、INFO、DEBUG
  • Error Detection: Exceptions, stack traces, error messages
  • Pattern Recognition: Recurring issues
  • Time-series Analysis: Error occurrence trends
  • Root Cause Analysis: Estimate issue causes from logs
  • Statistical Information: Error rates, response times, etc.
  • Alert Generation: Anomaly detection and notifications
  • Log Level Classification: ERROR, WARN, INFO, DEBUG

使用方法

Usage

以下のログを分析:

[ログファイルの内容]

分析項目:
- エラーの種類と頻度
- 根本原因の推定
- 解決策の提案
Analyze the following logs:

[Log file content]

Analysis items:
- Error types and frequency
- Root cause estimation
- Solution proposals

分析例

Analysis Example

エラーログ分析

Error Log Analysis

入力ログ:
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
分析結果:
markdown
undefined
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 Result:
markdown
undefined

ログ分析レポート

Log Analysis Report

サマリー

Summary

  • 分析期間: 2024-06-15 10:23:45 - 10:25:34 (2分間)
  • 総ログ数: 450行
  • エラー数: 5件
  • 警告数: 12件
  • Analysis Period: 2024-06-15 10:23:45 - 10:25:34 (2 minutes)
  • Total Logs: 450 lines
  • Error Count: 5
  • Warning Count: 12

検出された問題

Detected Issues

[CRITICAL] データベース接続タイムアウト

[CRITICAL] Database Connection Timeout

頻度: 3回(10:23:45 - 10:24:12) 影響: API リクエスト失敗(2件)
ログパターン:
ERROR [database] Connection timeout after 30s
根本原因(推定):
  1. データベースサーバーの過負荷
  2. ネットワーク接続の問題
  3. コネクションプールの枯渇
推奨アクション:
  1. データベースのCPU/メモリ使用率を確認
  2. スロークエリログをチェック
  3. コネクションプールサイズを確認
  4. ネットワーク遅延を計測
Frequency: 3 times (10:23:45 - 10:24:12) Impact: API request failures (2 cases)
Log Pattern:
ERROR [database] Connection timeout after 30s
Estimated Root Causes:
  1. Database server overload
  2. Network connection issues
  3. Connection pool exhaustion
Recommended Actions:
  1. Check database CPU/memory usage
  2. Review slow query logs
  3. Verify connection pool size
  4. Measure network latency

[HIGH] API エラー連鎖

[HIGH] API Error Chain

頻度: 2回(DB タイムアウト後に発生) 原因: データベース障害の波及
Frequency: 2 times (occurred after DB timeout) Cause: Impact of database failure

時系列分析

Time-series Analysis

10:23 ├─ DB接続タイムアウト開始
10:24 ├─ DB接続タイムアウト継続
10:25 ├─ API エラー発生(DB不可)
      └─ ユーザーリクエスト失敗
10:23 ├─ DB connection timeout starts
10:24 ├─ DB connection timeout continues
10:25 ├─ API error occurs (DB unavailable)
      └─ User request failure

統計情報

Statistical Information

メトリクス
エラー率1.1% (5/450)
平均レスポンス245ms
最大レスポンス30,012ms (timeout)
成功率98.9%
MetricValue
Error Rate1.1% (5/450)
Average Response245ms
Maximum Response30,012ms (timeout)
Success Rate98.9%

推奨対応

Recommended Responses

即時対応

Immediate Actions

  1. データベース接続状況の確認
  2. アプリケーション再起動(接続プールリセット)
  3. データベースのパフォーマンス確認
  1. Check database connection status
  2. Restart application (reset connection pool)
  3. Verify database performance

短期対応

Short-term Actions

  1. コネクションプールサイズの最適化
  2. タイムアウト値の見直し
  3. リトライロジックの実装
  1. Optimize connection pool size
  2. Review timeout values
  3. Implement retry logic

長期対応

Long-term Actions

  1. データベースのスケーリング
  2. 読み取りレプリカの追加
  3. キャッシュ層の導入
undefined
  1. Scale the database
  2. Add read replicas
  3. Introduce cache layer
undefined

サポートログ形式

Supported Log Formats

  • 一般形式: syslog, Apache, Nginx
  • アプリケーション: Log4j, Winston, Python logging
  • クラウド: CloudWatch, Stackdriver
  • JSON: 構造化ログ
  • General Formats: syslog, Apache, Nginx
  • Applications: Log4j, Winston, Python logging
  • Cloud: CloudWatch, Stackdriver
  • JSON: Structured logs

ベストプラクティス

Best Practices

  1. 構造化ログ: JSON形式で統一
  2. 適切なレベル: ERROR、WARN、INFO を使い分け
  3. コンテキスト: リクエストID、ユーザーIDを含める
  4. 集約: ログ集約ツール(ELK、Splunk)使用
  1. Structured Logs: Standardize in JSON format
  2. Appropriate Levels: Use ERROR, WARN, INFO appropriately
  3. Context: Include request IDs, user IDs
  4. Aggregation: Use log aggregation tools (ELK, Splunk)

バージョン情報

Version Information

  • スキルバージョン: 1.0.0
  • 最終更新: 2025-01-22
  • Skill Version: 1.0.0
  • Last Updated: 2025-01-22