You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pipeline/processors/content-modifier.md
+41-15
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,43 @@
1
1
# Content Modifier
2
2
3
-
The **content_modifier** processor allows you to manipulate the metadata/attributes and content of Logs and Traces.
3
+
The **content_modifier** processor allows you to manipulate the messages, metadata/attributes and content of Logs and Traces.
4
4
5
5
Similar to the functionality exposed by filters, this processor presents a unified mechanism to perform such operations for data manipulation. The most significant difference is that processors perform better than filters, and when chaining them, there are no encoding/decoding performance penalties.
6
6
7
7
Note that processors and this specific component can only be enabled using the new YAML configuration format. Classic mode configuration format doesn't support processors.
8
8
9
+
## Contexts
10
+
11
+
The processor, works on top of what we call a __context__, meaning _the place_ where the content modification will happen. We provide different contexts to manipulate the desired information, the following contexts are available:
12
+
13
+
| Context Name | Signal | Description |
14
+
| -- | -- | -- |
15
+
|`attributes`| Logs | Modify the attributes or metadata of a Log record. |
16
+
|`body`| Logs | Modify the content of a Log record. |
17
+
|`span_name`| Traces | Modify the name of a Span. |
18
+
|`span_kind`| Traces | Modify the kind of a Span. |
19
+
|`span_status`| Traces | Modify the status of a Span. |
20
+
|`span_attributes`| Traces | Modify the attributes of a Span. |
21
+
22
+
23
+
### OpenTelemetry Contexts
24
+
25
+
In addition, we provide special contexts to operate on data that follows an __OpenTelemetry Log Schema__, all of them operates on shared data across a group of records:
26
+
27
+
| Context Name | Signal | Description |
28
+
| -- | -- | -- |
29
+
|`otel_resource_attributes`| Logs | Modify the attributes of the Log Resource. |
30
+
|`otel_scope_name`| Logs | Modify the name of a Log Scope. |
31
+
|`otel_scope_version`| Logs | Modify version of a Log Scope. |
32
+
|`otel_scope_attributes`| Logs | Modify the attributes of a Log Scope. |
33
+
34
+
> TIP: if your data is not following the OpenTelemetry Log Schema and your backend or destination for your logs expects to be in an OpenTelemetry schema, take a look at the processor called OpenTelemetry Envelope that you can use in conjunbction with this processor to transform your data to be compatible with OpenTelemetry Log schema.
35
+
9
36
## Configuration Parameters
10
37
11
38
| Key | Description |
12
39
| :---------- | :--- |
13
-
| action | Define the operation to run on the target content. This field is mandatory; for more details about the actions available, check the table below. |
14
-
| context | Specify which component of the Telemetry type will be affected. When processing Logs the following contexts are available: `attributes` or `body`. When processing Traces the following contexts are available: `span_name`, `span_kind`, `span_status`, `span_attributes`. |
40
+
| context | Specify the context where the modifications will happen (more details above).The following contexts are available: `attributes`, `body`, `span_name`, `span_kind`, `span_status`, `span_attributes`, `otel_resource_attributes`, `otel_scope_name`, `otel_scope_version`, `otel_scope_attributes`. |
15
41
| key | Specify the name of the key that will be used to apply the modification. |
16
42
| value | Based on the action type, `value` might required and represent different things. Check the detailed information for the specific actions. |
17
43
| pattern | Defines a regular expression pattern. This property is only used by the `extract` action. |
@@ -23,13 +49,13 @@ The actions specify the type of operation to run on top of a specific key or con
| insert | Insert a new key with a value into the target context. The `key` and `value` parameters are required. |
27
-
| upsert | Given a specific key with a value, the `upsert` operation will try to update the value of the key. If the key does not exist, the key will be created. The `key` and `value` parameters are required. |
28
-
| delete | Delete a key from the target context. The `key` parameter is required. |
29
-
| rename | Change the name of a key. The `value` set in the configuration will represent the new name. The `key` and `value` parameters are required. |
30
-
| hash | Replace the key value with a hash generated by the SHA-256 algorithm, the binary value generated is finally set as an hex string representation. The `key` parameter is required. |
31
-
| extract | Allows to extact the value of a single key as a list of key/value pairs. This action needs the configuration of a regular expression in the `pattern` property . The `key` and `pattern` parameters are required. For more details check the examples below. |
32
-
| convert | Convert the data type of a key value. The `key` and `converted_type` parameters are required. |
52
+
|`insert`| Insert a new key with a value into the target context. The `key` and `value` parameters are required. |
53
+
|`upsert`| Given a specific key with a value, the `upsert` operation will try to update the value of the key. If the key does not exist, the key will be created. The `key` and `value` parameters are required. |
54
+
|`delete`| Delete a key from the target context. The `key` parameter is required. |
55
+
|`rename`| Change the name of a key. The `value` set in the configuration will represent the new name. The `key` and `value` parameters are required. |
56
+
|`hash`| Replace the key value with a hash generated by the SHA-256 algorithm, the binary value generated is finally set as an hex string representation. The `key` parameter is required. |
57
+
|`extract`| Allows to extact the value of a single key as a list of key/value pairs. This action needs the configuration of a regular expression in the `pattern` property . The `key` and `pattern` parameters are required. For more details check the examples below. |
58
+
|`convert`| Convert the data type of a key value. The `key` and `converted_type` parameters are required. |
0 commit comments