LogEntry Schema
This schema defines the structure of a log entry returned by the logging endpoints.
Structure
interface LogEntry {
timestamp: string;
timestampTime: string;
traceId: string;
spanId: string;
traceFlags: number;
severityText: string;
severityNumber: number;
serviceName: string;
body: string;
resourceSchemaUrl: string;
resourceAttributes: Record<string, string>;
scopeSchemaUrl: string;
scopeName: string;
scopeVersion: string;
scopeAttributes: Record<string, string>;
logAttributes: Record<string, string>;
}
Field Descriptions
| Field | Type | Description |
|---|---|---|
timestamp | string | The log entry timestamp in ClickHouse format |
timestampTime | string | Human-readable timestamp |
traceId | string | Distributed tracing trace ID |
spanId | string | Distributed tracing span ID |
traceFlags | number | Trace flags for distributed tracing |
severityText | string | Log severity level (e.g., "INFO", "ERROR", "WARN") |
severityNumber | number | Numeric representation of severity level |
serviceName | string | Name of the service that generated the log |
body | string | The actual log message content |
resourceSchemaUrl | string | Schema URL for resource attributes |
resourceAttributes | Record<string, string> | Key-value pairs of resource attributes (e.g., k8s.namespace.name, k8s.pod.name, k8s.container.name) |
scopeSchemaUrl | string | Schema URL for scope attributes |
scopeName | string | Name of the logging scope |
scopeVersion | string | Version of the logging scope |
scopeAttributes | Record<string, string> | Key-value pairs of scope-specific attributes |
logAttributes | Record<string, string> | Key-value pairs of log-specific attributes (e.g., log_type for structured logs) |
Common Resource Attributes
The resourceAttributes field commonly contains:
k8s.namespace.name: Kubernetes namespacek8s.pod.name: Kubernetes pod namek8s.container.name: Kubernetes container namek8s.node.name: Kubernetes node nameservice.name: Service nameservice.version: Service version
Common Log Attributes
The logAttributes field may contain:
log_type: Type of log (e.g., "structured" for structured logs)level: Log levelcomponent: Component that generated the log- Custom application-specific attributes
Example
{
"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"
}
}
Usage in API Responses
LogEntry objects are returned by the following endpoints:
GET /logs/{serviceId}- Returns an array of LogEntry objects with paginationGET /logs/{serviceId}/latest- Returns the latest LogEntry objects for a serviceGET /logs/{serviceId}/search- Returns LogEntry objects matching a search query
Filtering
LogEntry objects can be filtered by:
- Time range (
startTime,endTime) - Severity level (
severityLevel) - Namespace (
namespace) - Pod name (
podName) - Container name (
containerName) - Search text in body (
search) - Structured logs only (
structured=true)