Retrieve and analyze logs from various services and environments
Retrieves and analyzes logs from services with filtering, real-time streaming, and intelligent error detection.
/plugin marketplace add trilogy-group/swarm-claude-plugin/plugin install devops-assistant@swarm-claude-pluginThe logs command provides powerful log retrieval and analysis capabilities for debugging and monitoring your applications and infrastructure.
@devops logs --service api-gateway
@devops logs --service api-gateway --follow
@devops logs --service api-gateway --level ERROR --timeframe 24h
@devops logs --service api-gateway --filter "user authentication failed"
@devops logs --service database --lines 500 --level WARN
Claude will automatically detect and connect to appropriate log sources:
1. Connect to log source
2. Apply time range filter
3. Apply log level filter
4. Apply custom pattern filter
5. Format and highlight output
6. Stream or batch return results
Claude performs automatic analysis:
[2024-01-15 10:23:45] [INFO] api-gateway: Request received from 192.168.1.100
[2024-01-15 10:23:45] [INFO] api-gateway: Authentication successful for user: john.doe
[2024-01-15 10:23:46] [ERROR] api-gateway: Database connection timeout
[2024-01-15 10:23:46] [WARN] api-gateway: Retrying database connection (attempt 1/3)
[2024-01-15 10:23:47] [INFO] api-gateway: Database connection restored
## Log Analysis Summary
### Overview
- **Time Range**: Last 1 hour
- **Total Entries**: 1,234
- **Error Rate**: 2.3%
- **Warning Rate**: 5.1%
### Error Distribution
| Error Type | Count | Percentage |
|------------|-------|------------|
| Connection Timeout | 15 | 45% |
| Authentication Failed | 10 | 30% |
| Resource Not Found | 8 | 25% |
### Performance Metrics
- Average Response Time: 145ms
- P95 Response Time: 450ms
- P99 Response Time: 1200ms
### Detected Patterns
1. **Spike in connection timeouts** between 10:15-10:20
- Likely cause: Database maintenance window
- Recommendation: Implement connection pooling
2. **Authentication failures** from IP: 203.0.113.42
- Pattern suggests brute force attempt
- Recommendation: Enable rate limiting
### Critical Events
⚠️ Memory usage exceeded 90% at 10:45
⚠️ Disk space below 10% on node-3
🔴 Service crash detected at 09:30 (auto-recovered)
@devops logs --service "api-gateway,database,cache" --filter "transaction-id:abc123"
@devops logs --service api-gateway --format json --export logs-backup.json
When following logs, Claude will:
Common error scenarios and responses:
@devops servicesCombine with other DevOps commands:
# Check status then view logs if issues detected
@devops status && @devops logs --service {problematic-service}
# View logs and trigger deployment if stable
@devops logs --service api-gateway --level ERROR --lines 0 && @devops deploy