Skip to main content

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

FieldTypeDescription
timestampstringThe log entry timestamp in ClickHouse format
timestampTimestringHuman-readable timestamp
traceIdstringDistributed tracing trace ID
spanIdstringDistributed tracing span ID
traceFlagsnumberTrace flags for distributed tracing
severityTextstringLog severity level (e.g., "INFO", "ERROR", "WARN")
severityNumbernumberNumeric representation of severity level
serviceNamestringName of the service that generated the log
bodystringThe actual log message content
resourceSchemaUrlstringSchema URL for resource attributes
resourceAttributesRecord<string, string>Key-value pairs of resource attributes (e.g., k8s.namespace.name, k8s.pod.name, k8s.container.name)
scopeSchemaUrlstringSchema URL for scope attributes
scopeNamestringName of the logging scope
scopeVersionstringVersion of the logging scope
scopeAttributesRecord<string, string>Key-value pairs of scope-specific attributes
logAttributesRecord<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 namespace
  • k8s.pod.name: Kubernetes pod name
  • k8s.container.name: Kubernetes container name
  • k8s.node.name: Kubernetes node name
  • service.name: Service name
  • service.version: Service version

Common Log Attributes

The logAttributes field may contain:

  • log_type: Type of log (e.g., "structured" for structured logs)
  • level: Log level
  • component: 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 pagination
  • GET /logs/{serviceId}/latest - Returns the latest LogEntry objects for a service
  • GET /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)