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 5b482397f26..c0a4d2711f8 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 @@ -373,9 +373,9 @@ define_tedge_config! { topics: TemplatesSet, enable: { - /// Enable log management - #[tedge_config(example = "true", default(value = true))] - log_management: bool, + /// Enable log_upload feature + #[tedge_config(example = "true", default(value = true), deprecated_name = "log_management")] + log_upload: bool, /// Enable config_snapshot feature #[tedge_config(example = "true", default(value = false))] diff --git a/crates/extensions/c8y_mapper_ext/src/config.rs b/crates/extensions/c8y_mapper_ext/src/config.rs index fbf94f5e537..17e0636ad11 100644 --- a/crates/extensions/c8y_mapper_ext/src/config.rs +++ b/crates/extensions/c8y_mapper_ext/src/config.rs @@ -93,7 +93,7 @@ impl C8yMapperConfig { let tedge_http_host = format!("{}:{}", tedge_http_address, tedge_http_port); let capabilities = Capabilities { - log_management: tedge_config.c8y.enable.log_management, + log_upload: tedge_config.c8y.enable.log_upload, config_snapshot: tedge_config.c8y.enable.config_snapshot, config_update: tedge_config.c8y.enable.config_update, }; @@ -103,7 +103,7 @@ impl C8yMapperConfig { // Add feature topic filters topics.add_all(mqtt_schema.topics(AnyEntity, Command(OperationType::Restart))); topics.add_all(mqtt_schema.topics(AnyEntity, CommandMetadata(OperationType::Restart))); - if capabilities.log_management { + if capabilities.log_upload { topics.add_all(crate::log_upload::log_upload_topic_filter(&mqtt_schema)); } if capabilities.config_snapshot { diff --git a/crates/extensions/c8y_mapper_ext/src/lib.rs b/crates/extensions/c8y_mapper_ext/src/lib.rs index 83493fc484a..197ab904c8c 100644 --- a/crates/extensions/c8y_mapper_ext/src/lib.rs +++ b/crates/extensions/c8y_mapper_ext/src/lib.rs @@ -15,7 +15,7 @@ mod tests; #[derive(Debug, serde::Deserialize)] pub struct Capabilities { - log_management: bool, + log_upload: bool, config_snapshot: bool, config_update: bool, } @@ -23,7 +23,7 @@ pub struct Capabilities { impl Default for Capabilities { fn default() -> Self { Capabilities { - log_management: true, + log_upload: true, config_snapshot: true, config_update: true, } diff --git a/crates/extensions/c8y_mapper_ext/src/log_upload.rs b/crates/extensions/c8y_mapper_ext/src/log_upload.rs index 20448348a92..d543a6d368f 100644 --- a/crates/extensions/c8y_mapper_ext/src/log_upload.rs +++ b/crates/extensions/c8y_mapper_ext/src/log_upload.rs @@ -27,6 +27,7 @@ use tedge_mqtt_ext::QoS; use tedge_mqtt_ext::TopicFilter; use tedge_utils::file::create_directory_with_defaults; use tedge_utils::file::create_file_with_defaults; +use tracing::log::warn; pub fn log_upload_topic_filter(mqtt_schema: &MqttSchema) -> TopicFilter { [ @@ -43,8 +44,10 @@ impl CumulocityConverter { &self, smartrest: &str, ) -> Result, CumulocityMapperError> { - if !self.config.capabilities.log_management { - // Log_management is disabled + if !self.config.capabilities.log_upload { + warn!( + "Received a c8y_LogfileRequest operation, however, log_upload feature is disabled" + ); return Ok(vec![]); } @@ -93,8 +96,8 @@ impl CumulocityConverter { cmd_id: &str, message: &Message, ) -> Result, ConversionError> { - if !self.config.capabilities.log_management { - // Log_management is disabled + if !self.config.capabilities.log_upload { + warn!("Received a log_upload command, however, log_upload feature is disabled"); return Ok(vec![]); } @@ -175,8 +178,8 @@ impl CumulocityConverter { topic_id: &EntityTopicId, message: &Message, ) -> Result, ConversionError> { - if !self.config.capabilities.log_management { - // Log_management is disabled + if !self.config.capabilities.log_upload { + warn!("Received log_upload metadata, however, log_upload feature is disabled"); return Ok(vec![]); } diff --git a/docs/src/references/mqtt-api.md b/docs/src/references/mqtt-api.md index 89bda187360..335232481e3 100644 --- a/docs/src/references/mqtt-api.md +++ b/docs/src/references/mqtt-api.md @@ -553,14 +553,15 @@ Where the command segments are describe as follows: The following table details some example command types which are supported by thin-edge. -|Command Type|Example Topic| -|------|---| -|software_list|`te//cmd/software_list/`| -|software_update|`te//cmd/software_update/`| -|config_snapshot|`te//cmd/config_snapshot/`| -|config_update|`te//cmd/config_update/`| -|firmware_update|`te//cmd/firmware_update/`| -|restart|`te//cmd/restart/`| +| Command Type | Example Topic | +|-----------------|------------------------------------------------| +| software_list | `te//cmd/software_list/` | +| software_update | `te//cmd/software_update/` | +| config_snapshot | `te//cmd/config_snapshot/` | +| config_update | `te//cmd/config_update/` | +| firmware_update | `te//cmd/firmware_update/` | +| restart | `te//cmd/restart/` | +| log_upload | `te//cmd/log_upload/` | The command would be interpreted differently based on the target entity. For example, the `restart` could mean either a device restart or a service restart based on the target entity. diff --git a/tests/RobotFramework/tests/cumulocity/log/log_operation_child.robot b/tests/RobotFramework/tests/cumulocity/log/log_operation_child.robot index 06c467d7be4..f3a497e8b20 100644 --- a/tests/RobotFramework/tests/cumulocity/log/log_operation_child.robot +++ b/tests/RobotFramework/tests/cumulocity/log/log_operation_child.robot @@ -49,7 +49,7 @@ Custom Setup ${parent_ip}= Get IP Address Set Suite Variable $PARENT_IP ${parent_ip} - Execute Command sudo tedge config set c8y.enable.log_management true + Execute Command sudo tedge config set c8y.enable.log_upload true Execute Command sudo tedge config set mqtt.external.bind.address ${PARENT_IP} Execute Command sudo tedge config set mqtt.external.bind.port 1883 diff --git a/tests/RobotFramework/tests/cumulocity/restart/restart_device_child.robot b/tests/RobotFramework/tests/cumulocity/restart/restart_device_child.robot index 33e507f4bad..869382ee7da 100644 --- a/tests/RobotFramework/tests/cumulocity/restart/restart_device_child.robot +++ b/tests/RobotFramework/tests/cumulocity/restart/restart_device_child.robot @@ -92,7 +92,7 @@ Custom Setup ${parent_ip}= Get IP Address Set Suite Variable $PARENT_IP ${parent_ip} - Execute Command sudo tedge config set c8y.enable.log_management true + Execute Command sudo tedge config set c8y.enable.log_upload true Execute Command sudo tedge config set mqtt.external.bind.address ${PARENT_IP} Execute Command sudo tedge config set mqtt.external.bind.port 1883