LogsResponse Schema
This schema defines the structure of the response returned by the main logs endpoint with pagination and query information.
Structure
interface LogsResponse {
logs: LogEntry[];
total: number;
hasMore: boolean;
queryParams: LogsQueryParams;
}
interface LogsQueryParams {
stackId?: string;
namespace?: string;
podName?: string;
containerName?: string;
severityLevel?: string;
startTime?: number; // Unix timestamp in seconds
endTime?: number; // Unix timestamp in seconds
limit?: number;
offset?: number;
search?: string;
structured?: boolean;
}
Field Descriptions
LogsResponse
| Field | Type | Description |
|---|---|---|
logs | LogEntry[] | Array of log entries matching the query |
total | number | Total number of log entries matching the query (without pagination) |
hasMore | boolean | Whether there are more log entries available beyond the current page |
queryParams | LogsQueryParams | The query parameters used to generate this response |
LogsQueryParams
| Field | Type | Description |
|---|---|---|
stackId | string (optional) | Service ID to filter logs by |
namespace | string (optional) | Kubernetes namespace to filter by |
podName | string (optional) | Kubernetes pod name to filter by |
containerName | string (optional) | Kubernetes container name to filter by |
severityLevel | string (optional) | Log severity level to filter by (e.g., "INFO", "ERROR") |
startTime | number (optional) | Start time for log range (Unix timestamp in seconds) |
endTime | number (optional) | End time for log range (Unix timestamp in seconds) |
limit | number (optional) | Maximum number of log entries to return (max 1000, default 100) |
offset | number (optional) | Number of log entries to skip for pagination (default 0) |
search | string (optional) | Text to search for in log message bodies |
structured | boolean (optional) | Whether to return only structured logs (default false) |
Usage
This schema is used by the GET /logs/{serviceId} endpoint which provides comprehensive log querying with pagination support.
Example Response
{
"logs": [
{
"timestamp": "2024-01-15T10:30:00Z",
"timestampTime": "2024-01-15 10:30:00",
"traceId": "1234567890abcdef",
"spanId": "abcdef1234567890",
"traceFlags": 1,
"severityText": "INFO",
"severityNumber": 9,
"serviceName": "my-service",
"body": "Request processed successfully",
"resourceSchemaUrl": "https://opentelemetry.io/schemas/1.24.0",
"resourceAttributes": {
"k8s.namespace.name": "api-services",
"k8s.pod.name": "my-service-pod-123",
"k8s.container.name": "my-service"
},
"scopeSchemaUrl": "https://opentelemetry.io/schemas/1.24.0",
"scopeName": "my-service-logger",
"scopeVersion": "1.0.0",
"scopeAttributes": {},
"logAttributes": {
"log_type": "structured",
"level": "info"
}
}
],
"total": 1523,
"hasMore": true,
"queryParams": {
"stackId": "my-service",
"severityLevel": "INFO",
"limit": 100,
"offset": 0,
"structured": true
}
}
Pagination
The response includes pagination information:
total: Total number of matching log entrieshasMore: Whether there are more entries availablequeryParams.limit: Number of entries in current pagequeryParams.offset: Starting position for current page
To fetch the next page, increment the offset by the limit value.
Performance Considerations
- Maximum limit is 1000 entries per request
- Large time ranges may result in slower queries
- Using specific filters (namespace, podName, containerName) improves performance
- Structured log filtering can reduce result size
Error Handling
If the query fails, the endpoint will return appropriate HTTP status codes:
- 400 Bad Request: Invalid query parameters
- 403 Forbidden: Insufficient permissions to access service logs
- 500 Internal Server Error: Server-side error during query execution