Open Telemetry Functions
Drop OTLP Logs
The Drop OTLP Logs function drops logs sent via the OpenTelemetry Protocol (OTLP).
Usage
- Operates On: OTLP Logs
- Label: Optional
- Filter: Optional
Required Configuration
- Match Conditions: A set of matching conditions to apply to each log record, the set may either match any or all of the conditions. If the result is true the log record will be dropped.
OTLP Log Payload Unrolling
If you sample OTLP log payloads you will notice they are batched and highly nested. Starting with an array of resourceLogs
, each resource
contains an array of scopeLogs
, and each scope
contains an array of logRecords
.
For your convenience Streamfold automatically unrolls and flattens this nested structure, allowing you to easily construct matching conditions as if each log were processed as a single event.
The fields for the parent scope
and resource
are also available to you for constructing match conditions. For example...
Example: Raw OTLP Payload
{
"resourceLogs": [
{
"resource": {
"attributes": [
{
"key": "telemetry.sdk.language",
"value": {
"stringValue": "python"
}
},
{
"value": {
"stringValue": "opentelemetry-demo"
},
"key": "service.namespace"
}
]
},
"scopeLogs": [
{
"scope": {
"attributes": [
{
"key": "subcomponent",
"value": {
"stringValue": "recommend"
}
}
],
"name": "opentelemetry.sdk._logs._internal"
},
"logRecords": [
{
"attributes": [
{
"key": "otelSpanID",
"value": {
"stringValue": "0625c4eed831c32a"
}
},
{
"key": "otelTraceID",
"value": {
"stringValue": "7355ebd57bd2d52cc9aae382fb98ba93"
}
}
],
"flags": 1,
"body": {
"stringValue": "Receive ListRecommendations for product..."
},
"traceId": "c1Xr1XvS1SzJquOC+5i6kw==",
"severityText": "INFO",
"timeUnixNano": "1697846411347454976",
"severityNumber": "SEVERITY_NUMBER_INFO",
"spanId": "BiXE7tgxwyo="
}
]
}
]
}
]
}
Example: Flattened OTLP Log Record
{
"flags": 1,
"spanId": "BiXE7tgxwyo=",
"severityText": "INFO",
"resource": {
"schemaUrl": null,
"attributes": {
"telemetry.sdk.language": "python",
"service.namespace": "opentelemetry-demo"
}
},
"instrumentation_scope": {
"name": "opentelemetry.sdk._logs._internal",
"attributes": {
"subcomponent": "recommend"
}
},
"traceId": "c1Xr1XvS1SzJquOC+5i6kw==",
"timeUnixNano": "1697846411347454976",
"severityNumber": "SEVERITY_NUMBER_INFO",
"body": "Receive ListRecommendations for product...",
"attributes": {
"otelSpanID": "0625c4eed831c32a",
"otelTraceID": "7355ebd57bd2d52cc9aae382fb98ba93",
"otelTraceSampled": true,
"otelServiceName": "recommendationservice"
}
}
Log Record Fields
Path | Field Accessed | Type |
---|---|---|
resource | resource of the log being processed | map |
resource.schemaUrl | resource schemaUrl of the log being processed | string |
resource.attributes | resource attributes of the log being processed | map |
resource.attributes[""] | the value of the resource attribute for the log being processed | any |
instrumentation_scope | instrumentation scope of the log being processed | map |
instrumentation_scope.name | name of the instrumentation scope of the log being processed | string |
instrumentation_scope.version | version of the instrumentation scope of the log being processed | string |
instrumentation_scope.attributes | attributes of the instrumentation scope of the log being processed | map |
instrumentation_scope.attributes[""] | the value of the instrumentation scope attribute of the log being processed | any |
timeUnixNano | the unix time in nanoseconds of the log being processed | string |
observedTimeUnixNano | the observered unix time in nanoseconds of the log being processed | string |
spanId | string representation of the span id of the log being processed | string |
traceId | string representation of the trace id of the log being processed | string |
severityNumber | string representation of the severity number of the log being processed | string |
severityText | the severity of the log being processed | string |
body | the body of the log being processed | string |
flags | the flags of the log being processed | integer |
attributes | the attributes of the log being processed | map |
attributes[""] | the value of the attribute for the log being processed | any |
Example
Drop any log where the resource.attributes
map contains the key service.namespace
and its value is "opentelemetry-demo"
{resource.attributes["service.namespace"]} == "opentelemetry-demo"
.