-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace Fluentbit with ADOT Container Logs Collector #261
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# AWS Distro for OpenTelemetry (ADOT) Container Logs Collector | ||
|
||
[AWS Distro for OpenTelemetry (ADOT)](https://aws-otel.github.io/) is a secure, | ||
production-ready, AWS-supported distribution of the OpenTelemetry project. | ||
Part of the Cloud Native Computing Foundation, OpenTelemetry provides open | ||
source APIs, libraries, and agents to collect distributed traces and metrics | ||
for application monitoring. | ||
|
||
This module generates the | ||
[ADOT Container Logs Collector](https://aws-otel.github.io/docs/getting-started/adot-eks-add-on/config-container-logs) configuration for Amazon EKS ADOT add-on. | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.1.0 | | ||
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.72 | | ||
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.10 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.72 | | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| <a name="module_adot_logs_iam_role"></a> [adot\_logs\_iam\_role](#module\_adot\_logs\_iam\_role) | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | 5.33.0 | | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [aws_cloudwatch_log_group.adot_log_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource | | ||
| [aws_iam_policy.adot_logs_iam_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | | ||
| [aws_iam_policy_document.adot_logs_iam_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_addon_config"></a> [addon\_config](#input\_addon\_config) | ADOT Container Logs Collector config | <pre>object({<br> enable_logs = bool<br> logs_config = object({<br> cw_log_retention_days = number<br> })<br> })</pre> | <pre>{<br> "enable_logs": true,<br> "logs_config": {<br> "cw_log_retention_days": 90<br> }<br>}</pre> | no | | ||
| <a name="input_addon_context"></a> [addon\_context](#input\_addon\_context) | Input configuration for the addon | <pre>object({<br> aws_caller_identity_account_id = string<br> aws_caller_identity_arn = string<br> aws_eks_cluster_endpoint = string<br> aws_partition_id = string<br> aws_region_name = string<br> eks_cluster_id = string<br> eks_oidc_issuer_url = string<br> eks_oidc_provider_arn = string<br> irsa_iam_role_path = string<br> irsa_iam_permissions_boundary = string<br> tags = map(string)<br> })</pre> | n/a | yes | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_adot_logs_collector_config"></a> [adot\_logs\_collector\_config](#output\_adot\_logs\_collector\_config) | ADOT Container Logs Collector configuration | | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
data "aws_iam_policy_document" "adot_logs_iam_policy" { | ||
statement { | ||
sid = "PutLogEvents" | ||
effect = "Allow" | ||
resources = ["arn:${var.addon_context.aws_partition_id}:logs:${var.addon_context.aws_region_name}:${var.addon_context.aws_caller_identity_account_id}:log-group:/aws/eks/observability-accelerator/${var.addon_context.eks_cluster_id}/workloads:log-stream:*"] | ||
actions = ["logs:PutLogEvents"] | ||
} | ||
|
||
statement { | ||
sid = "DescribeLogGroups" | ||
effect = "Allow" | ||
resources = ["*"] | ||
|
||
actions = [ | ||
"logs:DescribeLogGroups", | ||
] | ||
} | ||
|
||
statement { | ||
sid = "LogStreams" | ||
effect = "Allow" | ||
resources = [ | ||
"arn:${var.addon_context.aws_partition_id}:logs:${var.addon_context.aws_region_name}:${var.addon_context.aws_caller_identity_account_id}:log-group:/aws/eks/observability-accelerator/${var.addon_context.eks_cluster_id}/workloads", | ||
"arn:${var.addon_context.aws_partition_id}:logs:${var.addon_context.aws_region_name}:${var.addon_context.aws_caller_identity_account_id}:log-group:/aws/eks/observability-accelerator/${var.addon_context.eks_cluster_id}/workloads:log-stream:*" | ||
] | ||
|
||
actions = [ | ||
"logs:CreateLogStream", | ||
"logs:DescribeLogStreams", | ||
] | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
resource "aws_cloudwatch_log_group" "adot_log_group" { | ||
count = var.addon_config.enable_logs ? 1 : 0 | ||
|
||
name = "/aws/eks/observability-accelerator/${var.addon_context.eks_cluster_id}/workloads" | ||
|
||
retention_in_days = var.addon_config.logs_config.cw_log_retention_days | ||
|
||
tags = var.addon_context.tags | ||
} | ||
|
||
resource "aws_iam_policy" "adot_logs_iam_policy" { | ||
count = var.addon_config.enable_logs ? 1 : 0 | ||
|
||
name = "${substr(var.addon_context.eks_cluster_id, 0, 30)}-${var.addon_context.aws_region_name}-adot-logs-policy" | ||
path = "/" | ||
description = "IAM Policy for ADOT Container Logs Collector" | ||
|
||
policy = data.aws_iam_policy_document.adot_logs_iam_policy.json | ||
tags = var.addon_context.tags | ||
} | ||
|
||
module "adot_logs_iam_role" { | ||
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks" | ||
version = "5.33.0" | ||
|
||
count = var.addon_config.enable_logs ? 1 : 0 | ||
|
||
role_name = "${substr(var.addon_context.eks_cluster_id, 0, 30)}-${var.addon_context.aws_region_name}-adot-logs-irsa" | ||
|
||
role_policy_arns = { | ||
policy = resource.aws_iam_policy.adot_logs_iam_policy[0].arn | ||
} | ||
|
||
oidc_providers = { | ||
main = { | ||
provider_arn = var.addon_context.eks_oidc_provider_arn | ||
namespace_service_accounts = ["opentelemetry-operator-system:adot-col-container-logs"] | ||
} | ||
} | ||
|
||
tags = var.addon_context.tags | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
output "adot_logs_collector_config" { | ||
description = "ADOT Container Logs Collector configuration" | ||
value = jsondecode(length(resource.aws_cloudwatch_log_group.adot_log_group) > 0 ? jsonencode({ | ||
resources = { | ||
limits = { | ||
cpu = "1000m" | ||
memory = "750Mi" | ||
} | ||
|
||
requests = { | ||
cpu = "300m" | ||
memory = "512Mi" | ||
} | ||
} | ||
|
||
serviceAccount = { | ||
annotations = { | ||
"eks.amazonaws.com/role-arn" = module.adot_logs_iam_role[0].iam_role_arn | ||
} | ||
} | ||
|
||
exporters = { | ||
awscloudwatchlogs = { | ||
log_group_name = "/aws/eks/observability-accelerator/$CLUSTER_NAME/workloads" | ||
log_stream_name = "$NODE_NAME" | ||
} | ||
} | ||
|
||
pipelines = { | ||
logs = { | ||
cloudwatchLogs = { | ||
enabled = true | ||
} | ||
} | ||
} | ||
}) : "{}") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
variable "addon_context" { | ||
description = "Input configuration for the addon" | ||
type = object({ | ||
aws_caller_identity_account_id = string | ||
aws_caller_identity_arn = string | ||
aws_eks_cluster_endpoint = string | ||
aws_partition_id = string | ||
aws_region_name = string | ||
eks_cluster_id = string | ||
eks_oidc_issuer_url = string | ||
eks_oidc_provider_arn = string | ||
irsa_iam_role_path = string | ||
irsa_iam_permissions_boundary = string | ||
tags = map(string) | ||
}) | ||
} | ||
|
||
variable "addon_config" { | ||
description = "ADOT Container Logs Collector config" | ||
type = object({ | ||
enable_logs = bool | ||
logs_config = object({ | ||
cw_log_retention_days = number | ||
}) | ||
}) | ||
default = { | ||
enable_logs = true | ||
logs_config = { | ||
cw_log_retention_days = 90 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
terraform { | ||
required_version = ">= 1.1.0" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 3.72" | ||
} | ||
kubernetes = { | ||
source = "hashicorp/kubernetes" | ||
version = ">= 2.10" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 0 additions & 55 deletions
55
modules/eks-monitoring/add-ons/aws-for-fluentbit/README.md
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to keep logs separated per namespace? that was one of our requests before, and it this allows different patterns per log group (subscriptions, log class ...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't been able to find an elegant way to achieve this as currently the ADOT operator addon config schema supports only $CLUSTER_NAME and $NODE_NAME configuration variables for CW logs exporter. Container Logs configurable values