Log

From masharratt/claude-flow-novice · View interactive version

Log is an AI agent skill from the GitHub repository masharratt/claude-flow-novice. **Specialization**: Distributed logging, log aggregation, and monitoring

How to use this skill

Skill file

CFN Log Operations Skill

Specialization: Distributed logging, log aggregation, and monitoring

Part of: Task 4.4 Distributed Logging Standardization

Overview

The CFN Log Operations skill provides comprehensive logging capabilities for the CFN system, including:

Usage

$HOME/.claude/skills/cfn-operations/lib/log/execute.sh [COMMAND] [OPTIONS]

Commands

search

Search for logs matching specific criteria.

Syntax:

./execute.sh search [OPTIONS]

Options:

Examples:

# Search by correlation ID
./execute.sh search --correlation-id "task:task-001:agent"

# Find all errors in last 24 hours
./execute.sh search --level error --since 24h

# Find logs from specific agent
./execute.sh search --agent-id "backend-dev-001" --format json

# Search with message pattern
./execute.sh search --pattern "connection" --since 2h
aggregate

Aggregate logs from multiple sources into unified log files.

Syntax:

./execute.sh aggregate [OPTIONS]

Options:

Examples:

# Aggregate all logs from last 24 hours
./execute.sh aggregate --source all --since 24h

# Aggregate and deduplicate
./execute.sh aggregate --source filesystem --deduplicate --validate

# Aggregate with compression
./execute.sh aggregate --source docker --compress
rotate

Manage log rotation and retention.

Syntax:

./execute.sh rotate [OPTIONS]

Options:

Examples:

# Rotate all logs
./execute.sh rotate

# Rotate with custom size and retention
./execute.sh rotate --max-size 50M --retention-days 30

# Force rotation with compression
./execute.sh rotate --force --compress
monitor

Monitor logs for errors and performance issues.

Syntax:

./execute.sh monitor [OPTIONS]

Options:

Examples:

# Monitor with default settings
./execute.sh monitor

# Monitor with custom error threshold
./execute.sh monitor --error-threshold 20

# Monitor as daemon with performance checks
./execute.sh monitor --daemon --performance-check --retention-check
stats

Generate log statistics and metrics.

Syntax:

./execute.sh stats [OPTIONS]

Options:

Examples:

# Get log statistics
./execute.sh stats

# Statistics for last 24 hours
./execute.sh stats --since 24h --format json
export

Export logs in various formats.

Syntax:

./execute.sh export [OPTIONS]

Options:

Examples:

# Export to CSV
./execute.sh export --format csv --output logs.csv

# Export errors to JSON
./execute.sh export --filter "level==error" --format json

Log Format Specification

All logs follow the standardized JSON format:

{
  "timestamp": "2025-11-16T03:00:00Z",
  "level": "info",
  "message": "Task completed successfully",
  "correlationId": "task:task-001:agent",
  "source": "cfn-agent-container",
  "context": {
    "agentId": "backend-dev-001",
    "taskId": "task-001",
    "iteration": 1,
    "sprintId": "sprint-4"
  },
  "metadata": {
    "duration": 5000,
    "confidence": 0.92,
    "tags": ["task-execution", "success"]
  }
}

Required Fields

Optional Fields

Search Patterns

Using jq

# Find all error logs
jq 'select(.level=="error")' logs/*.json

# Filter by correlation ID
jq 'select(.correlationId=="task-001:task:agent")' logs/*.json

# Find logs by agent
jq 'select(.context.agentId=="backend-dev-001")' logs/*.json

# Count errors by source
jq 'select(.level=="error") | .source' logs/*.json | sort | uniq -c

# Complex query: errors in last hour
jq 'select(.level=="error" and .timestamp > "'$(date -u -d '1 hour ago' +'%Y-%m-%dT%H:%M:%SZ')'")' logs/*.json

# Export to CSV
jq -r '[.timestamp, .level, .message, .source] | @csv' logs/*.json

Using grep and awk

# Find error logs
grep '"level":"error"' logs/*.json

# Find logs by task ID
grep 'task-001' logs/*.json | jq '.'

# Count log levels
grep -o '"level":"[^"]*"' logs/*.json | sort | uniq -c

# Find slow operations (duration > 5000ms)
jq 'select(.metadata.duration > 5000)' logs/*.json

Troubleshooting

No logs found

JSON parsing errors

Performance issues

Retention not working

Integration

This skill integrates with:

Performance Targets

Related Tasks

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.