Skip to content

Commit f556503

Browse files
committed
config for transform
1 parent e543a36 commit f556503

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

content/en/ninja-workshops/10-advanced-otel/7-transform-data/7-1-configuration.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ weight: 1
66

77
{{% notice title="Exercise" style="green" icon="running" %}}
88

9-
**Configure the `transform/logs` processor**: In the `agent.yaml` apply the processor to `log_statements` in the `resource` context and retain only relevant resource attributes (`com.splunk.sourcetype`, `host.name`, `otelcol.service.mode`):
9+
**Configure the `transform` processor** and name it `/logs`.
10+
By using the `-context: resource` key we are targeting the **resourceLog** attributes of logs.
11+
This configuration ensures that only the relevant resource attributes (`com.splunk.sourcetype`, `host.name`, `otelcol.service.mode`) are retained, improving log efficiency and reducing unnecessary metadata.
1012

1113
```yaml
1214
transform/logs: # Processor Type/Name
@@ -16,9 +18,9 @@ weight: 1
1618
- keep_keys(attributes, ["com.splunk.sourcetype", "host.name", "otelcol.service.mode"])
1719
```
1820
19-
This configuration ensures that only the specified attributes are retained, improving log efficiency and reducing unnecessary metadata.
20-
21-
**Adding a Context Block for Log Severity Mapping**: To properly set the `severity_text` and `severity_number` fields of a log record, add another log `context` block within `log_statements`. This configuration extracts the `level` value from the log body, maps it to `severity_text`, and assigns the appropriate `severity_number`:
21+
**Adding a Context Block for Log Severity Mapping**:
22+
To properly set the `severity_text` and `severity_number` fields of a log record, we add another log `context` block within `log_statements`.
23+
This configuration extracts the `level` value from the log body, maps it to `severity_text`, and assigns the appropriate `severity_number`:
2224

2325
```yaml
2426
- context: log # Log Context
@@ -52,16 +54,16 @@ This method of mapping all JSON fields to top-level attributes should only be us
5254
**Update the `logs` pipeline**: Add the `transform/logs:` processor into the `logs:` pipeline:
5355

5456
```yaml
55-
logs: # Logs Pipeline
56-
receivers: # Array of receivers in this pipeline
57-
- filelog/quotes
58-
- otlp
59-
processors: # Array of Processors in this pipeline
60-
- memory_limiter # You also could use [memory_limiter]
61-
- resourcedetection
62-
- resource/add_mode
63-
- transform/logs
64-
- batch
57+
logs:
58+
receivers:
59+
- otlp # OTLP Receiver
60+
- filelog/quotes # Filelog Receiver reading quotes.log
61+
processors:
62+
- memory_limiter # Memory Limiter Processor
63+
- resourcedetection # Adds system attributes to the data
64+
- resource/add_mode # Adds collector mode metadata
65+
- transform/logs # Transform Processor used to update log lines
66+
- batch # Batch Processor, groups data before send
6567
```
6668

6769
{{% /notice %}}
@@ -92,8 +94,8 @@ graph LR
9294
PRO2 --> PRO3
9395
PRO3 --> PRO4
9496
PRO4 --> PRO5
95-
PRO5 --> EXP1
9697
PRO5 --> EXP2
98+
PRO5 --> EXP1
9799
end
98100
end
99101
classDef receiver,exporter fill:#8b5cf6,stroke:#333,stroke-width:1px,color:#fff;

0 commit comments

Comments
 (0)