diff --git a/tests/integration-tests/tests/basic/log_rotation_utils.py b/tests/integration-tests/tests/basic/log_rotation_utils.py index 17d3b9e4af..77ed675a19 100644 --- a/tests/integration-tests/tests/basic/log_rotation_utils.py +++ b/tests/integration-tests/tests/basic/log_rotation_utils.py @@ -179,9 +179,11 @@ def _test_logs_uploaded_to_cloudwatch( # write a log message to log file after log rotation in case log is empty for log in logs: if log.get("existence"): + log_path = log.get('log_path') + log_file_user = remote_command_executor.get_user_to_operate_on_file(log_path) _run_command_on_node( remote_command_executor, - f"echo '{after_log_rotation_message}' | sudo tee --append {log.get('log_path')}", + f"echo '{after_log_rotation_message}' | sudo -u {log_file_user} tee --append {log_path}", compute_private_ip, ) # assert both logs are in the cloudwatch logs