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
string
default:"recent"
Action to perform:
recent, sources, or tailinteger
default:"100"
Number of log entries to return (max 200)
string
Filter by log level:
info, warn, error, debugstring
Filter by log source (e.g.,
gateway, automation/monitor, agent name)string
Filter by session ID (for gateway logs)
string
Search term to filter messages (case-insensitive)
Response
array
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
string
required
Set to
tailinteger
required
Unix timestamp (milliseconds). Returns only logs after this time.
string
Filter by specific source
integer
default:"100"
Maximum entries to return
Add Custom Log Entry
POST /api/logs
Create a custom log entry (requires operator role).Request Body
string
required
Set to
addstring
required
Log message
string
default:"info"
Log level:
info, warn, error, debugstring
default:"mission-control"
Custom source identifier
string
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
string
Error message