Skip to content

Commit eace189

Browse files
fix(stackable-operator): Persist the Vector state in the log directory (#1149)
1 parent 7bfcac5 commit eace189

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

crates/stackable-operator/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
### Fixed
8+
9+
- Store the Vector state in the log directory to ensure it persists across container restarts ([#1149]).
10+
11+
[#1149]: https://github.com/stackabletech/operator-rs/pull/1149
12+
713
## [0.105.0] - 2026-02-03
814

915
### Added

crates/stackable-operator/src/product_logging/framework.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,26 @@ use crate::{
2121

2222
/// Config directory used in the Vector log agent container
2323
const STACKABLE_CONFIG_DIR: &str = "/stackable/config";
24+
2425
/// Directory in the Vector container which contains a subdirectory for every container which
2526
/// themselves contain the corresponding log files
2627
const STACKABLE_LOG_DIR: &str = "/stackable/log";
28+
2729
/// Subdirectory of the log directory containing files to control the Vector instance
2830
const VECTOR_LOG_DIR: &str = "_vector";
31+
32+
/// Subdirectory of the log directory containing the Vector state data
33+
const VECTOR_STATE_DIR: &str = "_vector-state";
34+
2935
/// File to signal that Vector should be gracefully shut down
3036
const SHUTDOWN_FILE: &str = "shutdown";
3137

3238
/// File name of the Vector config file
3339
pub const VECTOR_CONFIG_FILE: &str = "vector.yaml";
40+
3441
/// Key in the discovery ConfigMap that holds the vector aggregator address
3542
const VECTOR_AGGREGATOR_CM_KEY: &str = "ADDRESS";
43+
3644
/// Name of the env var in the vector container that holds the vector aggregator address
3745
const VECTOR_AGGREGATOR_ENV_NAME: &str = "VECTOR_AGGREGATOR_ADDRESS";
3846

@@ -705,7 +713,7 @@ where
705713
};
706714

707715
format!(
708-
r#"data_dir: /stackable/vector/var
716+
r#"data_dir: {STACKABLE_LOG_DIR}/{VECTOR_STATE_DIR}
709717
710718
log_schema:
711719
host_key: pod
@@ -1436,6 +1444,7 @@ pub fn vector_container(
14361444
// exec vector --config {STACKABLE_CONFIG_DIR}/{VECTOR_CONFIG_FILE}
14371445
.args(vec![format!(
14381446
"\
1447+
mkdir --parents {STACKABLE_LOG_DIR}/{VECTOR_STATE_DIR}
14391448
# Vector will ignore SIGTERM (as PID != 1) and must be shut down by writing a shutdown trigger file
14401449
vector --config {STACKABLE_CONFIG_DIR}/{VECTOR_CONFIG_FILE} & vector_pid=$!
14411450
if [ ! -f \"{STACKABLE_LOG_DIR}/{VECTOR_LOG_DIR}/{SHUTDOWN_FILE}\" ]; then

0 commit comments

Comments
 (0)