Skip to content

Instantly share code, notes, and snippets.

@ernado
Created January 26, 2022 10:44
Show Gist options
  • Save ernado/ceacb1dce7825cff713d7e810a72affd to your computer and use it in GitHub Desktop.
Save ernado/ceacb1dce7825cff713d7e810a72affd to your computer and use it in GitHub Desktop.
OTEL Log Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref": "#/definitions/Entry",
"title": "OpenTelemetry Log Data Model",
"description": "https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md",
"definitions": {
"Map": {
"patternProperties": {
".*": {
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref": "#/definitions/Any"
}
},
"type": "object"
},
"Any": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
},
{
"type": "object"
},
{
"type": "boolean"
},
{
"type": "array",
"items": {
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref": "#/definitions/Any"
}
}
]
},
"Entry": {
"additionalProperties": false,
"properties": {
"Name": {
"type": "string"
},
"Timestamp": {
"type": "integer",
"format": "int64",
"title": "Timestamp, uint64 nanoseconds since Unix epoch.",
"description": "Time when the event occurred measured by the origin clock. This field is optional, it may be missing if the timestamp is unknown."
},
"SeverityNumber": {
"type": "integer",
"title": "Numerical value of the severity, normalized to values described in this document.",
"description": "SeverityNumber is an integer number. Smaller numerical values correspond to less severe events (such as debug events), larger numerical values correspond to more severe events (such as errors and critical events).",
"minimum": 1,
"maximum": 24
},
"TraceId": {
"type": "string",
"title": "Request trace id.",
"description": "Request trace id as defined in W3C Trace Context. Can be set for logs that are part of request processing and have an assigned trace id."
},
"SpanId": {
"type": "string",
"title": "Span id",
"description": "Can be set for logs that are part of a particular processing span. If SpanId is present TraceId SHOULD be also present."
},
"Resource": {
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref": "#/definitions/Map"
},
"Attributes": {
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref": "#/definitions/Map"
},
"Body": {
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref": "#/definitions/Any"
},
"SeverityText": {
"title": "Severity text (also known as log level).",
"description": "The original string representation of the severity as it is known at the source. If this field is missing and SeverityNumber is present then the short name that corresponds to the SeverityNumber may be used as a substitution.",
"type": "string",
"enum": [
"TRACE",
"DEBUG",
"INFO",
"WARN",
"ERROR",
"FATAL"
]
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment