-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[DOCS-11376] Add Remap Reserved Attributes guide #30322
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
619e3ad
add doc and images
maycmlee 3fe71a9
update link
maycmlee da38c7e
fix typo
maycmlee 4188072
add further reading
maycmlee 7d68591
small edit
maycmlee c343b9b
Apply suggestions from code review
maycmlee d923bfa
update overview
maycmlee 4184cea
small edit
maycmlee 87b2143
Update content/en/observability_pipelines/guide/remap_reserved_attrib…
maycmlee 4d77d24
Update content/en/observability_pipelines/guide/remap_reserved_attrib…
maycmlee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 78 additions & 0 deletions
78
content/en/observability_pipelines/guide/remap_reserved_attributes.md
This file contains hidden or 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,78 @@ | ||
--- | ||
title: Remap Reserved Attributes | ||
disable_toc: false | ||
further_reading: | ||
- link: "observability_pipelines/processors/edit_fields/" | ||
tag: "Documentation" | ||
text: "Learn more about the Edit Fields processor" | ||
- link: "observability_pipelines/processors/custom_processor/" | ||
tag: "Documentation" | ||
text: "Learn more about the Custom Processor processor" | ||
--- | ||
|
||
## Overview | ||
|
||
Observability Pipelines' processors enable you to add, edit, and remove log fields. Remapping attributes or rewriting values ensures your logs are processed and standardized properly. For the majority of processing use cases, use the Edit Fields processor to add, remap, or remove fields from your logs. For advanced use cases, use the Custom Processor to conditionally modify fields or rewrite a field's value. | ||
|
||
In Datadog, [reserved attributes][1] are log fields that are set aside for specific processing in the platform. Reserved attributes include ` host`, `source`, `status`, `service`, `trace_id`, and `message`. Reserved attributes are applied when routing logs to the following Observability Pipelines destinations: | ||
|
||
- Datadog Logs | ||
- Amazon S3 (for Log Archives) | ||
- Azure Blob Storage (for Log Archives) | ||
- Google Cloud Storage (for Log Archives) | ||
|
||
There are restrictions in Observability Pipelines on how you can modify reserved attributes. For example, reserved attributes cannot be renamed using the Rename Field processor, but must be remapped instead. This guide walks you through the steps to remap the value of reserved attributes. | ||
|
||
## Remap the value of reserved attributes | ||
|
||
To change or override the value of an existing reserved attribute field, Datadog recommends two approaches using Observability Pipelines. The first uses the Edit Fields processor, and the second uses the Custom Processor. | ||
|
||
### Use an Edit Fields processor for basic field assignments | ||
|
||
1. Use a **Remove field** processor to drop the reserved attribute from the log. | ||
2. Use an **Add field** processor to add the reserved attribute back to the log with your correct field name and value assignment. | ||
|
||
**Note**: In terms of the processor order, the **Add Field** processor should go immediately after the **Remove Field** processor to ensure correct field remapping. | ||
|
||
#### Example | ||
The **Remove field** processor image below removes the improperly named `service` field from the log. | ||
|
||
{{< img src="observability_pipelines/guide/remap_attributes/remove_field_remap.png" alt="A remove field processor that drops the service tag and an add field processor that adds the service field with the value payment-app" style="width:50%;" >}} | ||
|
||
The **Add field** processor image below re-adds the `service` field back with the correct value. | ||
|
||
{{< img src="observability_pipelines/guide/remap_attributes/add_field_remap.png" alt="A remove field processor that drops the service tag and an add field processor that adds the service field with the value payment-app" style="width:50%;" >}} | ||
|
||
### Use the Custom Processor for dynamic or manual assignments | ||
|
||
Use the **Custom Processor** to rewrite the reserved attribute's value. | ||
|
||
#### Dynamically assign the value using template syntax to reference another field's value. | ||
|
||
The following Custom Processor script rewrites the `service` field and dynamically assigns the value of `app_id` to the `service` field's value. | ||
|
||
``` | ||
.service = {{.app_id}} | ||
``` | ||
|
||
In the below example image, the input shows `service` with the value `wrongstatus`. After processing the log with the script, the output shows `service` with the value of `streaming-service`, which is `app_id`'s value. | ||
|
||
{{< img src="observability_pipelines/guide/remap_attributes/custom_processor_dynamically_assign.png" alt="A custom processor showing an input the incorrect status value and the output showing the correct status" style="width:100%;" >}} | ||
|
||
#### Manually rewrite the value of an attribute with a static name | ||
|
||
The following Custom Processor script sets the `status` field to the static value `info`. | ||
|
||
``` | ||
.status = "info" | ||
``` | ||
|
||
In the below example image, the input shows `status` with the value `wrongstatus`. After processing the log with the script, the output shows `status` with `info` as assigned. | ||
|
||
{{< img src="observability_pipelines/guide/remap_attributes/custom_processor_statically_assign.png" alt="A custom processor showing an input the incorrect status value and the output showing the correct status" style="width:100%;" >}} | ||
|
||
## Further reading | ||
|
||
{{< partial name="whats-next/whats-next.html" >}} | ||
|
||
[1]: /logs/log_configuration/attributes_naming_convention/#reserved-attributes |
Binary file added
BIN
+29.3 KB
content/en/observability_pipelines/guide/remove_fields_remap copy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
10 changes: 9 additions & 1 deletion
10
content/en/observability_pipelines/processors/edit_fields.md
This file contains hidden or 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 |
---|---|---|
@@ -1,8 +1,16 @@ | ||
--- | ||
title: Edit Fields Processor | ||
disable_toc: false | ||
further_reading: | ||
- link: "/observability_pipelines/guide/remap_reserved_attributes/" | ||
tag: "documentation" | ||
text: "Remap reserved attributes" | ||
--- | ||
|
||
{{% observability_pipelines/processors/remap %}} | ||
|
||
{{% observability_pipelines/processors/filter_syntax %}} | ||
{{% observability_pipelines/processors/filter_syntax %}} | ||
|
||
## Further reading | ||
|
||
{{< partial name="whats-next/whats-next.html" >}} |
This file contains hidden or 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 hidden or 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
Binary file added
BIN
+34.4 KB
static/images/observability_pipelines/guide/remap_attributes/add_field_remap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+206 KB
...bility_pipelines/guide/remap_attributes/custom_processor_dynamically_assign.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+204 KB
...ability_pipelines/guide/remap_attributes/custom_processor_statically_assign.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.3 KB
...ic/images/observability_pipelines/guide/remap_attributes/remove_field_remap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.