Skip to content

Commit

Permalink
iotedge check: Only verify logging options for json-file driver (whic…
Browse files Browse the repository at this point in the history
…h is the default).

This fixes Azure#6754

NOTE: All other logging driver usually do logrotation on their own
  • Loading branch information
MTrensch-hilscher committed Nov 21, 2022
1 parent ed1b6eb commit 3336011
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions edgelet/iotedge/src/check/checks/container_engine_logrotate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 3336011

Please sign in to comment.