Skip to main content

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 tail
integer
default:"100"
Number of log entries to return (max 200)
string
Filter by log level: info, warn, error, debug
string
Filter by log source (e.g., gateway, automation/monitor, agent name)
string
Filter by session ID (for gateway logs)
Search term to filter messages (case-insensitive)

Response

array
Array of log entries
string
Unique log entry identifier
integer
Unix timestamp (milliseconds)
string
Log level: info, warn, error, debug
string
Log source (file name or agent identifier)
string
Session ID (if applicable)
string
Log message
object
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

string
required
Set to tail
integer
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 add
string
required
Log message
string
default:"info"
Log level: info, warn, error, debug
string
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