From 79e7803a91cec9b72ddec771a73f4090ce564595 Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Sun, 3 Sep 2023 22:33:49 +1000 Subject: [PATCH 1/3] use DEBUG log level to align with other components Signed-off-by: Reuben Miller --- plugins/tedge_log_plugin/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/tedge_log_plugin/src/main.rs b/plugins/tedge_log_plugin/src/main.rs index aeca7284dd3..60f7a34cb58 100644 --- a/plugins/tedge_log_plugin/src/main.rs +++ b/plugins/tedge_log_plugin/src/main.rs @@ -58,7 +58,7 @@ async fn main() -> Result<(), anyhow::Error> { let tedge_config_location = TEdgeConfigLocation::from_custom_root(&logfile_opt.config_dir); let log_level = if logfile_opt.debug { - tracing::Level::TRACE + tracing::Level::DEBUG } else { get_log_level( "tedge-log-plugin", From 860119eb5e310e86176703433cf74825c3e6f532 Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Sun, 3 Sep 2023 22:36:28 +1000 Subject: [PATCH 2/3] fix(tedge-log-plugin): use mqtt client settings and unique mqtt session name The session name should use the root and topic identifiers to avoid client/session clashes when using the log plugin for the main device and multiple child devices causing the client to be disconnected Signed-off-by: Reuben Miller --- .../tedge_config/src/tedge_config_cli/tedge_config.rs | 9 --------- plugins/tedge_log_plugin/src/main.rs | 9 +++++---- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/crates/common/tedge_config/src/tedge_config_cli/tedge_config.rs b/crates/common/tedge_config/src/tedge_config_cli/tedge_config.rs index 10a48fdff7b..7df92cb608e 100644 --- a/crates/common/tedge_config/src/tedge_config_cli/tedge_config.rs +++ b/crates/common/tedge_config/src/tedge_config_cli/tedge_config.rs @@ -102,15 +102,6 @@ impl TEdgeConfig { } client_auth } - - pub fn mqtt_internal_config(&self) -> mqtt_channel::Config { - let host = self.mqtt.bind.address.to_string(); - let port = self.mqtt.bind.port.get(); - - mqtt_channel::Config::default() - .with_host(host) - .with_port(port) - } } #[derive(serde::Deserialize, serde::Serialize, Clone, Copy, PartialEq, Eq, Debug)] diff --git a/plugins/tedge_log_plugin/src/main.rs b/plugins/tedge_log_plugin/src/main.rs index 60f7a34cb58..05da94e6151 100644 --- a/plugins/tedge_log_plugin/src/main.rs +++ b/plugins/tedge_log_plugin/src/main.rs @@ -87,10 +87,11 @@ async fn run( let runtime_events_logger = None; let mut runtime = Runtime::try_new(runtime_events_logger).await?; - let mqtt_config = tedge_config - .mqtt_internal_config() - .with_session_name(TEDGE_LOG_PLUGIN); - let mut mqtt_actor = MqttActorBuilder::new(mqtt_config); + let mqtt_config = tedge_config.mqtt_config()?; + let mut mqtt_actor = MqttActorBuilder::new(mqtt_config.clone().with_session_name(format!( + "{}#{}/{}", + TEDGE_LOG_PLUGIN, topic_root, topic_identifier + ))); let mut fs_watch_actor = FsWatchActorBuilder::new(); From d8e5443e71b01957c87d453986071390d2f2d965 Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Sun, 3 Sep 2023 22:37:08 +1000 Subject: [PATCH 3/3] update cargo lock Signed-off-by: Reuben Miller --- Cargo.lock | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ca9e42e0c5f..e3e32be5977 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2383,19 +2383,20 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.2" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1acb4a4365a13f749a93f1a094a7805e5cfa0955373a9de860d962eaa3a5fe5a" +checksum = "d7a4d085fd991ac8d5b05a147b437791b4260b76326baf0fc60cf7c9c27ecd33" dependencies = [ + "memchr", "thiserror", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.7.2" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "666d00490d4ac815001da55838c500eafb0320019bbaa44444137c48b443a853" +checksum = "a2bee7be22ce7918f641a33f08e3f43388c7656772244e2bbb2477f44cc9021a" dependencies = [ "pest", "pest_generator", @@ -2403,9 +2404,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.2" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ca01446f50dbda87c1786af8770d535423fa8a53aec03b8f4e3d7eb10e0929" +checksum = "d1511785c5e98d79a05e8a6bc34b4ac2168a0e3e92161862030ad84daa223141" dependencies = [ "pest", "pest_meta", @@ -2416,9 +2417,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.7.2" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56af0a30af74d0445c0bf6d9d051c979b516a1a5af790d251daee76005420a48" +checksum = "b42f0394d3123e33353ca5e1e89092e533d2cc490389f2bd6131c43c634ebc5f" dependencies = [ "once_cell", "pest",