Skip to content

Commit 7ac6bc0

Browse files
feat: Collect the containerdebug logs (#790)
* feat: Collect the containerdebug logs * chore: Update changelog * chore: Fix clippy warnings * fix: Do not hard-code the environment variable name "FILE_LOG_DIRECTORY" * chore: Fix comment in vector.yaml
1 parent 07cdf59 commit 7ac6bc0

9 files changed

Lines changed: 468 additions & 24 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ All notable changes to this project will be documented in this file.
1010
- Add `/ready` endpoint to the operator Deployment, which reports the CRD installation status ([#770]).
1111
- Document that the Stackable Hive images restore the `get_table` and `get_table_objects_by_name` Thrift methods removed by HIVE-26537, and assert it in the smoke test ([#766]).
1212
- Add support for Hive `4.2.1` ([#766], [#782]).
13+
- The logs of the `containerdebug` process are now collected by the Vector agent and forwarded to
14+
the Vector aggregator ([#790]).
1315
- The metastore now has a default affinity to the OPA Pods when OPA authorization is configured ([#772]).
1416

1517
### Removed
@@ -53,6 +55,12 @@ All notable changes to this project will be documented in this file.
5355
- The operator now watches all resources that it creates and early-exits the reconcile action when the
5456
cluster is marked for deletion ([#754]).
5557
- The operator now watches the `S3Connection` referenced by `spec.clusterConfig.s3.reference` ([#765]).
58+
- The `containerdebug` process writes its log file again. The operator set
59+
`CONTAINERDEBUG_LOG_DIRECTORY`, which containerdebug stopped reading in its version 0.2.0 when it
60+
moved to `stackable-telemetry`; the directory is now set via `FILE_LOG_DIRECTORY`. The file is
61+
rotated hourly and at most two files are kept, because rotation is opt-in ([#790]).
62+
- The Vector unit tests run again. [#780] added a `test-config.yaml` argument to `test-vector.sh`
63+
without adding the file, so since then the test run aborted before executing any case ([#790]).
5664

5765
[#726]: https://github.com/stackabletech/hive-operator/pull/726
5866
[#731]: https://github.com/stackabletech/hive-operator/pull/731
@@ -77,6 +85,7 @@ All notable changes to this project will be documented in this file.
7785
[#782]: https://github.com/stackabletech/hive-operator/pull/782
7886
[#785]: https://github.com/stackabletech/hive-operator/pull/785
7987
[#787]: https://github.com/stackabletech/hive-operator/pull/787
88+
[#790]: https://github.com/stackabletech/hive-operator/pull/790
8089

8190
## [26.7.0] - 2026-07-21
8291

‎docs/modules/hive/pages/usage-guide/logging.adoc‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,12 @@ spec:
1414
enableVectorAgent: true
1515
----
1616

17+
NOTE: The logs of the xref:concepts:observability/containerdebug.adoc[`containerdebug` process] are collected as well.
18+
They are labelled `container: containerdebug`, although no such Kubernetes container exists.
19+
The process runs in the background of the `hive` container.
20+
The label comes from `/stackable/log/containerdebug`, the directory which the operator sets with the `FILE_LOG_DIRECTORY` environment variable and from which the Vector agent derives the container name.
21+
Overriding `FILE_LOG_DIRECTORY` with `envOverrides` therefore changes how these logs are aggregated.
22+
The agent only collects files one level below `/stackable/log`, so a sibling directory such as `/stackable/log/hive` relabels the events instead of dropping them, while any deeper or shallower path stops the aggregation.
23+
A path outside `/stackable/log` also leaves the size-capped log volume.
24+
1725
Further information on how to configure logging, can be found in xref:concepts:logging.adoc[].

‎rust/operator-binary/src/controller/build/jvm.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn construct_jvm_args(cluster: &ValidatedCluster, rg: &HiveRoleGroupConfig) -> V
3232
),
3333
format!("-Djavax.net.ssl.trustStore={STACKABLE_TRUST_STORE}"),
3434
format!("-Djavax.net.ssl.trustStorePassword={STACKABLE_TRUST_STORE_PASSWORD}"),
35-
format!("-Djavax.net.ssl.trustStoreType=pkcs12"),
35+
"-Djavax.net.ssl.trustStoreType=pkcs12".to_owned(),
3636
];
3737

3838
if cluster.has_kerberos_enabled() {

‎rust/operator-binary/src/controller/build/properties/product_logging/test-vector.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ export VECTOR_DANGEROUSLY_ALLOW_ENV_VAR_INTERPOLATION=true
1616

1717
vector validate --no-environment vector.yaml
1818

19-
vector test test-config.yaml vector.yaml vector-test.yaml
19+
vector test vector.yaml vector-test.yaml

‎rust/operator-binary/src/controller/build/properties/product_logging/vector-test.yaml‎

Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,285 @@ tests:
102102
"timestamp": t'2025-10-02T09:27:28.582Z'
103103
}
104104
105+
assert_eq!(expected_log_event, .)
106+
- name: Test tracing-rs log
107+
inputs:
108+
- type: log
109+
insert_at: processed_files_tracing_rs
110+
log_fields:
111+
file: /stackable/log/containerdebug/containerdebug.2026-11-02-14.tracing-rs.json
112+
message: '{"timestamp":"2026-11-02T14:49:28.028922Z","level":"INFO","fields":{"message":"found disk","disk.name":"overlay"},"target":"containerdebug::system_information::disk"}'
113+
pod: hive-metastore-default-0
114+
source_type: file
115+
timestamp: 2026-11-02T14:49:29.473487331Z
116+
outputs:
117+
- extract_from: extended_logs
118+
expected_event_count: 1
119+
conditions:
120+
- type: vrl
121+
source: |
122+
expected_log_event = {
123+
"cluster": "hive",
124+
"container": "containerdebug",
125+
"file": "containerdebug.2026-11-02-14.tracing-rs.json",
126+
"level": "INFO",
127+
"logger": "containerdebug::system_information::disk",
128+
"message": "found disk\n\ndisk.name=overlay",
129+
"timestamp": t'2026-11-02T14:49:28.028922Z',
130+
"namespace": "default",
131+
"pod": "hive-metastore-default-0",
132+
"role": "metastore",
133+
"roleGroup": "default"
134+
}
135+
136+
assert_eq!(expected_log_event, .)
137+
- name: Test unparsable tracing-rs log
138+
inputs:
139+
- type: log
140+
insert_at: processed_files_tracing_rs
141+
log_fields:
142+
file: /stackable/log/containerdebug/containerdebug.2026-11-02-14.tracing-rs.json
143+
message: '{ unparsable'
144+
pod: hive-metastore-default-0
145+
source_type: file
146+
timestamp: 2026-11-02T14:49:29.473487331Z
147+
outputs:
148+
- extract_from: extended_logs
149+
expected_event_count: 1
150+
conditions:
151+
- type: vrl
152+
source: |
153+
expected_log_event = {
154+
"cluster": "hive",
155+
"container": "containerdebug",
156+
"errors": [
157+
.errors[0]
158+
],
159+
"file": "containerdebug.2026-11-02-14.tracing-rs.json",
160+
"level": "INFO",
161+
"logger": "",
162+
"message": "{ unparsable",
163+
"timestamp": .timestamp,
164+
"namespace": "default",
165+
"pod": "hive-metastore-default-0",
166+
"role": "metastore",
167+
"roleGroup": "default"
168+
}
169+
170+
assert_eq!(expected_log_event, .)
171+
172+
# The remainder of the message contains character offsets into
173+
# the VRL source, so only the stable prefix is asserted.
174+
assert!(starts_with!(.errors[0], "JSON not parsable: "))
175+
- name: Test tracing-rs log which is not a JSON object
176+
inputs:
177+
- type: log
178+
insert_at: processed_files_tracing_rs
179+
log_fields:
180+
file: /stackable/log/containerdebug/containerdebug.2026-11-02-14.tracing-rs.json
181+
message: 'false'
182+
pod: hive-metastore-default-0
183+
source_type: file
184+
timestamp: 2026-11-02T14:49:29.473487331Z
185+
outputs:
186+
- extract_from: extended_logs
187+
expected_event_count: 1
188+
conditions:
189+
- type: vrl
190+
source: |
191+
expected_log_event = {
192+
"cluster": "hive",
193+
"container": "containerdebug",
194+
"errors": [
195+
"Parsed event is not a JSON object."
196+
],
197+
"file": "containerdebug.2026-11-02-14.tracing-rs.json",
198+
"level": "INFO",
199+
"logger": "",
200+
"message": "false",
201+
"timestamp": .timestamp,
202+
"namespace": "default",
203+
"pod": "hive-metastore-default-0",
204+
"role": "metastore",
205+
"roleGroup": "default"
206+
}
207+
208+
assert_eq!(expected_log_event, .)
209+
- name: Test tracing-rs log with invalid fields
210+
inputs:
211+
- type: log
212+
insert_at: processed_files_tracing_rs
213+
log_fields:
214+
file: /stackable/log/containerdebug/containerdebug.2026-11-02-14.tracing-rs.json
215+
message: '{"timestamp":"unparsable","level":"INVALID","fields":"none","target":null}'
216+
pod: hive-metastore-default-0
217+
source_type: file
218+
timestamp: 2026-11-02T14:49:29.473487331Z
219+
outputs:
220+
- extract_from: extended_logs
221+
expected_event_count: 1
222+
conditions:
223+
- type: vrl
224+
source: |
225+
expected_log_event = {
226+
"cluster": "hive",
227+
"container": "containerdebug",
228+
"errors": [
229+
.errors[0],
230+
"Logger/target not found.",
231+
"Level \"INVALID\" unknown, using \"INFO\" instead.",
232+
"Fields are not an object."
233+
],
234+
"file": "containerdebug.2026-11-02-14.tracing-rs.json",
235+
"level": "INFO",
236+
"logger": "",
237+
"message": "{\"timestamp\":\"unparsable\",\"level\":\"INVALID\",\"fields\":\"none\",\"target\":null}",
238+
"timestamp": .timestamp,
239+
"namespace": "default",
240+
"pod": "hive-metastore-default-0",
241+
"role": "metastore",
242+
"roleGroup": "default"
243+
}
244+
245+
assert_eq!(expected_log_event, .)
246+
247+
# The remainder of the message contains character offsets into
248+
# the VRL source, so only the stable prefix is asserted.
249+
assert!(starts_with!(.errors[0], "Timestamp not parsable, using current time instead: "))
250+
- name: Test tracing-rs log without a timestamp
251+
inputs:
252+
- type: log
253+
insert_at: processed_files_tracing_rs
254+
log_fields:
255+
file: /stackable/log/containerdebug/containerdebug.2026-11-02-14.tracing-rs.json
256+
message: '{"level":"INFO","fields":{"message":"found disk"},"target":"containerdebug::system_information::disk"}'
257+
pod: hive-metastore-default-0
258+
source_type: file
259+
timestamp: 2026-11-02T14:49:29.473487331Z
260+
outputs:
261+
- extract_from: extended_logs
262+
expected_event_count: 1
263+
conditions:
264+
- type: vrl
265+
source: |
266+
expected_log_event = {
267+
"cluster": "hive",
268+
"container": "containerdebug",
269+
"errors": [
270+
"Timestamp not found, using current time instead."
271+
],
272+
"file": "containerdebug.2026-11-02-14.tracing-rs.json",
273+
"level": "INFO",
274+
"logger": "containerdebug::system_information::disk",
275+
"message": "found disk",
276+
"timestamp": .timestamp,
277+
"namespace": "default",
278+
"pod": "hive-metastore-default-0",
279+
"role": "metastore",
280+
"roleGroup": "default"
281+
}
282+
283+
assert_eq!(expected_log_event, .)
284+
285+
# The current time is used and not the timestamp which the file
286+
# source attached to the event. The latter reaches the transform
287+
# as a string, whereas now() yields a timestamp.
288+
assert!(is_timestamp(.timestamp))
289+
- name: Test tracing-rs log without a message but with other fields
290+
inputs:
291+
- type: log
292+
insert_at: processed_files_tracing_rs
293+
log_fields:
294+
file: /stackable/log/containerdebug/containerdebug.2026-11-02-14.tracing-rs.json
295+
message: '{"timestamp":"2026-11-02T14:49:28.028922Z","level":"INFO","fields":{"disk.name":"overlay"},"target":"containerdebug::system_information::disk"}'
296+
pod: hive-metastore-default-0
297+
source_type: file
298+
timestamp: 2026-11-02T14:49:29.473487331Z
299+
outputs:
300+
- extract_from: extended_logs
301+
expected_event_count: 1
302+
conditions:
303+
- type: vrl
304+
source: |
305+
expected_log_event = {
306+
"cluster": "hive",
307+
"container": "containerdebug",
308+
"file": "containerdebug.2026-11-02-14.tracing-rs.json",
309+
"level": "INFO",
310+
"logger": "containerdebug::system_information::disk",
311+
"message": "disk.name=overlay",
312+
"timestamp": t'2026-11-02T14:49:28.028922Z',
313+
"namespace": "default",
314+
"pod": "hive-metastore-default-0",
315+
"role": "metastore",
316+
"roleGroup": "default"
317+
}
318+
319+
assert_eq!(expected_log_event, .)
320+
- name: Test tracing-rs log with a message which is not a string
321+
inputs:
322+
- type: log
323+
insert_at: processed_files_tracing_rs
324+
log_fields:
325+
file: /stackable/log/containerdebug/containerdebug.2026-11-02-14.tracing-rs.json
326+
message: '{"timestamp":"2026-11-02T14:49:28.028922Z","level":"INFO","fields":{"message":42,"disk.name":"overlay"},"target":"containerdebug::system_information::disk"}'
327+
pod: hive-metastore-default-0
328+
source_type: file
329+
timestamp: 2026-11-02T14:49:29.473487331Z
330+
outputs:
331+
- extract_from: extended_logs
332+
expected_event_count: 1
333+
conditions:
334+
- type: vrl
335+
source: |
336+
expected_log_event = {
337+
"cluster": "hive",
338+
"container": "containerdebug",
339+
"file": "containerdebug.2026-11-02-14.tracing-rs.json",
340+
"level": "INFO",
341+
"logger": "containerdebug::system_information::disk",
342+
"message": "disk.name=overlay\nmessage=42",
343+
"timestamp": t'2026-11-02T14:49:28.028922Z',
344+
"namespace": "default",
345+
"pod": "hive-metastore-default-0",
346+
"role": "metastore",
347+
"roleGroup": "default"
348+
}
349+
350+
assert_eq!(expected_log_event, .)
351+
- name: Test tracing-rs log without any fields
352+
inputs:
353+
- type: log
354+
insert_at: processed_files_tracing_rs
355+
log_fields:
356+
file: /stackable/log/containerdebug/containerdebug.2026-11-02-14.tracing-rs.json
357+
message: '{"timestamp":"2026-11-02T14:49:28.028922Z","level":"INFO","fields":{},"target":"containerdebug::system_information::disk"}'
358+
pod: hive-metastore-default-0
359+
source_type: file
360+
timestamp: 2026-11-02T14:49:29.473487331Z
361+
outputs:
362+
- extract_from: extended_logs
363+
expected_event_count: 1
364+
conditions:
365+
- type: vrl
366+
source: |
367+
expected_log_event = {
368+
"cluster": "hive",
369+
"container": "containerdebug",
370+
"errors": [
371+
"Message not found."
372+
],
373+
"file": "containerdebug.2026-11-02-14.tracing-rs.json",
374+
"level": "INFO",
375+
"logger": "containerdebug::system_information::disk",
376+
"message": "",
377+
"timestamp": t'2026-11-02T14:49:28.028922Z',
378+
"namespace": "default",
379+
"pod": "hive-metastore-default-0",
380+
"role": "metastore",
381+
"roleGroup": "default"
382+
}
383+
105384
assert_eq!(expected_log_event, .)
106385
- name: Test Vector internal logs
107386
inputs:

0 commit comments

Comments
 (0)