Skip to content

Commit

Permalink
Use the Docker log driver for syslog
Browse files Browse the repository at this point in the history
* When a syslog endpoint is provided, it currently launches a logspout
  container to gather and send the logs
* This instead adds the syslog-address, using the syslog driver. If both
  cloudfront logs is set to true, and a syslog endpoint is specified,
  syslog will take precedence (As only 1 can be specified)
* If this works as expected, we can remove logspout
  • Loading branch information
Stretch96 committed Sep 5, 2024
1 parent e17d364 commit 71113ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions container-definitions/app.json.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
{
"image": "${image}",
"name": "${container_name}",
%{ if syslog_address != "" }
"logConfiguration": {
"logDriver": "syslog",
"options": {
"syslog-address": "${syslog_address}"
}
},
${else}
%{ if cloudwatch_log_group != "" }
"logConfiguration": {
"logDriver": "awslogs",
Expand All @@ -18,6 +26,7 @@
"logDriver": "json-file"
},
%{ endif }
%{ endif }
%{ if volumes != "[]" }
"mountPoints": ${volumes},
%{ endif }
Expand Down
1 change: 1 addition & 0 deletions ecs-cluster-infrastructure-service.tf
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ resource "aws_ecs_task_definition" "infrastructure_ecs_cluster_service" {
linux_parameters = each.value["enable_execute_command"] == true ? jsonencode({
initProcessEnabled = true
}) : "{}"
syslog_address = local.infrastructure_ecs_cluster_syslog_endpoint
cloudwatch_log_group = each.value["enable_cloudwatch_logs"] == true ? aws_cloudwatch_log_group.infrastructure_ecs_cluster_service[each.key].name : ""
awslogs_stream_prefix = ""
region = local.aws_region
Expand Down

0 comments on commit 71113ee

Please sign in to comment.