K8s Logs API Reference - Complete Endpoint Documentation
This guide provides comprehensive documentation for the Kubernetes Logs management API endpoints, including request/response formats and integration examples.
Base URL#
All endpoints are prefixed with this base URL.
Authentication#
All requests require authentication via Bearer token:
Obtain access tokens from the Access Tokens page in the UI.
API Endpoints Overview#
Collection Configuration (7 endpoints)#
Manage which logs to collect from Kubernetes clusters.
| Endpoint | Method | Purpose |
|---|---|---|
/config | GET | List collection configurations |
/config | POST | Create collection configuration |
/config | PUT | Update configuration |
/config | DELETE | Delete configuration |
/config/bulk-update | POST | Bulk update multiple configs |
/config/disable | POST | Disable collection for namespace |
/config/disable/cluster | POST | Disable all collection for cluster |
Log Retrieval (6 endpoints)#
Retrieve and search logs from your clusters.
| Endpoint | Method | Purpose |
|---|---|---|
/ | GET | Get logs with filters |
/search | POST | Advanced log search |
/search/logql | POST | Search using LogQL |
/namespaces | GET | List namespaces |
/pods | GET | List pods in namespace |
/containers | GET | List containers in pod |
Log Collection (4 endpoints)#
Manage on-demand and continuous log collection jobs.
| Endpoint | Method | Purpose |
|---|---|---|
/collect | POST | Start one-time collection |
/collect/continuous | POST | Start continuous collection |
/collect/bulk | POST | Collect from all pods |
/collect/jobs | GET | List collection jobs |
Archive Management (6 endpoints)#
Create and manage log archival policies.
| Endpoint | Method | Purpose |
|---|---|---|
/archive/policies | GET | List archive policies |
/archive/policies | POST | Create archive policy |
/archive/policies | PUT | Update policy |
/archive/policies | DELETE | Delete policy |
/archive/start | POST | Start archive job |
/archive/jobs | GET | List archive jobs |
S3 Storage (4 endpoints)#
Access logs stored in S3.
| Endpoint | Method | Purpose |
|---|---|---|
/s3/metadata | GET | Get S3 log metadata |
/s3/content | GET | Get log content from S3 |
/s3/stats | GET | Get S3 storage statistics |
/storage/info | GET | Get storage configuration |
Metrics & Monitoring (3 endpoints)#
Monitor log collection and system health.
| Endpoint | Method | Purpose |
|---|---|---|
/metrics | GET | Get general log metrics |
/clusters/{clusterId}/metrics | GET | Get cluster-specific metrics |
/stats | GET | Get log statistics |
/health | GET | Get system health |
Cluster Management (6 endpoints)#
Manage cluster connections and configuration.
| Endpoint | Method | Purpose |
|---|---|---|
/clusters/status | GET | Get cluster status |
/clusters/configs | GET | Get cluster configurations |
/clusters/configs | POST | Create cluster config |
/clusters/configs | PUT | Update cluster config |
/clusters/configs | DELETE | Delete cluster config |
/clusters/refresh | POST | Refresh cluster connections |
Detailed Endpoint Reference#
Create Collection Configuration#
POST /config
Create a new log collection configuration for a Kubernetes cluster.
Request Body:
Response (201):
List Collection Configurations#
GET /config
List all collection configurations, optionally filtered by cluster or namespace.
Query Parameters:
Response (200):
Update Collection Configuration#
PUT /config
Update an existing collection configuration.
Query Parameters:
Request Body:
Response (200):
Bulk Update Configurations#
POST /config/bulk-update
Enable or disable multiple configurations in a single request.
Request Body:
Response (200):
Search Logs#
POST /search
Advanced log search with flexible criteria.
Request Body:
Response (200):
Search with LogQL#
POST /search/logql
Execute LogQL queries for advanced log analysis.
Request Body:
Response (200):
List Namespaces#
GET /namespaces
Get all available namespaces in a cluster.
Query Parameters:
Response (200):
Start Log Collection#
POST /collect
Start an immediate log collection from specific pods.
Request Body:
Response (201):
Create Archive Policy#
POST /archive/policies
Create an automatic log archival policy.
Request Body:
Response (201):
Get Archive Policies#
GET /archive/policies
List all archive policies.
Response (200):
Start Archive Job#
POST /archive/start
Manually trigger an archive job for a policy.
Request Body:
Response (201):
Get Archive Jobs#
GET /archive/jobs
List archive jobs.
Query Parameters:
Response (200):
Get S3 Log Metadata#
GET /s3/metadata
List log files stored in S3.
Query Parameters:
Response (200):
Get S3 Statistics#
GET /s3/stats
Get aggregate statistics about S3-stored logs.
Response (200):
Get General Metrics#
GET /metrics
Get log collection metrics.
Query Parameters:
Response (200):
Get Cluster Status#
GET /clusters/status
Get status of all connected clusters.
Response (200):
Get System Health#
GET /health
Get overall system health status.
Response (200):
Error Handling#
Common Status Codes#
| Code | Description |
|---|---|
| 200 | Success |
| 201 | Created |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 429 | Rate Limited |
| 500 | Internal Server Error |
Error Response Format#
Rate Limiting#
API requests are rate-limited:
- 100 requests per minute for standard endpoints
- 10 requests per minute for heavy operations (search, archive)
Rate limit headers:
Integration Examples#
Python Example#
JavaScript Example#
cURL Examples#
Best Practices#
- Always use specific filters - Reduce data transfer and improve performance
- Set reasonable limits - Start with limit=100, increase only if needed
- Use date ranges - Don't retrieve entire log history at once
- Handle pagination - Check
has_moreflag in responses - Cache credentials - Use stored access tokens, don't regenerate frequently
- Monitor rate limits - Check headers and implement backoff
- Compress archive logs - Always enable compression to reduce costs
- Regular cleanup - Archive old logs to reduce database load
For more information, see the User Guide.