Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ All notable changes to this project will be documented in this file.
- Support floating tags for product images via the new `spec.image.stackableVersionPolicy` field
([#876]).
- Add `/ready` endpoint to the operator Deployment, which reports the CRD installation status ([#880]).
- The logs of the `containerdebug` process are now collected by the Vector agent and forwarded to
the Vector aggregator ([#894]).

### Changed

Expand Down Expand Up @@ -48,6 +50,10 @@ All notable changes to this project will be documented in this file.
See [our internal issue](https://github.com/stackabletech/hdfs-operator/issues/626) and [the fix](https://github.com/kube-rs/kube/pull/2042) for details ([#860]).
- The operator now watches all resources that it creates and early-exits the reconcile action when the
cluster is marked for deletion ([#867]).
- 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 ([#894]).

### Remove

Expand All @@ -71,6 +77,7 @@ All notable changes to this project will be documented in this file.
[#889]: https://github.com/stackabletech/druid-operator/pull/889
[#891]: https://github.com/stackabletech/druid-operator/pull/891
[#892]: https://github.com/stackabletech/druid-operator/pull/892
[#894]: https://github.com/stackabletech/druid-operator/pull/894

## [26.7.0] - 2026-07-21

Expand Down
8 changes: 8 additions & 0 deletions docs/modules/druid/pages/usage-guide/logging.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,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 `druid` 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/druid` 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.

Comment thread
NickLarsenNZ marked this conversation as resolved.
Resolved
Further information on how to configure logging, can be found in xref:concepts:logging.adoc[].
33 changes: 22 additions & 11 deletions rust/operator-binary/src/controller/build/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use std::str::FromStr;

use const_format::concatcp;
use snafu::{ResultExt, Snafu};
use stackable_operator::{
builder::pod::{
Expand All @@ -17,7 +18,7 @@ use stackable_operator::{
},
product_logging,
v2::{
builder::pod::container::{EnvVarName, EnvVarSet, new_container_builder},
builder::pod::container::{EnvVarSet, new_container_builder},
product_logging::framework::{
STACKABLE_LOG_DIR, ValidatedContainerLogConfigChoice, vector_container,
},
Expand All @@ -39,8 +40,9 @@ use crate::{
},
},
crd::{
Container, DRUID_CONFIG_DIRECTORY, DeepStorageSpec, HDFS_CONFIG_DIRECTORY,
LOG_CONFIG_DIRECTORY, METRICS_PORT, METRICS_PORT_NAME, RW_CONFIG_DIRECTORY,
Container, DRUID_CONFIG_DIRECTORY, DeepStorageSpec, FILE_LOG_DIRECTORY, FILE_LOG_MAX_FILES,
FILE_LOG_ROTATION_PERIOD, HDFS_CONFIG_DIRECTORY, LOG_CONFIG_DIRECTORY, METRICS_PORT,
METRICS_PORT_NAME, RW_CONFIG_DIRECTORY,
},
};

Expand All @@ -51,9 +53,6 @@ stackable_operator::constant!(pub(crate) LOG_CONFIG_VOLUME_NAME: VolumeName = "l
stackable_operator::constant!(pub(crate) LOG_VOLUME_NAME: VolumeName = "log");
stackable_operator::constant!(pub(crate) RW_CONFIG_VOLUME_NAME: VolumeName = "rwconfig");

// Needed for the `containerdebug` process to log its tracing information to.
stackable_operator::constant!(pub(crate) CONTAINERDEBUG_LOG_DIRECTORY: EnvVarName = "CONTAINERDEBUG_LOG_DIRECTORY");

// volume mount directory (not a volume name)
const USERDATA_MOUNTPOINT: &str = "/stackable/userdata";

Expand Down Expand Up @@ -269,10 +268,20 @@ pub(crate) fn containers_and_volumes(inputs: &RoleGroupInputs) -> Result<Contain
));
}

env_vars = env_vars.with_value(
&CONTAINERDEBUG_LOG_DIRECTORY,
format!("{STACKABLE_LOG_DIR}/containerdebug"),
);
// Let the `containerdebug` process write its tracing information to a file. These are the
// generic `stackable-telemetry` variables and apply to the whole Druid 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`.
env_vars = env_vars
// 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(
&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");

// Environment variable overrides (highest precedence), merged from role and role group.
// They are merged in last so that they override any operator-set environment variable.
Expand Down Expand Up @@ -453,6 +462,9 @@ fn add_log_volume_and_volume_mounts(
VolumeBuilder::new(&*LOG_VOLUME_NAME)
.with_empty_dir(
Some(""),
// Only the Druid 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_DRUID_LOG_FILES_SIZE],
)),
Expand All @@ -473,6 +485,5 @@ mod tests {
let _ = *LOG_CONFIG_VOLUME_NAME;
let _ = *LOG_VOLUME_NAME;
let _ = *RW_CONFIG_VOLUME_NAME;
let _ = *CONTAINERDEBUG_LOG_DIRECTORY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,7 @@ mod tests {
let content = vector_config_file_content();
assert!(!content.is_empty());
assert!(content.contains("files_log4j2"));
assert!(content.contains("files_tracing_rs"));
assert!(content.contains("*.tracing-rs.json"));
}
}
Loading
Loading