Skip to content

Commit 5b8fa74

Browse files
committed
Add custom data stream routing documentation
1 parent a5eec4e commit 5b8fa74

File tree

3 files changed

+118
-0
lines changed

3 files changed

+118
-0
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
navigation_title: Custom data stream routing
3+
description: Customize data stream routing in EDOT. Learn scenarios, patterns, and risks when modifying `data_stream.namespace` or `data_stream.dataset`.
4+
applies_to:
5+
stack:
6+
serverless:
7+
observability:
8+
product:
9+
edot_collector: ga
10+
products:
11+
- id: cloud-serverless
12+
- id: observability
13+
- id: edot-collector
14+
---
15+
16+
# Custom data stream routing with EDOT
17+
18+
{{edot}} (EDOT) uses opinionated defaults for data stream naming to ensure compatibility with Elastic dashboards, {{product.apm}} visualizations, and curated UIs.
19+
20+
While most use cases rely on these defaults, EDOT also supports advanced dynamic routing.
21+
22+
:::{important}
23+
We strongly recommend not changing the default data stream names. Customizing data stream routing diverges from the standard ingestion model and there's no guarantee it will be valid for future versions.
24+
:::
25+
26+
## When to customize data streams
27+
28+
The only recommended use case for customizing data stream routing is to separate data by environment (for example: dev, staging, and prod).
29+
30+
In this case, we recommend changing only `data_stream.namespace`, not `data_stream.dataset`.
31+
32+
## Modifying `namespace`
33+
34+
A data stream name follows this structure:
35+
36+
```
37+
<type>-<dataset>-<namespace>
38+
```
39+
40+
The `namespace` is intended as the configurable part of the name. Elastic dashboards, detectors, and UIs support multiple namespaces automatically.
41+
42+
## Why not modify `dataset`?
43+
44+
Changing the `dataset` value can cause:
45+
46+
- Dashboards and {{product.apm}} views to fail to load
47+
- Loss of compatibility with built-in correlations and cross-linking
48+
- Inconsistent field mappings
49+
- Proliferation of data streams and increased shard counts
50+
51+
Only modify `dataset` if it's absolutely necessary and you're aware of the trade-offs.
52+
53+
## Configuration example
54+
55+
To enable dynamic data stream routing:
56+
57+
1. Set `mapping.mode: otel` in the {{es}} exporter. When using `otel` mapping mode, the exporter appends `.otel` to the `data_stream.dataset` value automatically.
58+
2. Use a `resource` processor to set the desired `namespace` or `dataset` from resource attributes.
59+
3. Add the processor to your pipeline.
60+
61+
:::{note}
62+
The example is purely illustrative, with no guarantee of it being production ready.
63+
:::
64+
65+
```yaml
66+
exporters:
67+
elasticsearch/otel:
68+
api_key: ${env:ELASTIC_API_KEY}
69+
endpoints: [${env:ELASTIC_ENDPOINT}]
70+
mapping:
71+
mode: otel
72+
73+
processors:
74+
resource/env-namespace: # <-- make sure you are using `resource` and not `attributes`
75+
attributes:
76+
- key: data_stream.namespace
77+
from_attribute: k8s.namespace.name
78+
action: upsert
79+
80+
service:
81+
pipelines:
82+
metrics/otel:
83+
processors:
84+
- batch
85+
- resource/env-namespace # <-- add the processor to the pipeline
86+
exporters:
87+
- elasticsearch/otel
88+
```
89+
90+
## Valid data stream names
91+
92+
Any dynamic value used in `data_stream.namespace` or `data_stream.dataset` must comply with {{es}} index naming rules:
93+
94+
- Lowercase only
95+
- No spaces
96+
- Must not start with `_`
97+
- Must not contain: `"`, `\`, `*`, `,`, `<`, `>`, `|`, `?`, `/`
98+
- Avoid hyphens in environment names (use `produs` instead of `prod-us`)
99+
100+
Invalid names prevent data stream creation.
101+
102+
## Risks and limitations
103+
104+
This configuration diverges from the standard ingestion model. Be aware of the following:
105+
106+
- Future EDOT versions may not support this configuration or may introduce breaking changes.
107+
- Changes might lead to an increase in data streams and shard counts.
108+
- Dashboards and UIs may not recognize non-standard datasets.
109+
- Some data streams might fail to be created if there are non-allowed characters in the values set for `data_stream.namespace` or `data_stream.dataset`.
110+
111+
Use this feature only when necessary and validate in non-production environments first.
112+
113+
## Additional resources
114+
115+
- [Data stream routing reference](docs-content://solutions/observability/apm/opentelemetry/data-stream-routing.md)
116+
- [EDOT Collector configuration examples](/reference/edot-collector/config/index.md)

docs/reference/edot-collector/config/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ The following pages provide insights into the default configurations of the EDOT
2424
* [Configure profiles collection](/reference/edot-collector/config/configure-profiles-collection.md)
2525
* [Authentication methods](/reference/edot-collector/config/authentication-methods.md)
2626
* [Tail-based sampling](/reference/edot-collector/config/tail-based-sampling.md)
27+
* [Custom data stream routing](/reference/edot-collector/config/custom-data-streams.md)
2728

2829

docs/reference/edot-collector/toc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ toc:
1111
- file: config/tail-based-sampling.md
1212
- file: config/authentication-methods.md
1313
- file: config/configure-profiles-collection.md
14+
- file: config/custom-data-streams.md
1415
- file: config/proxy.md
1516
- file: components.md
1617
children:

0 commit comments

Comments
 (0)