From f28bdff94f82d18c2d75d179c6f35f524f5b220c Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 26 Nov 2026 16:25:26 +0000 Subject: [PATCH] feat: a second OTel logs exporter for audit logs (#12675) * feat: a second OTel logs exporter for audit logs Co-Authored-By: Claude Opus 5.5 * chore: pin ee to the audit logs exporter companion Co-Authored-By: Claude Opus 5.5 * fix: redact otel exporter headers when logging the otel setting Co-Authored-By: Claude Opus 5.5 * chore: update ee-repo-ref to 9a5254e3dc2ea4af8e20fd497b50025f99fa02b3 This commit updates the EE repository reference after PR #1013 was merged in windmill-ee-private. Previous ee-repo-ref: 8c53ef5354a79af46cdce617b0df5416c240a27c New ee-repo-ref: 9a5254e3dc2ea4af8e20fd497b50025f99fa02b3 Automated by sync-ee-ref workflow. --------- Co-authored-by: Claude Opus 5.5 Co-authored-by: windmill-internal-app[bot] --- backend/Cargo.lock | 2 + backend/Cargo.toml | 1 + backend/ee-repo-ref.txt | 2 +- backend/src/monitor.rs | 44 +++++- backend/windmill-common/Cargo.toml | 6 +- .../windmill-common/src/global_settings.rs | 6 + .../windmill-common/src/instance_config.rs | 33 ++++- backend/windmill-common/src/lib.rs | 59 ++++++++ backend/windmill-common/src/otel_oss.rs | 14 ++ backend/windmill-common/src/tracing_init.rs | 132 +++++++++++++++++- .../src/lib/components/InstanceSetting.svelte | 2 + .../OtelAuditLogsSettings.svelte | 95 +++++++++++++ .../OtelAuditWorkspaces.svelte | 40 ++++++ 13 files changed, 428 insertions(+), 8 deletions(-) create mode 100644 frontend/src/lib/components/instanceSettings/OtelAuditLogsSettings.svelte create mode 100644 frontend/src/lib/components/instanceSettings/OtelAuditWorkspaces.svelte diff --git a/backend/Cargo.lock b/backend/Cargo.lock index cbb979f570..2a6e93941c 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -16530,6 +16530,7 @@ dependencies = [ "openidconnect", "opentelemetry 0.30.0", "opentelemetry-appender-tracing", + "opentelemetry-http 0.30.0", "opentelemetry-otlp 0.30.0", "opentelemetry-semantic-conventions 0.30.0", "opentelemetry_sdk 0.30.0", @@ -16545,6 +16546,7 @@ dependencies = [ "rand 0.9.5", "rcgen", "regex", + "reqwest 0.12.28", "reqwest 0.13.5", "reqwest-middleware", "reqwest-retry", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 2bfcbff09e..e8f206883e 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -712,6 +712,7 @@ tracing-opentelemetry = "0.31.0" opentelemetry_sdk = { version = "0.30.0", features = ["rt-tokio", "testing"] } opentelemetry-otlp = { version = "0.30.0", features = ["grpc-tonic", "tls", "http-proto", "gzip-tonic", "zstd-tonic"] } opentelemetry-appender-tracing = "0.30.0" +opentelemetry-http = "0.30.0" opentelemetry-semantic-conventions = { version = "0.30.0", features = ["semconv_experimental"] } opentelemetry-proto = { version = "0.30.0", features = ["with-serde", "gen-tonic"] } prost = "0.13" diff --git a/backend/ee-repo-ref.txt b/backend/ee-repo-ref.txt index 5a449e3bd8..c482c3d181 100644 --- a/backend/ee-repo-ref.txt +++ b/backend/ee-repo-ref.txt @@ -1 +1 @@ -04fb511569ecb790b24e0a2f70e316de34cbb067 +9a5254e3dc2ea4af8e20fd497b50025f99fa02b3 diff --git a/backend/src/monitor.rs b/backend/src/monitor.rs index 6c70e666a8..f25182b30a 100644 --- a/backend/src/monitor.rs +++ b/backend/src/monitor.rs @@ -111,7 +111,7 @@ use windmill_common::{ CRITICAL_ALERT_MUTE_ZOMBIE_JOB_RESTART, CRITICAL_ERROR_CHANNELS, DB, DEFAULT_HUB_BASE_URL, DEFAULT_OTEL_TRACES_RETENTION_SECS, DEFAULT_SERVICE_LOG_RETENTION_SECS, HUB_BASE_URL, JOB_RETENTION_SECS, JOB_RETENTION_SECS_OVERRIDES, JOB_RETENTION_SECS_OVERRIDES_LOADED, - METRICS_DEBUG_ENABLED, METRICS_ENABLED, MONITOR_LOGS_ON_OBJECT_STORE, OTEL_LOGS_ENABLED, + METRICS_DEBUG_ENABLED, METRICS_ENABLED, MONITOR_LOGS_ON_OBJECT_STORE, OtelAuditLogsExport, OTEL_AUDIT_LOGS_EXPORT, OTEL_LOGS_ENABLED, OTEL_LOGS_EXCLUDE_AUDIT, OTEL_METRICS_ENABLED, OTEL_TRACING_ENABLED, STORE_AUDIT_LOGS_S3, }; use windmill_common::{ @@ -802,6 +802,15 @@ pub fn apply_metrics_enabled(value: Option) { struct OtelSetting { metrics_enabled: Option, logs_enabled: Option, + logs_exclude_audit: Option, + audit_logs_enabled: Option, + #[serde(default, deserialize_with = "empty_as_none")] + audit_logs_endpoint: Option, + #[serde(default, deserialize_with = "empty_as_none")] + audit_logs_headers: Option, + #[serde(default, deserialize_with = "empty_as_none")] + audit_logs_protocol: Option, + audit_logs_workspaces: Option>, tracing_enabled: Option, #[serde(default, deserialize_with = "empty_as_none")] otel_exporter_otlp_endpoint: Option, @@ -837,6 +846,37 @@ pub async fn load_otel(db: &DB) { OTEL_METRICS_ENABLED.store(metrics_enabled, Ordering::Relaxed); OTEL_LOGS_ENABLED.store(logs_enabled, Ordering::Relaxed); + + let env_bool = |var: &str| { + std::env::var(var) + .map(|x| x.parse::().unwrap_or(false)) + .unwrap_or(false) + }; + let logs_exclude_audit = o + .logs_exclude_audit + .unwrap_or_else(|| env_bool("OTEL_LOGS_EXCLUDE_AUDIT")); + OTEL_LOGS_EXCLUDE_AUDIT.store(logs_exclude_audit, Ordering::Relaxed); + let audit_logs = OtelAuditLogsExport::new( + o.audit_logs_enabled + .unwrap_or_else(|| env_bool("OTEL_AUDIT_LOGS_ENABLED")), + o.audit_logs_endpoint + .or_else(|| std::env::var("OTEL_AUDIT_LOGS_ENDPOINT").ok()), + o.audit_logs_headers + .or_else(|| std::env::var("OTEL_AUDIT_LOGS_HEADERS").ok()), + o.audit_logs_protocol + .or_else(|| std::env::var("OTEL_AUDIT_LOGS_PROTOCOL").ok()), + // A saved empty list means every workspace and does not fall back to the + // environment, so clearing the list in the UI cannot bring an env list back. + o.audit_logs_workspaces.or_else(|| { + std::env::var("OTEL_AUDIT_LOGS_WORKSPACES") + .ok() + .map(|v| v.split(',').map(str::to_string).collect()) + }), + ); + let audit_logs_endpoint = audit_logs.as_ref().map(|a| a.endpoint.clone()); + if let Ok(mut export) = OTEL_AUDIT_LOGS_EXPORT.write() { + *export = audit_logs; + } OTEL_TRACING_ENABLED.store(tracing_enabled, Ordering::Relaxed); let endpoint = if let Some(endpoint) = o.otel_exporter_otlp_endpoint { @@ -867,7 +907,7 @@ pub async fn load_otel(db: &DB) { std::env::set_var("OTEL_EXPORTER_OTLP_COMPRESSION", compression); } } - println!("OTEL settings loaded: tracing ({tracing_enabled}), logs ({logs_enabled}), metrics ({metrics_enabled}), endpoint ({:?}), headers defined: ({})", + println!("OTEL settings loaded: tracing ({tracing_enabled}), logs ({logs_enabled}, without audit: {logs_exclude_audit}), audit logs endpoint ({audit_logs_endpoint:?}), metrics ({metrics_enabled}), endpoint ({:?}), headers defined: ({})", endpoint, headers.is_some()); } else { tracing::error!("Error deserializing otel settings"); diff --git a/backend/windmill-common/Cargo.toml b/backend/windmill-common/Cargo.toml index c44679b611..c5ed308a60 100644 --- a/backend/windmill-common/Cargo.toml +++ b/backend/windmill-common/Cargo.toml @@ -17,7 +17,8 @@ benchmark = [] parquet = [] aws_auth = ["dep:aws-sdk-sts", "dep:aws-config"] otel = ["dep:opentelemetry-semantic-conventions", "dep:opentelemetry-otlp", "dep:opentelemetry_sdk", - "dep:tracing-opentelemetry", "dep:opentelemetry-appender-tracing", "dep:tonic", "dep:opentelemetry"] + "dep:tracing-opentelemetry", "dep:opentelemetry-appender-tracing", "dep:tonic", "dep:opentelemetry", + "dep:opentelemetry-http", "dep:reqwest_otel"] smtp = ["dep:mail-send", "dep:rustls", "dep:tokio-rustls", "dep:rustls-native-certs", "dep:webpki-roots"] scoped_cache = [] cloud = [] @@ -142,6 +143,9 @@ opentelemetry = { workspace = true, optional = true } tracing-opentelemetry = { workspace = true, optional = true } opentelemetry-appender-tracing = { workspace = true, optional = true } tonic = { workspace = true, optional = true } +opentelemetry-http = { workspace = true, optional = true } +# The reqwest the OTLP/HTTP exporter is built on, for a client of our own around it. +reqwest_otel = { package = "reqwest", version = "0.12", features = ["blocking"], optional = true } equivalent = "1.0.2" [dev-dependencies] diff --git a/backend/windmill-common/src/global_settings.rs b/backend/windmill-common/src/global_settings.rs index eaa86d7066..4792d02e63 100644 --- a/backend/windmill-common/src/global_settings.rs +++ b/backend/windmill-common/src/global_settings.rs @@ -933,6 +933,12 @@ pub const ENV_SETTINGS: &[&str] = &[ "OTEL_METRICS_ENABLED", "OTEL_TRACING_ENABLED", "OTEL_LOGS_ENABLED", + "OTEL_LOGS_EXCLUDE_AUDIT", + // OTEL_AUDIT_LOGS_HEADERS is left out for the same reason as the exporter headers above. + "OTEL_AUDIT_LOGS_ENABLED", + "OTEL_AUDIT_LOGS_ENDPOINT", + "OTEL_AUDIT_LOGS_PROTOCOL", + "OTEL_AUDIT_LOGS_WORKSPACES", "OTEL_EXPORTER_OTLP_ENDPOINT", "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT", diff --git a/backend/windmill-common/src/instance_config.rs b/backend/windmill-common/src/instance_config.rs index cac35f3bfc..16e8f97a07 100644 --- a/backend/windmill-common/src/instance_config.rs +++ b/backend/windmill-common/src/instance_config.rs @@ -649,6 +649,21 @@ pub struct OtelSettings { pub metrics_enabled: Option, #[serde(skip_serializing_if = "Option::is_none")] pub logs_enabled: Option, + /// Leave audit events out of the logs export. + #[serde(skip_serializing_if = "Option::is_none")] + pub logs_exclude_audit: Option, + /// A second logs exporter that receives audit events only. + #[serde(skip_serializing_if = "Option::is_none")] + pub audit_logs_enabled: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub audit_logs_endpoint: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub audit_logs_headers: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub audit_logs_protocol: Option, + /// Restrict the audit export to these workspaces; instance-level entries are always kept. + #[serde(skip_serializing_if = "Option::is_none")] + pub audit_logs_workspaces: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub tracing_enabled: Option, #[serde(skip_serializing_if = "Option::is_none")] @@ -1229,7 +1244,10 @@ const NESTED_SENSITIVE_FIELDS: &[(&str, &[&str])] = &[ ("custom_instance_pg_databases", &["user_pwd"]), ("external_instance_pg", &["password"]), ("github_enterprise_app", &["private_key"]), - ("otel", &["otel_exporter_otlp_headers"]), + ( + "otel", + &["otel_exporter_otlp_headers", "audit_logs_headers"], + ), ]; /// Settings that are maps-of-objects where each child has sensitive sub-fields. @@ -3117,6 +3135,19 @@ mod tests { assert!(formatted.contains("****")); } + #[test] + fn format_setting_value_redacts_otel_headers() { + let val = serde_json::json!({ + "otel_exporter_otlp_endpoint": "http://collector:4317", + "otel_exporter_otlp_headers": "Authorization=Bearer main-token-12345", + "audit_logs_headers": "Authorization=Bearer audit-token-67890" + }); + let formatted = format_setting_value("otel", &val); + assert!(!formatted.contains("main-token-12345")); + assert!(!formatted.contains("audit-token-67890")); + assert!(formatted.contains("http://collector:4317")); + } + #[test] fn format_setting_value_redacts_nested_credentials() { let val = serde_json::json!({ diff --git a/backend/windmill-common/src/lib.rs b/backend/windmill-common/src/lib.rs index 04b52d7169..84a509a5df 100644 --- a/backend/windmill-common/src/lib.rs +++ b/backend/windmill-common/src/lib.rs @@ -484,6 +484,10 @@ lazy_static::lazy_static! { pub static ref OTEL_METRICS_ENABLED: AtomicBool = AtomicBool::new(std::env::var("OTEL_METRICS").is_ok()); pub static ref OTEL_TRACING_ENABLED: AtomicBool = AtomicBool::new(std::env::var("OTEL_TRACING").is_ok()); pub static ref OTEL_LOGS_ENABLED: AtomicBool = AtomicBool::new(std::env::var("OTEL_LOGS").is_ok()); + /// Leave audit events out of the logs export, for when the audit export carries them. + pub static ref OTEL_LOGS_EXCLUDE_AUDIT: AtomicBool = AtomicBool::new(env_bool("OTEL_LOGS_EXCLUDE_AUDIT")); + pub static ref OTEL_AUDIT_LOGS_EXPORT: std::sync::RwLock> = + std::sync::RwLock::new(OtelAuditLogsExport::from_env()); pub static ref METRICS_DEBUG_ENABLED: AtomicBool = AtomicBool::new(false); @@ -3469,3 +3473,58 @@ impl KillpillSender { // self.already_sent.load(Ordering::SeqCst) // } } + +fn env_bool(var: &str) -> bool { + std::env::var(var).is_ok_and(|x| x.parse::().unwrap_or(false)) +} + +/// An OTLP logs exporter of its own for audit events, beside the logs export: audit events can +/// go to long-term storage while the service logs go elsewhere, or nowhere. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct OtelAuditLogsExport { + pub endpoint: String, + /// `key=value` pairs separated by commas, as in `OTEL_EXPORTER_OTLP_HEADERS`. + pub headers: Option, + /// `grpc` (the default) or `http/protobuf`. + pub protocol: Option, + /// Only the audit events of these workspaces, and of the instance itself, are exported. + /// `None` exports every workspace. + pub workspaces: Option>, +} + +impl OtelAuditLogsExport { + pub fn new( + enabled: bool, + endpoint: Option, + headers: Option, + protocol: Option, + workspaces: Option>, + ) -> Option { + let endpoint = endpoint.filter(|e| !e.trim().is_empty())?; + enabled.then(|| Self { + endpoint: endpoint.trim().to_string(), + headers: headers.filter(|h| !h.trim().is_empty()), + protocol: protocol.filter(|p| !p.trim().is_empty()), + workspaces: workspaces + .map(|w| { + w.iter() + .map(|w| w.trim().to_string()) + .filter(|w| !w.is_empty()) + .collect::>() + }) + .filter(|w| !w.is_empty()), + }) + } + + fn from_env() -> Option { + Self::new( + env_bool("OTEL_AUDIT_LOGS_ENABLED"), + std::env::var("OTEL_AUDIT_LOGS_ENDPOINT").ok(), + std::env::var("OTEL_AUDIT_LOGS_HEADERS").ok(), + std::env::var("OTEL_AUDIT_LOGS_PROTOCOL").ok(), + std::env::var("OTEL_AUDIT_LOGS_WORKSPACES") + .ok() + .map(|v| v.split(',').map(str::to_string).collect()), + ) + } +} diff --git a/backend/windmill-common/src/otel_oss.rs b/backend/windmill-common/src/otel_oss.rs index 9dac8a07db..4de717278b 100644 --- a/backend/windmill-common/src/otel_oss.rs +++ b/backend/windmill-common/src/otel_oss.rs @@ -63,6 +63,20 @@ pub(crate) fn init_logs_bridge_for_service( None } +#[cfg(not(feature = "private"))] +pub(crate) fn init_audit_logs_bridge(_mode: &Mode, _hostname: &str, _env: &str) -> Option { + None +} + +#[cfg(not(feature = "private"))] +pub(crate) fn init_audit_logs_bridge_for_service( + _service: &str, + _hostname: &str, + _env: &str, +) -> Option { + None +} + /// Export the log records still batched, for a process about to exit. #[cfg(not(feature = "private"))] pub async fn flush_otel_logs() {} diff --git a/backend/windmill-common/src/tracing_init.rs b/backend/windmill-common/src/tracing_init.rs index 855e077004..baf1d831e4 100644 --- a/backend/windmill-common/src/tracing_init.rs +++ b/backend/windmill-common/src/tracing_init.rs @@ -67,6 +67,14 @@ fn create_targets_filter(default_env_filter: LevelFilter) -> Targets { } } +fn audit_filter() -> Targets { + Targets::new().with_target(AUDIT_TARGET, LevelFilter::INFO) +} + +fn not_audit_filter() -> tracing_subscriber::filter::FilterFn) -> bool> { + tracing_subscriber::filter::filter_fn(|m| m.target() != AUDIT_TARGET) +} + pub const LOGS_SERVICE: &str = "logs/services/"; pub const LOGS_AUDIT: &str = "logs/audit/"; @@ -120,6 +128,7 @@ pub fn initialize_tracing( let opentelemetry: Option = None; let logs_bridge = crate::otel_oss::init_logs_bridge(&mode, hostname, environment); + let audit_logs_bridge = crate::otel_oss::init_audit_logs_bridge(&mode, hostname, environment); use tracing_appender::rolling::{RollingFileAppender, Rotation}; @@ -168,6 +177,9 @@ pub fn initialize_tracing( // Create a common filter for OTEL logs bridge and tracing layer to respect RUST_LOG let otel_logs_filter = file_env_filter.clone(); + let otel_logs_without_audit = crate::OTEL_LOGS_EXCLUDE_AUDIT + .load(std::sync::atomic::Ordering::Relaxed) + .then(not_audit_filter); // Apply filter to the opentelemetry tracing layer to prevent debug events from being attached to spans #[cfg(all(feature = "otel", feature = "enterprise"))] @@ -180,7 +192,17 @@ pub fn initialize_tracing( let opentelemetry_filtered = opentelemetry; let base_layer = tracing_subscriber::registry() - .with(logs_bridge.with_filter(otel_logs_filter)) + .with( + logs_bridge + .with_filter(otel_logs_filter) + .with_filter(otel_logs_without_audit), + ) + // Audit events reach their own export whatever RUST_LOG is set to. + .with( + audit_logs_bridge + .with_filter(audit_filter()) + .with_filter(audit_workspace_filter()), + ) .with(opentelemetry_filtered); // The service log files are written to be indexed, not tailed, so they always carry the @@ -229,9 +251,18 @@ pub fn initialize_tracing( /// value, masked by a list of known secret fields rather than by shape, and that is fit /// for the operator's own stdout but not for a collector. pub fn initialize_subcommand_tracing(service: &str, hostname: &str, environment: &str) { - let logs_bridge = crate::otel_oss::init_logs_bridge_for_service(service, hostname, environment); + let logs_bridge = (!crate::OTEL_LOGS_EXCLUDE_AUDIT.load(std::sync::atomic::Ordering::Relaxed)) + .then(|| crate::otel_oss::init_logs_bridge_for_service(service, hostname, environment)) + .flatten(); + let audit_logs_bridge = + crate::otel_oss::init_audit_logs_bridge_for_service(service, hostname, environment); tracing_subscriber::registry() - .with(logs_bridge.with_filter(Targets::new().with_target(AUDIT_TARGET, LevelFilter::INFO))) + .with(logs_bridge.with_filter(audit_filter())) + .with( + audit_logs_bridge + .with_filter(audit_filter()) + .with_filter(audit_workspace_filter()), + ) .with( tracing_subscriber::fmt::layer().with_filter( EnvFilter::builder() @@ -242,6 +273,50 @@ pub fn initialize_subcommand_tracing(service: &str, hostname: &str, environment: .init(); } +/// Keeps the audit events of the listed workspaces and lets every other event through. +/// Entries about the instance itself are recorded under workspace `global` and always kept: +/// no workspace stands behind them, and dropping them would hide settings changes. +struct AuditWorkspaceFilter(std::collections::HashSet); + +impl AuditWorkspaceFilter { + fn new(workspaces: Vec) -> Self { + Self(workspaces.into_iter().collect()) + } +} + +impl tracing_subscriber::layer::Filter for AuditWorkspaceFilter { + fn enabled(&self, _: &tracing::Metadata<'_>, _: &Context<'_, S>) -> bool { + true + } + + fn event_enabled(&self, event: &Event<'_>, _: &Context<'_, S>) -> bool { + if event.metadata().target() != AUDIT_TARGET { + return true; + } + struct Workspace<'a>(&'a std::collections::HashSet, Option); + impl tracing::field::Visit for Workspace<'_> { + fn record_str(&mut self, field: &tracing::field::Field, value: &str) { + if field.name() == "workspace_id" { + self.1 = Some(value == "global" || self.0.contains(value)); + } + } + fn record_debug(&mut self, _: &tracing::field::Field, _: &dyn std::fmt::Debug) {} + } + let mut ws = Workspace(&self.0, None); + event.record(&mut ws); + ws.1.unwrap_or(true) + } +} + +/// The workspace scope of the audit export, `None` for every workspace. +fn audit_workspace_filter() -> Option { + crate::OTEL_AUDIT_LOGS_EXPORT + .read() + .ok() + .and_then(|e| e.as_ref().and_then(|e| e.workspaces.clone())) + .map(AuditWorkspaceFilter::new) +} + lazy_static::lazy_static! { pub static ref LOG_COUNTING_BY_MIN: Arc>> = Arc::new(RwLock::new(HashMap::new())); } @@ -290,3 +365,54 @@ where } } } + +#[cfg(test)] +mod tests { + use super::*; + use std::sync::Mutex; + + #[derive(Clone, Default)] + struct Seen(Arc>>); + + impl tracing_subscriber::Layer for Seen { + fn on_event(&self, event: &Event<'_>, _: Context<'_, S>) { + struct Msg(String); + impl tracing::field::Visit for Msg { + fn record_debug(&mut self, f: &tracing::field::Field, v: &dyn std::fmt::Debug) { + if f.name() == "message" { + self.0 = format!("{v:?}"); + } + } + } + let mut m = Msg(String::new()); + event.record(&mut m); + self.0.lock().unwrap().push(m.0); + } + } + + /// The two exports as `initialize_tracing` filters them: the logs export without audit + /// events, and the audit export with audit events of the listed workspaces only. + #[test] + fn audit_and_logs_exports_split_events() { + let logs = Seen::default(); + let audit = Seen::default(); + tracing::subscriber::with_default( + tracing_subscriber::registry() + .with(logs.clone().with_filter(Some(not_audit_filter()))) + .with( + audit + .clone() + .with_filter(audit_filter()) + .with_filter(Some(AuditWorkspaceFilter::new(vec!["kept".to_string()]))), + ), + || { + tracing::info!(target: AUDIT_TARGET, workspace_id = "kept", "a"); + tracing::info!(target: AUDIT_TARGET, workspace_id = "dropped", "b"); + tracing::info!(target: AUDIT_TARGET, workspace_id = "global", "c"); + tracing::info!(workspace_id = "kept", "d"); + }, + ); + assert_eq!(*logs.0.lock().unwrap(), ["d"]); + assert_eq!(*audit.0.lock().unwrap(), ["a", "c"]); + } +} diff --git a/frontend/src/lib/components/InstanceSetting.svelte b/frontend/src/lib/components/InstanceSetting.svelte index f9607d9f2f..48323cab2a 100644 --- a/frontend/src/lib/components/InstanceSetting.svelte +++ b/frontend/src/lib/components/InstanceSetting.svelte @@ -23,6 +23,7 @@ import RetentionPeriodOverrides from './instanceSettings/RetentionPeriodOverrides.svelte' import AgentWorkloadIdentityIssuers from './instanceSettings/AgentWorkloadIdentityIssuers.svelte' import McpExternalIdp from './instanceSettings/McpExternalIdp.svelte' + import OtelAuditLogsSettings from './instanceSettings/OtelAuditLogsSettings.svelte' import WorkspaceRolesSetting from './instanceSettings/WorkspaceRolesSetting.svelte' import SmtpSettings from './instanceSettings/SmtpSettings.svelte' import SecretBackendConfig from './instanceSettings/SecretBackendConfig.svelte' @@ -725,6 +726,7 @@ Service name, environment, resource attributes, metrics temporality and other options are set with environment variables. + {/if} {:else if setting.fieldType == 'otel_tracing_proxy'} diff --git a/frontend/src/lib/components/instanceSettings/OtelAuditLogsSettings.svelte b/frontend/src/lib/components/instanceSettings/OtelAuditLogsSettings.svelte new file mode 100644 index 0000000000..f852bd9dd5 --- /dev/null +++ b/frontend/src/lib/components/instanceSettings/OtelAuditLogsSettings.svelte @@ -0,0 +1,95 @@ + + +{#if $values.otel} + {#if $values.otel.logs_enabled} + + {/if} + +
+
+ Audit logs export + + A second logs exporter that receives audit logs only, whatever the log level, for example to + keep them in long-term storage. It has its own endpoint and headers. + +
+ + {#if $values.otel.audit_logs_enabled} +
+ + +
+
+ + +
+
+ +