From 3336011fb5538e228cc208356eb6f091c98d5f59 Mon Sep 17 00:00:00 2001 From: Michael Trensch Date: Mon, 21 Nov 2022 07:35:42 +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 | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 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..f0064a85d38 100644 --- a/edgelet/iotedge/src/check/checks/container_engine_logrotate.rs +++ b/edgelet/iotedge/src/check/checks/container_engine_logrotate.rs @@ -55,24 +55,23 @@ impl ContainerEngineLogrotate { .context(MESSAGE)?; self.daemon_config = Some(daemon_config.clone()); + /* All logging drivers but json-file (default) do log rotation per default */ match daemon_config.log_driver.as_deref() { - Some("journald") => return Ok(CheckResult::Ok), - 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))); - } + 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 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) } }