I'm trying add an option "awslogs-multiline-pattern" to ecs task definition on ecs module in terraform. And looks like that terraform just dont see this option. Any terraform ecs module examples does not contain this option as well.
This is my terraform:
module "ecs_service" {
...
# Container definition(s)
container_definitions = {
"backend-${terraform.workspace}" = {
....
logConfiguration = {
logDriver = "awslogs"
options = {
"awslogs-group" = "/ecs/backend-${terraform.workspace}"
"awslogs-region" = "${local.region}"
"awslogs-stream-prefix" = "ecs"
# Match lines starting with "[MM/DD/YYYY HH:MM:SS]"
"awslogs-multiline-pattern" = "^\\[[0-1][0-9]/[0-3][0-9]/[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9]\\]"
}
}
....
}
}
is it possible to define "awslogs-multiline-pattern"?
The ECS module has a submodule for the container definition. In that submodule's variables, there is a variable called log_configuration
(not logConfiguration
). The module does not control the logging options available, because the only thing it does is merge the log configuration you provide it with some default settings if enable_cloudwatch_logging
is used:
log_configuration = merge(
{ for k, v in {
logDriver = "awslogs",
options = {
awslogs-region = data.aws_region.current.name,
awslogs-group = try(aws_cloudwatch_log_group.this[0].name, ""),
awslogs-stream-prefix = "ecs"
},
} : k => v if var.enable_cloudwatch_logging },
var.log_configuration
)
In other words, any options that are valid for logging can be defined in the log_configuration
variable when calling the module.