I'm using AWS Batch to launch multiple container jobs for some larger process. By default it will create a LogGroup and LogStream for each of these jobs. This makes debugging much more difficult when I want to go through each of these jobs.
Instead I want to structure them so all my LogStreams appear under one LogGroup, such as,
MyProcess/ # LogGroupName
-> process1/ # LogStream Names
-> process2/
...
-> processN/
This is easy enough to achieve by setting up the logConfiguration in my TaskDefinition, as:
"logConfiguration" => Dict(
"logDriver" => "awslogs",
"options" => Dict(
"awslogs-group" => log_group_name,
),
),
This half-solves my problem. However, the LogStreams inside this LogGroup all will have names as, logGroupName/Container-Name/ECS-Task-Id. I'm looking for a way to override this logStreamName so that I can provide it with something more meaningful.
It seems like the only way to do this is by creating a new TaskDefinition for each of these jobs which I would want to do and providing each definition with,
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": shared_log_group_name,
"awslogs-stream-prefix": meaningful_log_stream_prefix
}
}
This is not ideal, as I do not want to end up with thousands of slightly-varied TaskDefinitions. I also do not want to use MNP (multi-node-processing) jobs here for a variety of reasons which would solve this issue.
Is there a way to override the logStreamPrefix, or logConfiguration in general? According to the AWS documentation this does not seem possible, but maybe I am missing something?