-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
add dynamic document pipeline support for logs #37860
base: main
Are you sure you want to change the base?
add dynamic document pipeline support for logs #37860
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, code lgtm, just a nit on readme.
@@ -145,6 +145,9 @@ This can be customised through the following settings: | |||
- `logs_dynamic_id` (optional): Dynamically determines the document ID to be used in Elasticsearch based on a log record attribute. | |||
- `enabled`(default=false): Enable/Disable dynamic ID for log records. If `elasticsearch.document_id` exists and is not an empty string in the log record attributes, it will be used as the document ID. Otherwise, the document ID will be generated by Elasticsearch. The attribute `elasticsearch.document_id` is removed from the final document. See [Setting a document id dynamically](#setting-a-document-id-dynamically). | |||
|
|||
- `logs_dynamic_pipeline` (optional): Dynamically determines the ingest pipeline to be used in Elasticsearch based on a log record attribute. | |||
- `enabled`(default=false): Enable/Disable dynamic pipeline for log records. If `elasticsearch.document_pipeline` exists and is not an empty string in the log record attributes, it will be used as the Elasticsearch ingest pipeline. The attribute `elasticsearch.document_pipeline` is removed from the final document. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The attribute
elasticsearch.document_pipeline
is removed from the final document.
nit: While this is true for OTel mode, it doesn't seem to be the case for other modes. I'm fine with that, but we should state that in the documentation. (I think I either missed this for elasticsearch.document_id
in its PR review or something has changed since then)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated both.
- Added caveat that the attributes are only removed when `otel` mapping mode is used
642ff7f
to
8ef035c
Compare
Description
This PR adds a new config option
logs_dynamic_pipeline
that when set totrue reads the
elasticsearch.document_pipeline
attribute from each logrecord and uses it as the ingest pipeline in Elasticsearch. This is
only implemented for logs, but a subsequent PR supporting metrics and
traces could be opened.
Link to tracking issue
Fixes #37419
Testing
Added tests to verify that the document pipeline attribute can be read
from the log record and that the pipeline is properly forwarded to
Elasticsearch. Also asserted that when there is no document pipeline
attribute the current behavior is retained.
Manual testing that setting the option resulted in the named ingest
pipeline being run on the document in Elasticsearch.
Documentation
Updated the readme to mention the new
logs_dynamic_pipeline
config option.