Logs API
API endpoints for querying runtime logs, log statistics and exporting logs for troubleshooting.
Query Logs
Query Logs
GET /api/logs?level=ERROR&keyword=timeout&limit=50&offset=0&reverse=true
Parameters:
level log level (DEBUG/INFO/WARNING/ERROR/CRITICAL)
logger_name filter by logger name
keyword keyword search
since start time (ISO 8601)
until end time (ISO 8601)
limit number of entries, default 100
offset offset
reverse descending order, default true
Response: {
"success": true,
"logs": [ { "time": "...", "level": "ERROR", "logger": "app.agent", "message": "..." } ],
"total": 128
}Error Logs
GET /api/logs/errors?limit=20
Response: { "success": true, "logs": [ ... ] }Clear Logs
DELETE /api/logs
Response: { "success": true }Log Stats
Log Stats
GET /api/logs/stats
Response: {
"success": true,
"stats": { "DEBUG": 120, "INFO": 830, "WARNING": 15, "ERROR": 3 }
}Runtime Status
GET /api/logs/status
Response: {
"success": true,
"status": { "level": "INFO", "buffer_size": 1024, "file": "logs/app.log" }
}Status History
GET /api/logs/status/history
Response: { "success": true, "history": [ { "time": "...", "buffer_size": 1024 } ] }Export Logs
GET /api/logs/export?level=ERROR&limit=500&format=json
format can be: json / txt
Response: file stream (Content-Disposition: attachment)