Skip to content

Commit 27f33a0

Browse files
maycmleeurseberry
andauthored
[DOCS-11376] Add Remap Reserved Attributes guide (#30322)
* add doc and images * update link * fix typo * add further reading * small edit * Apply suggestions from code review Co-authored-by: Ursula Chen <58821586+urseberry@users.noreply.github.com> * update overview * small edit * Update content/en/observability_pipelines/guide/remap_reserved_attributes.md Co-authored-by: Ursula Chen <58821586+urseberry@users.noreply.github.com> * Update content/en/observability_pipelines/guide/remap_reserved_attributes.md --------- Co-authored-by: Ursula Chen <58821586+urseberry@users.noreply.github.com>
1 parent 24ba343 commit 27f33a0

File tree

12 files changed

+109
-3
lines changed

12 files changed

+109
-3
lines changed

content/en/observability_pipelines/guide/_index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,10 @@ disable_toc: false
55

66
{{< whatsnext desc="General guides:" >}}
77
{{< nextlink href="observability_pipelines/guide/strategies_for_reducing_log_volume" >}}Strategies for reducing log volume{{< /nextlink >}}
8+
{{< /whatsnext >}}
9+
10+
{{< whatsnext desc="Processor guides:" >}}
811
{{< nextlink href="observability_pipelines/guide/get_started_with_the_custom_processor" >}}Get started with the Custom Processor{{< /nextlink >}}
12+
{{< nextlink href="observability_pipelines/guide/remap_reserved_attributes" >}}Remap reserved attributes{{< /nextlink >}}
13+
914
{{< /whatsnext >}}
Loading
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
title: Remap Reserved Attributes
3+
disable_toc: false
4+
further_reading:
5+
- link: "observability_pipelines/processors/edit_fields/"
6+
tag: "Documentation"
7+
text: "Learn more about the Edit Fields processor"
8+
- link: "observability_pipelines/processors/custom_processor/"
9+
tag: "Documentation"
10+
text: "Learn more about the Custom Processor processor"
11+
---
12+
13+
## Overview
14+
15+
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.
16+
17+
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:
18+
19+
- Datadog Logs
20+
- Amazon S3 (for Log Archives)
21+
- Azure Blob Storage (for Log Archives)
22+
- Google Cloud Storage (for Log Archives)
23+
24+
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.
25+
26+
## Remap the value of reserved attributes
27+
28+
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.
29+
30+
### Use an Edit Fields processor for basic field assignments
31+
32+
1. Use a **Remove field** processor to drop the reserved attribute from the log.
33+
2. Use an **Add field** processor to add the reserved attribute back to the log with your correct field name and value assignment.
34+
35+
**Note**: In terms of the processor order, the **Add Field** processor should go immediately after the **Remove Field** processor to ensure correct field remapping.
36+
37+
#### Example
38+
The **Remove field** processor image below removes the improperly named `service` field from the log.
39+
40+
{{< 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%;" >}}
41+
42+
The **Add field** processor image below re-adds the `service` field back with the correct value.
43+
44+
{{< 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%;" >}}
45+
46+
### Use the Custom Processor for dynamic or manual assignments
47+
48+
Use the **Custom Processor** to rewrite the reserved attribute's value.
49+
50+
#### Dynamically assign the value using template syntax to reference another field's value.
51+
52+
The following Custom Processor script rewrites the `service` field and dynamically assigns the value of `app_id` to the `service` field's value.
53+
54+
```
55+
.service = {{.app_id}}
56+
```
57+
58+
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.
59+
60+
{{< 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%;" >}}
61+
62+
#### Manually rewrite the value of an attribute with a static name
63+
64+
The following Custom Processor script sets the `status` field to the static value `info`.
65+
66+
```
67+
.status = "info"
68+
```
69+
70+
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.
71+
72+
{{< 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%;" >}}
73+
74+
## Further reading
75+
76+
{{< partial name="whats-next/whats-next.html" >}}
77+
78+
[1]: /logs/log_configuration/attributes_naming_convention/#reserved-attributes
Loading

content/en/observability_pipelines/processors/custom_processor.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
---
22
title: Custom Processor
33
disable_toc: false
4+
further_reading:
5+
- link: "/observability_pipelines/guide/remap_reserved_attributes/"
6+
tag: "documentation"
7+
text: "Remap reserved attributes"
48
---
59

610
{{< callout src="#" btn_hidden="true" >}}
@@ -30,4 +34,8 @@ The Custom Processor is in Preview. Reach out to your account manager to request
3034
{{< nextlink href="observability_pipelines/processors/custom_processor/#type" >}}Type{{< /nextlink >}}
3135
{{< /whatsnext >}}
3236

33-
{{< vrl-functions >}}
37+
{{< vrl-functions >}}
38+
39+
## Further reading
40+
41+
{{< partial name="whats-next/whats-next.html" >}}
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
---
22
title: Edit Fields Processor
33
disable_toc: false
4+
further_reading:
5+
- link: "/observability_pipelines/guide/remap_reserved_attributes/"
6+
tag: "documentation"
7+
text: "Remap reserved attributes"
48
---
59

610
{{% observability_pipelines/processors/remap %}}
711

8-
{{% observability_pipelines/processors/filter_syntax %}}
12+
{{% observability_pipelines/processors/filter_syntax %}}
13+
14+
## Further reading
15+
16+
{{< partial name="whats-next/whats-next.html" >}}

layouts/shortcodes/observability_pipelines/processors/custom_processor.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Use this processor with Vector Remap Language (VRL) to modify and enrich your lo
1212

1313
See [Custom functions][10191] for the full list of available functions.
1414

15+
See [Remap Reserved Attributes][10193] on how to use the Custom Processor to manually and dynamically remap attributes.
16+
1517
To set up this processor:
1618

1719
- If you have not created any functions yet, click **Add custom processor** and follow the instructions in [Add a function](#add-a-function) to create a function.
@@ -27,4 +29,5 @@ To set up this processor:
2729
1. Click **Save**.
2830

2931
[10191]: /observability_pipelines/processors/custom_processor#custom-functions
30-
[10192]: /observability_pipelines/guide/get_started_with_the_custom_processor
32+
[10192]: /observability_pipelines/guide/get_started_with_the_custom_processor
33+
[10193]: /observability_pipelines/guide/remap_reserved_attributes

layouts/shortcodes/observability_pipelines/processors/remap.en.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
The remap processor can add, drop, or rename fields within your individual log data. Use this processor to enrich your logs with additional context, remove low-value fields to reduce volume, and standardize naming across important attributes. Select **add field**, **drop field**, or **rename field** in the dropdown menu to get started.
22

3+
See the [Remap Reserved Attributes][10220] guide on how to use the Edit Fields processor to remap attributes.
4+
35
##### Add field
46
Use **add field** to append a new key-value field to your log.
57

@@ -47,3 +49,5 @@ To set up the rename field processor:
4749

4850
- Use `outer_key.inner_key` to refer to the key with the value `inner_value`.
4951
- Use `outer_key.inner_key.double_inner_key` to refer to the key with the value `double_inner_value`.
52+
53+
[10220]: /observability_pipelines/guide/remap_reserved_attributes
Loading

0 commit comments

Comments
 (0)