バグ #741
未完了
ログ管理機能実装 - 統合ログ検索・解析 (子チケット)
Redmine Admin さんが約13時間前に追加.
約6時間前に更新.
説明
ログ管理機能実装 - 統合ログ検索・解析¶
🎯 概要¶
VPS-ROOT環境の各種ログファイルを統合管理し、検索・解析・エクスポート機能を実装します。
📋 実装対象¶
1. API エンドポイント¶
-
GET /api/v1/logs/files
- ログファイル一覧取得
-
GET /api/v1/logs/content/:filename
- ログ内容取得
-
GET /api/v1/logs/search
- ログ検索
-
GET /api/v1/logs/tail/:filename
- リアルタイムログ表示
-
POST /api/v1/logs/export
- ログエクスポート
-
POST /api/v1/logs/rotate
- ログローテーション
2. 主要関数¶
getLogFiles(): Promise<LogFile[]>
readLogFile(filename: string, options?: ReadOptions): Promise<string>
searchLogs(query: string, filters?: LogFilters): Promise<LogEntry[]>
streamLogFile(filename: string): Promise<NodeJS.ReadableStream>
exportLogs(criteria: ExportCriteria): Promise<ExportResult>
rotateLogFiles(): Promise<RotationResult>
3. UI コンポーネント¶
-
LogViewerPage.tsx
- ログ管理画面
-
LogViewerTerminal
- ログ表示ターミナル
-
LogFileSelector
- ログファイル選択
-
LogSearchInput
- ログ検索入力
-
DateTimeRangePicker
- 日時範囲選択
🔧 技術仕様¶
対象ログファイル¶
- アプリケーションログ:
/app/logs/*
- Nginxログ:
/var/log/nginx/*
- システムログ:
/var/log/syslog
, /var/log/messages
- Dockerログ: Docker コンテナログ統合
- セキュリティログ:
/var/log/auth.log
検索・解析機能¶
- 全文検索・正規表現対応
- ログレベルフィルタリング
- 日時範囲指定検索
- リアルタイムログストリーミング
- 異常パターン検知
✅ 完了条件¶
🔗 関連チケット¶
親チケット: インフラヘルパーサービス基盤構築
📅 期限¶
Phase 1 - 基盤実装: 2025年6月30日まで
📋 ログ管理機能実装 - 現状・詳細仕様追記¶
🔍 現在の実装状況
API エンドポイント実装状況 (/api/v1/logs
)¶
エンドポイント |
メソッド |
実装状況 |
パラメータ |
レスポンス |
/files |
GET |
📋 設計完了 |
- |
{logFiles[]} |
/files/:filename |
GET |
📋 設計完了 |
?lines&offset |
{content} |
/files/:filename/tail |
GET |
📋 設計完了 |
?lines=100 |
{content} |
/files/:filename/stream |
GET |
📋 設計完了 |
- |
WebSocket |
/search |
POST |
⭕ 未着手 |
{query, filters} |
{results[]} |
/export |
POST |
⭕ 未着手 |
{criteria} |
{downloadUrl} |
/rotate |
POST |
⭕ 未着手 |
- |
{success} |
/cleanup |
POST |
⭕ 未着手 |
{retentionDays} |
{deletedFiles} |
/analysis |
GET |
⭕ 未着手 |
?timeRange |
{analysis} |
/anomalies |
GET |
⭕ 未着手 |
- |
{anomalies[]} |
関数実装状況 (0/15 開発中、4/15 設計完了、11/15 未着手)¶
ファイル: /src/services/logs/LogManagementService.ts
📋 基本ログ操作関数 (設計完了)¶
// ログファイル操作 - 設計完了
async getLogFiles(): Promise<LogFile[]> // 設計完了
async readLogFile(filename: string, options?: ReadOptions): Promise<string> // 設計完了
async tailLogFile(filename: string, lines?: number): Promise<string> // 設計完了
async streamLogFile(filename: string): Promise<NodeJS.ReadableStream> // 設計完了
⭕ 高度なログ管理機能 (未着手)¶
// ログ検索・分析 - 未着手
async searchLogs(query: string, filters?: LogFilters): Promise<LogEntry[]> // 未着手
async searchLogsWithRegex(pattern: string, options?: RegexOptions): Promise<LogEntry[]> // 未着手
async analyzeLogPatterns(timeRange?: TimeRange): Promise<LogAnalysis> // 未着手
async detectLogAnomalies(): Promise<Anomaly[]> // 未着手
// ログ管理 - 未着手
async exportLogs(criteria: ExportCriteria): Promise<ExportResult> // 未着手
async rotateLogs(): Promise<RotationResult> // 未着手
async cleanupOldLogs(retentionDays: number): Promise<CleanupResult> // 未着手
async compressLogs(pattern: string): Promise<CompressionResult> // 未着手
// 統合ログ収集 - 未着手
async collectLogsFromSource(source: LogSource, options?: CollectOptions): Promise<LogEntry[]> // 未着手
async aggregateLogsFromMultipleSources(sources: LogSource[]): Promise<AggregatedLogs> // 未着手
async setupLogWatchers(): Promise<void> // 未着手
🔧 技術仕様詳細
対象ログファイル¶
- ✅ アプリケーションログ:
/app/logs/*
- ✅ Nginxログ:
/var/log/nginx/*
- ✅ システムログ:
/var/log/syslog
, /var/log/messages
- ✅ Dockerログ: Docker コンテナログ統合
- ✅ セキュリティログ:
/var/log/auth.log
検索・解析機能 (未着手)¶
- ⭕ 全文検索・正規表現対応
- ⭕ ログレベルフィルタリング
- ⭕ 日時範囲指定検索
- ✅ リアルタイムログストリーミング (設計完了)
- ⭕ 異常パターン検知
📈 進捗サマリー
-
API エンドポイント: 0/10 (0%) 開発中、4/10 (40%) 設計完了、6/10 (60%) 未着手
-
ログ管理関数: 0/15 (0%) 開発中、4/15 (27%) 設計完了、11/15 (73%) 未着手
-
UI コンポーネント: 要実装
-
検索機能: 未着手
-
リアルタイム表示: 設計完了
基本ログ表示・ストリーミング機能は設計完了。高度な検索・解析・管理機能が大部分未着手。まずは基本機能から実装!
他の形式にエクスポート: Atom
PDF