thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
221 stars 54 forks source link

Upload logs automatically after a command has been completed #2761

Closed reubenmiller closed 5 months ago

reubenmiller commented 7 months ago

Is your feature request related to a problem? Please describe.

It is difficult and slow to debug an command (operation) which failed, as it is difficult for the user to retrieve the related log file to an command instance as there are generally many different log commands, and finding the correct log file to the latest operation is non-trivial.

Describe the solution you'd like

An option to enable the automatic uploading of a command's associated log file when a command finishes (e.g. the status is set to failed). The file should be uploaded to the cloud where the operation was created from.

It might make sense to have this setting configurable to support the following settings:

Describe alternatives you've considered

Additional context

albinsuresh commented 5 months ago

Test Plan

The feature has been implemented as described, where the workflow log file of the operation is automatically uploaded on completion of the operations, if configured to do so. But the log upload is currently limited to software update operations only.

Auto log upload is disabled by default, which can be enabled by using the config setting : c8y.operations.auto_log_upload which supports values on-failure, always and never(default option).

E.g: tedge config set c8y.operations.auto_log_upload always

Three tests have been added to software.robot test to test the effect of all the config variants.

gligorisaev commented 5 months ago

QA has thoroughly checked the feature and here are the results: