vincbeck commented on code in PR #43724:
URL: https://github.com/apache/airflow/pull/43724#discussion_r1831126262


##########
providers/src/airflow/providers/amazon/aws/operators/ecs.py:
##########
@@ -661,7 +661,9 @@ def _aws_logs_enabled(self):
         return self.awslogs_group and self.awslogs_stream_prefix
 
     def _get_logs_stream_name(self) -> str:
-        return 
f"{self.awslogs_stream_prefix}/{self.container_name}/{self._get_ecs_task_id(self.arn)}"
+        if self.awslogs_stream_prefix and self.container_name and not 
self.awslogs_stream_prefix.endswith(self.container_name):
+                return 
f"{self.awslogs_stream_prefix}/{self.container_name}/{self._get_ecs_task_id(self.arn)}"

Review Comment:
   `endswith` is too specific, I think we should check whether the container 
name is contained in the prefix
   
   ```suggestion
           if self.awslogs_stream_prefix and self.container_name and 
self.container_name not in self.awslogs_stream_prefix:
               return 
f"{self.awslogs_stream_prefix}/{self.container_name}/{self._get_ecs_task_id(self.arn)}"
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to