-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[exporter/elasticsearch] Add
mapping.mode: raw
configuration option (…
…#29619) **Description:** This PR adds a new configuration option, `mapping.mode: raw`, to the Elasticsearch exporter. When set, the Elasticsearch exporter will not prefix log or span attributes with `Attributes.` when forming the Elasticsearch document field names for these fields. Additionally, the exporter will also not prefix span events with `Events.*` with forming the Elasticsearch document field names for these fields. **Link to tracking Issue:** Resolves #26647 **Testing:** Besides adding/updating relevant unit tests in this PR, I also tested the changes in this PR against a local Elasticsearch cluster, using the following collector configurations: 1. Without the new `mapping.mode: raw` setting. ```yaml receivers: tcplog: listen_address: "0.0.0.0:54545" processors: attributes: actions: - action: insert key: first_attribute value: one - action: insert key: second_attribute value: two exporters: debug: verbosity: detailed elasticsearch: endpoints: [ "https://localhost:9200" ] user: elastic password: XXXXXXXX logs_index: otel-logs tls: insecure_skip_verify: true flush: interval: 1s service: pipelines: logs: receivers: [tcplog] processors: [attributes] exporters: [debug,elasticsearch] ``` _Resulting document in Elasticsearch:_ ```json { "_index": "otel-logs", "_id": "l1E5J4wBD9bb2EmZJuDR", "_score": 1, "_source": { "@timestamp": "1970-01-01T00:00:00.000000000Z", "Attributes": { "first_attribute": "one", "second_attribute": "two" }, "Body": "bar", "Scope": { "name": "", "version": "" }, "SeverityNumber": 0, "TraceFlags": 0 } } ``` 2. With the new `mapping.mode: raw` setting. ```yaml receivers: tcplog: listen_address: "0.0.0.0:54545" processors: attributes: actions: - action: insert key: first_attribute value: one - action: insert key: second_attribute value: two exporters: debug: verbosity: detailed elasticsearch: endpoints: [ "https://localhost:9200" ] user: elastic password: XXXXXXXX logs_index: otel-logs tls: insecure_skip_verify: true flush: interval: 1s mapping: mode: raw service: pipelines: logs: receivers: [tcplog] processors: [attributes] exporters: [debug,elasticsearch] ``` _Resulting document in Elasticsearch:_ ```json { "_index": "otel-logs", "_id": "jlE4J4wBD9bb2EmZp-Cd", "_score": 1, "_source": { "@timestamp": "1970-01-01T00:00:00.000000000Z", "Body": "foo bar baz", "Scope": { "name": "", "version": "" }, "SeverityNumber": 0, "TraceFlags": 0, "first_attribute": "one", "second_attribute": "two" } } ``` **Documentation:** Documented the new configuration option in the Elasticsearch exporter's `README.md`. --------- Co-authored-by: Andrzej Stencel <[email protected]>
- Loading branch information
1 parent
b90d987
commit aa36c85
Showing
11 changed files
with
203 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: enhancement | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) | ||
component: elasticsearchexporter | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: "Add `mapping.mode: raw` configuration option" | ||
|
||
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. | ||
issues: [26647] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: | | ||
Setting `mapping.mode: raw` in the Elasticsearch exporter's configuration | ||
will result logs and traces being indexed into Elasticsearch with their | ||
attribute fields directly at the root level of the document instead inside an | ||
`Attributes` object. Similarly, this setting will also result in traces being | ||
indexed into Elasticsearch with their event fields directly at the root level | ||
of the document instead of inside an `Events` object. | ||
# If your change doesn't affect end users or the exported elements of any package, | ||
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. | ||
# Optional: The change log or logs in which this entry should be included. | ||
# e.g. '[user]' or '[user, api]' | ||
# Include 'user' if the change is relevant to end users. | ||
# Include 'api' if there is a change to a library API. | ||
# Default: '[user]' | ||
change_logs: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters