-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] add_entries processor add_when is not working when checking for fields within log.attributes or resource.attributes #5279
Comments
Even when I use ./telemetrygen logs --body "2024-12-12:00:00:00 INFO This is a test message" --otlp-attributes host.name=\"mydevhost\" --telemetry-attributes foo=\"bar\" --trace-id ae87dadd90e9935a4bc9660628efd569 --span-id 5828fa4960140870 --duration 1s --otlp-insecure otel-opensearch-pipeline:
workers: 1
delay: "5000"
source:
otel_logs_source:
ssl: false
port: 2021
#compression: gzip
processor:
- add_entries:
entries:
- key: "severityText"
value: "ERROR"
- key: "log.attributes.foo"
value: "baaz"
- date:
from_time_received: true
destination: "@timestamp"
sink:
- stdout:
OUTPUT {
"traceId": "ae87dadd90e9935a4bc9660628efd569",
"spanId": "5828fa4960140870",
"severityText": "Info",
"flags": 0,
"time": "2024-12-27T10:55:48.134602349Z",
"severityNumber": 9,
"droppedAttributesCount": 0,
"serviceName": null,
"body": "2024-12-12:00:00:00 INFO This is a test message",
"observedTime": "1970-01-01T00:00:00Z",
"schemaUrl": "https://opentelemetry.io/schemas/1.4.0",
"log.attributes.foo": "baaz",
"@timestamp": "2024-12-27T10:55:48.152Z",
"log.attributes.app": "server",
"resource.attributes.host@name": "mydevhost"
}
|
I have the same issue when using the renaming keys processor |
Also having the same issue with 'parse_json', 'key_value' and 'rename_keys' processors. it seems that they are ignoring fields with dots in them like "span.attributes.client_id". |
When I use the file source with this input and this configuration, I get the expected outcome Config
Content of log.txt
Output to
This makes it seem like the sources are manipulating the data differently and the issue is not necessarily with the |
I can help |
I was able to make this work. The |
Thank you @alamzeeshan for the info.
We definitely should add this to the docs |
Describe the bug
The
add_entries
processoradd_when
is not working when checking for fields insidelog.attributes
orresource.attributes
. It is working work when I check for a top level field such asseverityText
I just setup data prepper docker container as mentioned in here
docker run --name data-prepper -p 2021:2021 -v /${PWD}/pipelines.yaml:/usr/share/data-prepper/pipelines/pipelines.yaml opensearchproject/data-prepper:latest
This is my data prepper config:
Also in the same machine I have setup
opentelemetry-collector-contrib:0.116.1
to receive OTEL logs and forward to data prepperdocker run -p 4317:4317 -v $(pwd)/config.yaml:/etc/otelcol-contrib/config.yaml otel/opentelemetry-collector-contrib:0.116.1
I am using Telemetry generator for OpenTelemetry to generate OTEL logs
OUTPUT
Expected behavior
I am expecting a new field
add_entry_dot_test
to be added based on the conditionadd_when: /log.attributes.foo == "bar"
. I am getting new fieldadd_entry_test
based on the conditionadd_when: /severityText == "Info"
. Looks like data prepper expression-syntax is unable to read fields insidelog.attributes
orresource.attributes
.Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: