Overview
The Logs API provides access to structured log files from OpenClaw agents, gateway processes, and Mission Control itself. Logs are automatically discovered from the configured logs directory and parsed into a unified format.Logs are read from the filesystem at
$LOGS_DIR (configured in environment). Multiple log formats are supported including JSON, pipe-delimited, and journal formats.Get Recent Logs
GET /api/logs?action=recent
Retrieve recent log entries with optional filtering.Query Parameters
Action to perform:
recent, sources, or tailNumber of log entries to return (max 200)
Filter by log level:
info, warn, error, debugFilter by log source (e.g.,
gateway, automation/monitor, agent name)Filter by session ID (for gateway logs)
Search term to filter messages (case-insensitive)
Response
Array of log entries
Unique log entry identifier
Unix timestamp (milliseconds)
Log level:
info, warn, error, debugLog source (file name or agent identifier)
Session ID (if applicable)
Log message
Additional structured data (if available)
Response Example
List Available Sources
GET /api/logs?action=sources
Discover all available log sources.Response Example
Tail Logs (Real-Time)
GET /api/logs?action=tail
Get new logs since a specific timestamp for real-time monitoring.Query Parameters
Set to
tailUnix timestamp (milliseconds). Returns only logs after this time.
Filter by specific source
Maximum entries to return
Add Custom Log Entry
POST /api/logs
Create a custom log entry (requires operator role).Request Body
Set to
addLog message
Log level:
info, warn, error, debugCustom source identifier
Session ID to associate with log
Response
Log Format Detection
The Logs API automatically parses multiple log formats:JSON Format
Pipe-Delimited Format
Gateway Journal Format
Simple Text with ISO Timestamp
Use Cases
Monitor Errors Across All Sources
Track Gateway Session Issues
Search for Specific Events
Error Responses
Error message
| Status Code | Description |
|---|---|
| 400 | Bad request - Invalid parameters |
| 401 | Unauthorized - Invalid or missing session |
| 403 | Forbidden - Insufficient permissions (operator required for POST) |
| 429 | Rate limited |
| 500 | Internal server error |