From f0da82d22fd816caecf3e9ab79252e5af719aafa Mon Sep 17 00:00:00 2001 From: Michael Trensch Date: Mon, 21 Nov 2022 13:49:28 +0100 Subject: [PATCH] iotedge check: Only verify logging options for json-file driver (which is the default). This fixes #6754 NOTE: All other logging driver usually do logrotation on their own --- .../checks/container_engine_logrotate.rs | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/edgelet/iotedge/src/check/checks/container_engine_logrotate.rs b/edgelet/iotedge/src/check/checks/container_engine_logrotate.rs index d4fdf4e037f..7c814cb08de 100644 --- a/edgelet/iotedge/src/check/checks/container_engine_logrotate.rs +++ b/edgelet/iotedge/src/check/checks/container_engine_logrotate.rs @@ -56,21 +56,20 @@ impl ContainerEngineLogrotate { self.daemon_config = Some(daemon_config.clone()); match daemon_config.log_driver.as_deref() { - Some("journald") => return Ok(CheckResult::Ok), - None => return Ok(CheckResult::Warning(anyhow!(MESSAGE))), - _ => (), - } + None | Some("json-file") => { + if let Some(log_opts) = &daemon_config.log_opts { + if log_opts.max_file.is_none() { + return Ok(CheckResult::Warning(anyhow!(MESSAGE))); + } - if let Some(log_opts) = &daemon_config.log_opts { - if log_opts.max_file.is_none() { - return Ok(CheckResult::Warning(anyhow!(MESSAGE))); + if log_opts.max_size.is_none() { + return Ok(CheckResult::Warning(anyhow!(MESSAGE))); + } + } else { + return Ok(CheckResult::Warning(anyhow!(MESSAGE))); + } } - - if log_opts.max_size.is_none() { - return Ok(CheckResult::Warning(anyhow!(MESSAGE))); - } - } else { - return Ok(CheckResult::Warning(anyhow!(MESSAGE))); + _ => (), } Ok(CheckResult::Ok)