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 committed Nov 30, 2022
1 parent dc5c99e commit 2071f48
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions edgelet/iotedge/src/check/checks/container_engine_logrotate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,21 @@ impl ContainerEngineLogrotate {
.context(MESSAGE)?;
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))),
_ => (),
}

if let Some(log_opts) = &daemon_config.log_opts {
if log_opts.max_file.is_none() {
return Ok(CheckResult::Warning(anyhow!(MESSAGE)));
}
if matches!(
daemon_config.log_driver.as_deref(),
Some("json-file") | None
) {
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() {
if log_opts.max_size.is_none() {
return Ok(CheckResult::Warning(anyhow!(MESSAGE)));
}
} else {
return Ok(CheckResult::Warning(anyhow!(MESSAGE)));
}
} else {
return Ok(CheckResult::Warning(anyhow!(MESSAGE)));
}

Ok(CheckResult::Ok)
Expand Down

0 comments on commit 2071f48

Please sign in to comment.