Skip to content

Commit 7de88a4

Browse files
committed
processor_content_modifier: update docs with recent updates
Signed-off-by: Eduardo Silva <[email protected]>
1 parent 3f17bde commit 7de88a4

File tree

1 file changed

+41
-15
lines changed

1 file changed

+41
-15
lines changed

pipeline/processors/content-modifier.md

+41-15
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,43 @@
11
# Content Modifier
22

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.
44

55
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.
66

77
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.
88

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+
936
## Configuration Parameters
1037

1138
| Key | Description |
1239
| :---------- | :--- |
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`. |
1541
| key | Specify the name of the key that will be used to apply the modification. |
1642
| value | Based on the action type, `value` might required and represent different things. Check the detailed information for the specific actions. |
1743
| 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
2349

2450
| Action | Description |
2551
| ------- | ------------------------------------------------------------ |
26-
| 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. |
3359

3460
#### Insert example
3561

@@ -74,7 +100,7 @@ pipeline:
74100
action: upsert
75101
key: "key2"
76102
value: "example"
77-
103+
78104
outputs:
79105
- name : stdout
80106
match: '*'
@@ -97,8 +123,8 @@ pipeline:
97123
logs:
98124
- name: content_modifier
99125
action: delete
100-
key: "key2"
101-
126+
key: "key2"
127+
102128
outputs:
103129
- name : stdout
104130
match: '*'
@@ -168,7 +194,7 @@ pipeline:
168194
action: extract
169195
key: "http.url"
170196
pattern: ^(?<http_protocol>https?):\/\/(?<http_domain>[^\/\?]+)(?<http_path>\/[^?]*)?(?:\?(?<http_query_params>.*))?
171-
197+
172198
outputs:
173199
- name : stdout
174200
match: '*'
@@ -198,7 +224,7 @@ pipeline:
198224
action: convert
199225
key: key2
200226
converted_type: boolean
201-
227+
202228
outputs:
203229
- name : stdout
204230
match: '*'

0 commit comments

Comments
 (0)