diff --git a/CHANGELOG.md b/CHANGELOG.md index 89c92c68..28e25997 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ All notable changes to this project will be documented in this file. - Add `/ready` endpoint to the operator Deployment, which reports the CRD installation status ([#770]). - 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]). - Add support for Hive `4.2.1` ([#766], [#782]). +- The logs of the `containerdebug` process are now collected by the Vector agent and forwarded to + the Vector aggregator ([#790]). - The metastore now has a default affinity to the OPA Pods when OPA authorization is configured ([#772]). ### Removed @@ -53,6 +55,12 @@ All notable changes to this project will be documented in this file. - The operator now watches all resources that it creates and early-exits the reconcile action when the cluster is marked for deletion ([#754]). - The operator now watches the `S3Connection` referenced by `spec.clusterConfig.s3.reference` ([#765]). +- The `containerdebug` process writes its log file again. The operator set + `CONTAINERDEBUG_LOG_DIRECTORY`, which containerdebug stopped reading in its version 0.2.0 when it + moved to `stackable-telemetry`; the directory is now set via `FILE_LOG_DIRECTORY`. The file is + rotated hourly and at most two files are kept, because rotation is opt-in ([#790]). +- The Vector unit tests run again. [#780] added a `test-config.yaml` argument to `test-vector.sh` + without adding the file, so since then the test run aborted before executing any case ([#790]). [#726]: https://github.com/stackabletech/hive-operator/pull/726 [#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. [#782]: https://github.com/stackabletech/hive-operator/pull/782 [#785]: https://github.com/stackabletech/hive-operator/pull/785 [#787]: https://github.com/stackabletech/hive-operator/pull/787 +[#790]: https://github.com/stackabletech/hive-operator/pull/790 ## [26.7.0] - 2026-07-21 diff --git a/docs/modules/hive/pages/usage-guide/logging.adoc b/docs/modules/hive/pages/usage-guide/logging.adoc index 169fee8a..837e01ec 100644 --- a/docs/modules/hive/pages/usage-guide/logging.adoc +++ b/docs/modules/hive/pages/usage-guide/logging.adoc @@ -14,4 +14,12 @@ spec: enableVectorAgent: true ---- +NOTE: The logs of the xref:concepts:observability/containerdebug.adoc[`containerdebug` process] are collected as well. +They are labelled `container: containerdebug`, although no such Kubernetes container exists. +The process runs in the background of the `hive` container. +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. +Overriding `FILE_LOG_DIRECTORY` with `envOverrides` therefore changes how these logs are aggregated. +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. +A path outside `/stackable/log` also leaves the size-capped log volume. + Further information on how to configure logging, can be found in xref:concepts:logging.adoc[]. diff --git a/rust/operator-binary/src/controller/build/jvm.rs b/rust/operator-binary/src/controller/build/jvm.rs index a0fbd872..b3132329 100644 --- a/rust/operator-binary/src/controller/build/jvm.rs +++ b/rust/operator-binary/src/controller/build/jvm.rs @@ -32,7 +32,7 @@ fn construct_jvm_args(cluster: &ValidatedCluster, rg: &HiveRoleGroupConfig) -> V ), format!("-Djavax.net.ssl.trustStore={STACKABLE_TRUST_STORE}"), format!("-Djavax.net.ssl.trustStorePassword={STACKABLE_TRUST_STORE_PASSWORD}"), - format!("-Djavax.net.ssl.trustStoreType=pkcs12"), + "-Djavax.net.ssl.trustStoreType=pkcs12".to_owned(), ]; if cluster.has_kerberos_enabled() { diff --git a/rust/operator-binary/src/controller/build/properties/product_logging/test-vector.sh b/rust/operator-binary/src/controller/build/properties/product_logging/test-vector.sh index 58ab75a8..e3d34421 100755 --- a/rust/operator-binary/src/controller/build/properties/product_logging/test-vector.sh +++ b/rust/operator-binary/src/controller/build/properties/product_logging/test-vector.sh @@ -16,4 +16,4 @@ export VECTOR_DANGEROUSLY_ALLOW_ENV_VAR_INTERPOLATION=true vector validate --no-environment vector.yaml -vector test test-config.yaml vector.yaml vector-test.yaml +vector test vector.yaml vector-test.yaml diff --git a/rust/operator-binary/src/controller/build/properties/product_logging/vector-test.yaml b/rust/operator-binary/src/controller/build/properties/product_logging/vector-test.yaml index cc6dc24d..7b37dd36 100644 --- a/rust/operator-binary/src/controller/build/properties/product_logging/vector-test.yaml +++ b/rust/operator-binary/src/controller/build/properties/product_logging/vector-test.yaml @@ -102,6 +102,285 @@ tests: "timestamp": t'2025-10-02T09:27:28.582Z' } + assert_eq!(expected_log_event, .) + - name: Test tracing-rs log + inputs: + - type: log + insert_at: processed_files_tracing_rs + log_fields: + file: /stackable/log/containerdebug/containerdebug.2026-11-02-14.tracing-rs.json + message: '{"timestamp":"2026-11-02T14:49:28.028922Z","level":"INFO","fields":{"message":"found disk","disk.name":"overlay"},"target":"containerdebug::system_information::disk"}' + pod: hive-metastore-default-0 + source_type: file + timestamp: 2026-11-02T14:49:29.473487331Z + outputs: + - extract_from: extended_logs + expected_event_count: 1 + conditions: + - type: vrl + source: | + expected_log_event = { + "cluster": "hive", + "container": "containerdebug", + "file": "containerdebug.2026-11-02-14.tracing-rs.json", + "level": "INFO", + "logger": "containerdebug::system_information::disk", + "message": "found disk\n\ndisk.name=overlay", + "timestamp": t'2026-11-02T14:49:28.028922Z', + "namespace": "default", + "pod": "hive-metastore-default-0", + "role": "metastore", + "roleGroup": "default" + } + + assert_eq!(expected_log_event, .) + - name: Test unparsable tracing-rs log + inputs: + - type: log + insert_at: processed_files_tracing_rs + log_fields: + file: /stackable/log/containerdebug/containerdebug.2026-11-02-14.tracing-rs.json + message: '{ unparsable' + pod: hive-metastore-default-0 + source_type: file + timestamp: 2026-11-02T14:49:29.473487331Z + outputs: + - extract_from: extended_logs + expected_event_count: 1 + conditions: + - type: vrl + source: | + expected_log_event = { + "cluster": "hive", + "container": "containerdebug", + "errors": [ + .errors[0] + ], + "file": "containerdebug.2026-11-02-14.tracing-rs.json", + "level": "INFO", + "logger": "", + "message": "{ unparsable", + "timestamp": .timestamp, + "namespace": "default", + "pod": "hive-metastore-default-0", + "role": "metastore", + "roleGroup": "default" + } + + assert_eq!(expected_log_event, .) + + # The remainder of the message contains character offsets into + # the VRL source, so only the stable prefix is asserted. + assert!(starts_with!(.errors[0], "JSON not parsable: ")) + - name: Test tracing-rs log which is not a JSON object + inputs: + - type: log + insert_at: processed_files_tracing_rs + log_fields: + file: /stackable/log/containerdebug/containerdebug.2026-11-02-14.tracing-rs.json + message: 'false' + pod: hive-metastore-default-0 + source_type: file + timestamp: 2026-11-02T14:49:29.473487331Z + outputs: + - extract_from: extended_logs + expected_event_count: 1 + conditions: + - type: vrl + source: | + expected_log_event = { + "cluster": "hive", + "container": "containerdebug", + "errors": [ + "Parsed event is not a JSON object." + ], + "file": "containerdebug.2026-11-02-14.tracing-rs.json", + "level": "INFO", + "logger": "", + "message": "false", + "timestamp": .timestamp, + "namespace": "default", + "pod": "hive-metastore-default-0", + "role": "metastore", + "roleGroup": "default" + } + + assert_eq!(expected_log_event, .) + - name: Test tracing-rs log with invalid fields + inputs: + - type: log + insert_at: processed_files_tracing_rs + log_fields: + file: /stackable/log/containerdebug/containerdebug.2026-11-02-14.tracing-rs.json + message: '{"timestamp":"unparsable","level":"INVALID","fields":"none","target":null}' + pod: hive-metastore-default-0 + source_type: file + timestamp: 2026-11-02T14:49:29.473487331Z + outputs: + - extract_from: extended_logs + expected_event_count: 1 + conditions: + - type: vrl + source: | + expected_log_event = { + "cluster": "hive", + "container": "containerdebug", + "errors": [ + .errors[0], + "Logger/target not found.", + "Level \"INVALID\" unknown, using \"INFO\" instead.", + "Fields are not an object." + ], + "file": "containerdebug.2026-11-02-14.tracing-rs.json", + "level": "INFO", + "logger": "", + "message": "{\"timestamp\":\"unparsable\",\"level\":\"INVALID\",\"fields\":\"none\",\"target\":null}", + "timestamp": .timestamp, + "namespace": "default", + "pod": "hive-metastore-default-0", + "role": "metastore", + "roleGroup": "default" + } + + assert_eq!(expected_log_event, .) + + # The remainder of the message contains character offsets into + # the VRL source, so only the stable prefix is asserted. + assert!(starts_with!(.errors[0], "Timestamp not parsable, using current time instead: ")) + - name: Test tracing-rs log without a timestamp + inputs: + - type: log + insert_at: processed_files_tracing_rs + log_fields: + file: /stackable/log/containerdebug/containerdebug.2026-11-02-14.tracing-rs.json + message: '{"level":"INFO","fields":{"message":"found disk"},"target":"containerdebug::system_information::disk"}' + pod: hive-metastore-default-0 + source_type: file + timestamp: 2026-11-02T14:49:29.473487331Z + outputs: + - extract_from: extended_logs + expected_event_count: 1 + conditions: + - type: vrl + source: | + expected_log_event = { + "cluster": "hive", + "container": "containerdebug", + "errors": [ + "Timestamp not found, using current time instead." + ], + "file": "containerdebug.2026-11-02-14.tracing-rs.json", + "level": "INFO", + "logger": "containerdebug::system_information::disk", + "message": "found disk", + "timestamp": .timestamp, + "namespace": "default", + "pod": "hive-metastore-default-0", + "role": "metastore", + "roleGroup": "default" + } + + assert_eq!(expected_log_event, .) + + # The current time is used and not the timestamp which the file + # source attached to the event. The latter reaches the transform + # as a string, whereas now() yields a timestamp. + assert!(is_timestamp(.timestamp)) + - name: Test tracing-rs log without a message but with other fields + inputs: + - type: log + insert_at: processed_files_tracing_rs + log_fields: + file: /stackable/log/containerdebug/containerdebug.2026-11-02-14.tracing-rs.json + message: '{"timestamp":"2026-11-02T14:49:28.028922Z","level":"INFO","fields":{"disk.name":"overlay"},"target":"containerdebug::system_information::disk"}' + pod: hive-metastore-default-0 + source_type: file + timestamp: 2026-11-02T14:49:29.473487331Z + outputs: + - extract_from: extended_logs + expected_event_count: 1 + conditions: + - type: vrl + source: | + expected_log_event = { + "cluster": "hive", + "container": "containerdebug", + "file": "containerdebug.2026-11-02-14.tracing-rs.json", + "level": "INFO", + "logger": "containerdebug::system_information::disk", + "message": "disk.name=overlay", + "timestamp": t'2026-11-02T14:49:28.028922Z', + "namespace": "default", + "pod": "hive-metastore-default-0", + "role": "metastore", + "roleGroup": "default" + } + + assert_eq!(expected_log_event, .) + - name: Test tracing-rs log with a message which is not a string + inputs: + - type: log + insert_at: processed_files_tracing_rs + log_fields: + file: /stackable/log/containerdebug/containerdebug.2026-11-02-14.tracing-rs.json + message: '{"timestamp":"2026-11-02T14:49:28.028922Z","level":"INFO","fields":{"message":42,"disk.name":"overlay"},"target":"containerdebug::system_information::disk"}' + pod: hive-metastore-default-0 + source_type: file + timestamp: 2026-11-02T14:49:29.473487331Z + outputs: + - extract_from: extended_logs + expected_event_count: 1 + conditions: + - type: vrl + source: | + expected_log_event = { + "cluster": "hive", + "container": "containerdebug", + "file": "containerdebug.2026-11-02-14.tracing-rs.json", + "level": "INFO", + "logger": "containerdebug::system_information::disk", + "message": "disk.name=overlay\nmessage=42", + "timestamp": t'2026-11-02T14:49:28.028922Z', + "namespace": "default", + "pod": "hive-metastore-default-0", + "role": "metastore", + "roleGroup": "default" + } + + assert_eq!(expected_log_event, .) + - name: Test tracing-rs log without any fields + inputs: + - type: log + insert_at: processed_files_tracing_rs + log_fields: + file: /stackable/log/containerdebug/containerdebug.2026-11-02-14.tracing-rs.json + message: '{"timestamp":"2026-11-02T14:49:28.028922Z","level":"INFO","fields":{},"target":"containerdebug::system_information::disk"}' + pod: hive-metastore-default-0 + source_type: file + timestamp: 2026-11-02T14:49:29.473487331Z + outputs: + - extract_from: extended_logs + expected_event_count: 1 + conditions: + - type: vrl + source: | + expected_log_event = { + "cluster": "hive", + "container": "containerdebug", + "errors": [ + "Message not found." + ], + "file": "containerdebug.2026-11-02-14.tracing-rs.json", + "level": "INFO", + "logger": "containerdebug::system_information::disk", + "message": "", + "timestamp": t'2026-11-02T14:49:28.028922Z', + "namespace": "default", + "pod": "hive-metastore-default-0", + "role": "metastore", + "roleGroup": "default" + } + assert_eq!(expected_log_event, .) - name: Test Vector internal logs inputs: diff --git a/rust/operator-binary/src/controller/build/properties/product_logging/vector.yaml b/rust/operator-binary/src/controller/build/properties/product_logging/vector.yaml index 2fd3d923..b9e446d3 100644 --- a/rust/operator-binary/src/controller/build/properties/product_logging/vector.yaml +++ b/rust/operator-binary/src/controller/build/properties/product_logging/vector.yaml @@ -25,6 +25,12 @@ sources: - ${LOG_DIR}/*/*.log4j2.xml line_delimiter: "\r\n" + # Reads the logs of the containerdebug process + files_tracing_rs: + type: file + include: + - ${LOG_DIR}/*/*.tracing-rs.json + transforms: processed_files_stdout: inputs: @@ -174,11 +180,92 @@ transforms: } # Extends the processed files with the fields "container" and "file" + # Transforms the tracing-rs JSON logs written by the containerdebug process + processed_files_tracing_rs: + inputs: + - files_tracing_rs + type: remap + source: | + raw_message = string!(.message) + + .timestamp = now() + .logger = "" + .level = "INFO" + .message = "" + .errors = [] + + parsed_event, err = parse_json(raw_message) + if err != null { + error = "JSON not parsable: " + err + .errors = push(.errors, error) + log(error, level: "warn") + .message = raw_message + } else if !is_object(parsed_event) { + error = "Parsed event is not a JSON object." + .errors = push(.errors, error) + log(error, level: "warn") + .message = raw_message + } else { + event = object!(parsed_event) + + timestamp_string, err = string(event.timestamp) + if err == null { + parsed_timestamp, err = parse_timestamp(timestamp_string, "%+") + if err == null { + .timestamp = parsed_timestamp + } else { + .errors = push(.errors, "Timestamp not parsable, using current time instead: " + err) + } + } else { + .errors = push(.errors, "Timestamp not found, using current time instead.") + } + + .logger, err = string(event.target) + if err != null || is_empty(.logger) { + .errors = push(.errors, "Logger/target not found.") + } + + level, err = string(event.level) + if err != null { + .errors = push(.errors, "Level not found, using \"" + .level + "\" instead.") + } else if !includes(["TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL"], upcase(level)) { + .errors = push(.errors, "Level \"" + level + "\" unknown, using \"" + .level + "\" instead.") + } else { + .level = upcase(level) + } + + fields, err = object(event.fields) + if err == null { + message, err = string(fields.message) + if err == null { + # The message is prepended to the other fields, so remove it from + # them. + del(fields.message) + } else { + # Keep an unusable message among the other fields instead of + # discarding its content. + message = "" + } + + other_fields = encode_key_value(fields, field_delimiter: "\n") + .message = join!(compact([message, other_fields]), "\n\n") + } else { + .errors = push(.errors, "Fields are not an object.") + # Fall back to the raw line, so that its content is not lost. + .message = raw_message + } + + if is_empty(.message) { + .errors = push(.errors, "Message not found.") + } + } + extended_logs_files: inputs: - processed_files_stdout - processed_files_stderr - processed_files_log4j2 + - processed_files_tracing_rs type: remap source: | del(.source_type) diff --git a/rust/operator-binary/src/controller/build/resource/statefulset.rs b/rust/operator-binary/src/controller/build/resource/statefulset.rs index 99d07658..2173ce0b 100644 --- a/rust/operator-binary/src/controller/build/resource/statefulset.rs +++ b/rust/operator-binary/src/controller/build/resource/statefulset.rs @@ -2,6 +2,7 @@ use std::str::FromStr; +use const_format::concatcp; use indoc::formatdoc; use snafu::{ResultExt, Snafu}; use stackable_operator::{ @@ -143,8 +144,13 @@ constant!(HDFS_DISCOVERY_VOLUME_NAME: VolumeName = "hdfs-discovery"); // Env vars the operator sets on the Hive container. constant!(HADOOP_HEAPSIZE: EnvVarName = "HADOOP_HEAPSIZE"); constant!(HADOOP_OPTS: EnvVarName = "HADOOP_OPTS"); -// Needed for the `containerdebug` process to log its tracing information to. -constant!(CONTAINERDEBUG_LOG_DIRECTORY: EnvVarName = "CONTAINERDEBUG_LOG_DIRECTORY"); +// Let the `containerdebug` process write its tracing information to a file. These are the generic +// `stackable-telemetry` variables and apply to the whole Hive container, so any other +// telemetry-based process in it would log into the same directory and the Vector agent would label +// its events with `container: containerdebug`. +constant!(FILE_LOG_DIRECTORY: EnvVarName = "FILE_LOG_DIRECTORY"); +constant!(FILE_LOG_MAX_FILES: EnvVarName = "FILE_LOG_MAX_FILES"); +constant!(FILE_LOG_ROTATION_PERIOD: EnvVarName = "FILE_LOG_ROTATION_PERIOD"); /// The directory the HDFS discovery ConfigMap volume is mounted at. Also consumed by /// [`build_container_command_args`] when copying the @@ -177,10 +183,15 @@ pub(crate) fn build_metastore_rolegroup_statefulset( construct_hadoop_heapsize_env(merged_config).context(ConstructJvmArgumentsSnafu)?, ) .with_value(&HADOOP_OPTS, construct_non_heap_jvm_args(cluster, rg)) + // The directory must be exactly one level below the log directory, because the Vector + // agent derives the container name from that path segment. .with_value( - &CONTAINERDEBUG_LOG_DIRECTORY, - format!("{STACKABLE_LOG_DIR}/containerdebug"), - ); + &FILE_LOG_DIRECTORY, + concatcp!(STACKABLE_LOG_DIR, "/containerdebug"), + ) + // Rotation is opt-in, so without these the file would grow unbounded. + .with_value(&FILE_LOG_ROTATION_PERIOD, "hourly") + .with_value(&FILE_LOG_MAX_FILES, "2"); // The env vars mounting the database credentials Secret (absent e.g. for Derby). for env_var in database_connection_details .username_env @@ -283,6 +294,7 @@ pub(crate) fn build_metastore_rolegroup_statefulset( {COMMON_BASH_TRAP_FUNCTIONS} {remove_vector_shutdown_file_command} prepare_signal_handlers + mkdir --parents \"$FILE_LOG_DIRECTORY\" containerdebug --output={STACKABLE_LOG_DIR}/containerdebug-state.json --loop & {start_command} wait_for_termination $! @@ -391,6 +403,9 @@ pub(crate) fn build_metastore_rolegroup_statefulset( .context(AddVolumeSnafu)? .add_empty_dir_volume( &*STACKABLE_LOG_DIR_NAME, + // Only the Hive log files are budgeted. The `containerdebug` files in this + // volume are rotated by time, not by size, so they have no budget; raising + // `FILE_LOG_LEVEL` via `envOverrides` can therefore evict the Pod. Some(product_logging::framework::calculate_log_volume_size_limit( &[MAX_HIVE_LOG_FILES_SIZE], )), @@ -514,10 +529,12 @@ mod tests { let _ = *HDFS_DISCOVERY_VOLUME_NAME; let _ = *HADOOP_HEAPSIZE; let _ = *HADOOP_OPTS; - let _ = *CONTAINERDEBUG_LOG_DIRECTORY; + let _ = *FILE_LOG_DIRECTORY; + let _ = *FILE_LOG_MAX_FILES; + let _ = *FILE_LOG_ROTATION_PERIOD; } - /// [`DERBY_YAML`] with the operator-set `CONTAINERDEBUG_LOG_DIRECTORY` overridden on the + /// [`DERBY_YAML`] with the operator-set `FILE_LOG_DIRECTORY` overridden on the /// metastore. const OVERRIDE_DERBY_YAML: &str = r#" apiVersion: hive.stackable.tech/v1alpha1 @@ -534,7 +551,7 @@ mod tests { derby: {} metastore: envOverrides: - CONTAINERDEBUG_LOG_DIRECTORY: /debug-override + FILE_LOG_DIRECTORY: /debug-override roleGroups: default: replicas: 1 @@ -625,15 +642,15 @@ mod tests { /// The user-supplied `envOverrides` must be merged in after all operator-set environment /// variables, so that an override replaces the operator's value instead of producing a /// duplicated entry whose precedence depended on Kubernetes' duplicate-name handling. - /// `CONTAINERDEBUG_LOG_DIRECTORY` is used as the example here because it is set + /// `FILE_LOG_DIRECTORY` is used as the example here because it is set /// unconditionally by the operator. #[test] fn env_overrides_override_operator_set_env_vars() { // Without an override, the operator's value is set (exactly once). assert_eq!( - env_var_values(DERBY_YAML, "CONTAINERDEBUG_LOG_DIRECTORY"), + env_var_values(DERBY_YAML, "FILE_LOG_DIRECTORY"), [( - "CONTAINERDEBUG_LOG_DIRECTORY".to_string(), + "FILE_LOG_DIRECTORY".to_string(), format!("{STACKABLE_LOG_DIR}/containerdebug") )] ); @@ -641,9 +658,9 @@ mod tests { // An override replaces it; exact comparison so a duplicate entry (operator value // alongside the override) fails too. assert_eq!( - env_var_values(OVERRIDE_DERBY_YAML, "CONTAINERDEBUG_LOG_DIRECTORY"), + env_var_values(OVERRIDE_DERBY_YAML, "FILE_LOG_DIRECTORY"), [( - "CONTAINERDEBUG_LOG_DIRECTORY".to_string(), + "FILE_LOG_DIRECTORY".to_string(), "/debug-override".to_string() )] ); diff --git a/tests/templates/kuttl/logging/hive-vector-aggregator-values.yaml.j2 b/tests/templates/kuttl/logging/hive-vector-aggregator-values.yaml.j2 index 9471ba90..1a46c6a5 100644 --- a/tests/templates/kuttl/logging/hive-vector-aggregator-values.yaml.j2 +++ b/tests/templates/kuttl/logging/hive-vector-aggregator-values.yaml.j2 @@ -22,35 +22,55 @@ customConfig: transforms: validEvents: type: filter - inputs: [vector] + inputs: + - vector condition: is_null(.errors) filteredAutomaticLogConfigMetastoreHive: type: filter - inputs: [validEvents] + inputs: + - validEvents condition: >- .pod == "test-hive-metastore-automatic-log-config-0" && .container == "hive" + filteredAutomaticLogConfigMetastoreContainerdebug: + type: filter + inputs: + - validEvents + condition: >- + .pod == "test-hive-metastore-automatic-log-config-0" && + .container == "containerdebug" filteredAutomaticLogConfigMetastoreVector: type: filter - inputs: [validEvents] + inputs: + - validEvents condition: >- .pod == "test-hive-metastore-automatic-log-config-0" && .container == "vector" filteredCustomLogConfigMetastoreHive: type: filter - inputs: [validEvents] + inputs: + - validEvents condition: >- .pod == "test-hive-metastore-custom-log-config-0" && .container == "hive" + filteredCustomLogConfigMetastoreContainerdebug: + type: filter + inputs: + - validEvents + condition: >- + .pod == "test-hive-metastore-custom-log-config-0" && + .container == "containerdebug" filteredCustomLogConfigMetastoreVector: type: filter - inputs: [validEvents] + inputs: + - validEvents condition: >- .pod == "test-hive-metastore-custom-log-config-0" && .container == "vector" filteredInvalidEvents: type: filter - inputs: [vector] + inputs: + - vector condition: |- .timestamp == from_unix_timestamp!(0) || is_null(.level) || @@ -58,11 +78,29 @@ customConfig: is_null(.message) sinks: test: - inputs: [filtered*] + inputs: + - filtered* type: blackhole + # Shows all events received from the agents. This sink is intentional and + # not a debugging leftover: if a "filtered*" transform gathers no event, + # then the assertion only reports a count, whereas this log shows which + # pod and container names actually arrived. A failure in CI cannot be + # reproduced by enabling this afterwards, so it is kept enabled at the + # price of the log volume. + stdout: + inputs: + - vector + type: console + encoding: + codec: json + buffer: + # Avoid back pressure from a stalling stdout. The test should not + # fail because of a sink which only aids debugging. + when_full: drop_newest {% if lookup('env', 'VECTOR_AGGREGATOR') %} aggregator: - inputs: [vector] + inputs: + - vector type: vector routing: endpoints: diff --git a/tests/templates/kuttl/smoke/60-assert.yaml.j2 b/tests/templates/kuttl/smoke/60-assert.yaml.j2 index 6008f6c5..cfde9ed9 100644 --- a/tests/templates/kuttl/smoke/60-assert.yaml.j2 +++ b/tests/templates/kuttl/smoke/60-assert.yaml.j2 @@ -191,6 +191,7 @@ spec: rm -f /stackable/log/_vector/shutdown prepare_signal_handlers + mkdir --parents "$FILE_LOG_DIRECTORY" containerdebug --output=/stackable/log/containerdebug-state.json --loop & {% if test_scenario['values']['hive'].split(',')[0].startswith('3.') %} bin/start-metastore --config /stackable/config --db-type postgres --hive-bin-dir bin & @@ -213,8 +214,12 @@ spec: env: - name: COMMON_VAR value: group-value - - name: CONTAINERDEBUG_LOG_DIRECTORY + - name: FILE_LOG_DIRECTORY value: /stackable/log/containerdebug + - name: FILE_LOG_MAX_FILES + value: "2" + - name: FILE_LOG_ROTATION_PERIOD + value: hourly - name: GROUP_VAR value: group-value - name: HADOOP_HEAPSIZE