Skip to main content

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

FieldTypeDescription
logsLogEntry[]Array of log entries matching the query
totalnumberTotal number of log entries matching the query (without pagination)
hasMorebooleanWhether there are more log entries available beyond the current page
queryParamsLogsQueryParamsThe query parameters used to generate this response

LogsQueryParams

FieldTypeDescription
stackIdstring (optional)Service ID to filter logs by
namespacestring (optional)Kubernetes namespace to filter by
podNamestring (optional)Kubernetes pod name to filter by
containerNamestring (optional)Kubernetes container name to filter by
severityLevelstring (optional)Log severity level to filter by (e.g., "INFO", "ERROR")
startTimenumber (optional)Start time for log range (Unix timestamp in seconds)
endTimenumber (optional)End time for log range (Unix timestamp in seconds)
limitnumber (optional)Maximum number of log entries to return (max 1000, default 100)
offsetnumber (optional)Number of log entries to skip for pagination (default 0)
searchstring (optional)Text to search for in log message bodies
structuredboolean (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 entries
  • hasMore: Whether there are more entries available
  • queryParams.limit: Number of entries in current page
  • queryParams.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