mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
fix(ecs): send container logs to the task's account (#4833)
The awslogs streamer was attached without an account. The lines are forwarded from Docker's log threads, which have no request context, so putLogEvents resolved the default account. In any other account the log group and stream had been created in the caller's account, and every line was dropped. Attach with the account of the task's ARN, as Lambda, EKS, MSK and RDS already pass theirs.
This commit is contained in:
1 parent
2316b2fc28
commit
955264cf5d
4 files changed
+35
-13
No files matched your search
+4
-1
@@ -513,9 +513,12 @@ public class EcsContainerManager {
|
||||
if (!awsFirelens) {
|
||||
String logPrefix = "ecs:" + taskDef.getFamily() + ":" + def.getName();
|
||||
AwsLogsDestination awsLogs = awsLogsDestination(def, taskId, dockerId, region);
|
||||
// The lines are forwarded from Docker's log threads, which have no request context,
|
||||
// so name the task's account explicitly, as the other container-backed services do.
|
||||
Closeable logHandle = awsLogs == null
|
||||
? logStreamer.attachConsoleOnly(dockerId, logPrefix)
|
||||
: logStreamer.attach(
|
||||
: logStreamer.attachForAccount(
|
||||
AwsArnUtils.accountOrDefault(task.getTaskArn(), regionResolver.getAccountId()),
|
||||
dockerId, awsLogs.group(), awsLogs.stream(), awsLogs.region(), logPrefix);
|
||||
if (logHandle != null) {
|
||||
logStreamsByContainerId.put(dockerId, logHandle);
|
||||
|
||||
Reference in new issue
Block a user