@@ -59,157 +59,17 @@ This step ensures tables are created with an Open Telemetry (OTel) schema, which
5959The following instructions use the standard distribution of the OTel collector, rather than the ClickStack distribution. The latter requires an OpAMP server for configuration. This is currently not supported in private preview. The configuration below replicates the version used by the ClickStack distribution of the collector, providing an OTLP endpoint to which events can be sent.
6060:::
6161
62- Create a ` otel-file-collector.yaml ` file with the following content:
63-
64- ``` yaml
65- receivers :
66- otlp/hyperdx :
67- protocols :
68- grpc :
69- include_metadata : true
70- endpoint : ' 0.0.0.0:4317'
71- http :
72- cors :
73- allowed_origins : ['*']
74- allowed_headers : ['*']
75- include_metadata : true
76- endpoint : ' 0.0.0.0:4318'
77- processors :
78- transform :
79- log_statements :
80- - context : log
81- error_mode : ignore
82- statements :
83- # JSON parsing: Extends log attributes with the fields from structured log body content, either as an OTEL map or
84- # as a string containing JSON content.
85- - set(log.cache, ExtractPatterns(log.body, "(?P<0>(\\{.*\\}))")) where
86- IsString(log.body)
87- - merge_maps(log.attributes, ParseJSON(log.cache["0"]), "upsert")
88- where IsMap(log.cache)
89- - flatten(log.attributes) where IsMap(log.cache)
90- - merge_maps(log.attributes, log.body, "upsert") where IsMap(log.body)
91- - context : log
92- error_mode : ignore
93- conditions :
94- - severity_number == 0 and severity_text == ""
95- statements :
96- # Infer: extract the first log level keyword from the first 256 characters of the body
97- - set(log.cache["substr"], log.body.string) where Len(log.body.string)
98- < 256
99- - set(log.cache["substr"], Substring(log.body.string, 0, 256)) where
100- Len(log.body.string) >= 256
101- - set(log.cache, ExtractPatterns(log.cache["substr"],
102- " (?i)(?P<0>(alert|crit|emerg|fatal|error|err|warn|notice|debug|dbug|trace))" ))
103- # Infer: detect FATAL
104- - set(log.severity_number, SEVERITY_NUMBER_FATAL) where
105- IsMatch(log.cache["0"], "(?i)(alert|crit|emerg|fatal)")
106- - set(log.severity_text, "fatal") where log.severity_number ==
107- SEVERITY_NUMBER_FATAL
108- # Infer: detect ERROR
109- - set(log.severity_number, SEVERITY_NUMBER_ERROR) where
110- IsMatch(log.cache["0"], "(?i)(error|err)")
111- - set(log.severity_text, "error") where log.severity_number ==
112- SEVERITY_NUMBER_ERROR
113- # Infer: detect WARN
114- - set(log.severity_number, SEVERITY_NUMBER_WARN) where
115- IsMatch(log.cache["0"], "(?i)(warn|notice)")
116- - set(log.severity_text, "warn") where log.severity_number ==
117- SEVERITY_NUMBER_WARN
118- # Infer: detect DEBUG
119- - set(log.severity_number, SEVERITY_NUMBER_DEBUG) where
120- IsMatch(log.cache["0"], "(?i)(debug|dbug)")
121- - set(log.severity_text, "debug") where log.severity_number ==
122- SEVERITY_NUMBER_DEBUG
123- # Infer: detect TRACE
124- - set(log.severity_number, SEVERITY_NUMBER_TRACE) where
125- IsMatch(log.cache["0"], "(?i)(trace)")
126- - set(log.severity_text, "trace") where log.severity_number ==
127- SEVERITY_NUMBER_TRACE
128- # Infer: else
129- - set(log.severity_text, "info") where log.severity_number == 0
130- - set(log.severity_number, SEVERITY_NUMBER_INFO) where log.severity_number == 0
131- - context : log
132- error_mode : ignore
133- statements :
134- # Normalize the severity_text case
135- - set(log.severity_text, ConvertCase(log.severity_text, "lower"))
136- resourcedetection :
137- detectors :
138- - env
139- - system
140- - docker
141- timeout : 5s
142- override : false
143- batch :
144- memory_limiter :
145- # 80% of maximum memory up to 2G, adjust for low memory environments
146- limit_mib : 1500
147- # 25% of limit up to 2G, adjust for low memory environments
148- spike_limit_mib : 512
149- check_interval : 5s
150- connectors :
151- routing/logs :
152- default_pipelines : [logs/out-default]
153- error_mode : ignore
154- table :
155- - context : log
156- statement : route() where IsMatch(attributes["rr-web.event"], ".*")
157- pipelines : [logs/out-rrweb]
158- exporters :
159- debug :
160- verbosity : detailed
161- sampling_initial : 5
162- sampling_thereafter : 200
163- clickhouse/rrweb :
164- database : ${env:CLICKHOUSE_DATABASE}
165- endpoint : ${env:CLICKHOUSE_ENDPOINT}
166- password : ${env:CLICKHOUSE_PASSWORD}
167- username : ${env:CLICKHOUSE_USER}
168- ttl : 720h
169- logs_table_name : hyperdx_sessions
170- timeout : 5s
171- retry_on_failure :
172- enabled : true
173- initial_interval : 5s
174- max_interval : 30s
175- max_elapsed_time : 300s
176- clickhouse :
177- database : ${env:CLICKHOUSE_DATABASE}
178- endpoint : ${env:CLICKHOUSE_ENDPOINT}
179- password : ${env:CLICKHOUSE_PASSWORD}
180- username : ${env:CLICKHOUSE_USER}
181- ttl : 720h
182- timeout : 5s
183- retry_on_failure :
184- enabled : true
185- initial_interval : 5s
186- max_interval : 30s
187- max_elapsed_time : 300s
188- extensions :
189- health_check :
190- endpoint : :13133
191- service :
192- pipelines :
193- traces :
194- receivers : [otlp/hyperdx]
195- processors : [memory_limiter, batch]
196- exporters : [clickhouse]
197- metrics :
198- receivers : [otlp/hyperdx]
199- processors : [memory_limiter, batch]
200- exporters : [clickhouse]
201- logs/in :
202- receivers : [otlp/hyperdx]
203- exporters : [routing/logs]
204- logs/out-default :
205- receivers : [routing/logs]
206- processors : [memory_limiter, transform, batch]
207- exporters : [clickhouse]
208- logs/out-rrweb :
209- receivers : [routing/logs]
210- processors : [memory_limiter, batch]
211- exporters : [clickhouse/rrweb]
62+ Download the configuration for the OTel collector:
63+
64+ ``` bash
65+ curl -O https://raw.githubusercontent.com/ClickHouse/clickhouse-docs/refs/heads/main/docs/use-cases/observability/clickstack/deployment/_snippets/otel-cloud-collector.yaml
66+ ```
67+
68+ <details >
69+ <summary >otel-cloud-collector.yaml</summary >
70+ ``` yaml file=docs/use-cases/observability/clickstack/deployment/_snippets/otel-cloud-config.yaml
21271```
72+ </details >
21373
21474Deploy the collector using the following Docker command, setting the respective environment variables to the connection settings recorded earlier and using the appropriate command below based on your operating system.
21575
@@ -228,7 +88,7 @@ docker run --rm -it \
22888 -e CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD} \
22989 -e CLICKHOUSE_DATABASE=${CLICKHOUSE_DATABASE} \
23090 --user 0:0 \
231- -v "$(pwd)/otel-file -collector.yaml":/etc/otel/config.yaml \
91+ -v " $( pwd) /otel-cloud -collector.yaml" :/etc/otel/config.yaml \
23292 -v /var/log:/var/log:ro \
23393 -v /private/var/log:/private/var/log:ro \
23494 otel/opentelemetry-collector-contrib:latest \
@@ -242,7 +102,7 @@ docker run --rm -it \
242102# -e CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD} \
243103# -e CLICKHOUSE_DATABASE=${CLICKHOUSE_DATABASE} \
244104# --user 0:0 \
245- # -v "$(pwd)/otel-file -collector.yaml":/etc/otel/config.yaml \
105+ # -v "$(pwd)/otel-cloud -collector.yaml":/etc/otel/config.yaml \
246106# -v /var/log:/var/log:ro \
247107# -v /private/var/log:/private/var/log:ro \
248108# otel/opentelemetry-collector-contrib:latest \
0 commit comments