Description
Send EKS control plane logs to CloudWatch Logs to record cluster administration and authentication.
Potential impact
Application logs alone can leave you unable to trace an administrator’s change or diagnose a sign-in failure.
Remediation
Set enabled_cluster_log_types to include api, audit, authenticator, controllerManager and scheduler. Check the streams in CloudWatch, then set retention and reader permissions.
Examples
To deploy the excerpts, define var.cluster_name, the cluster IAM role, VPC configuration and aws_cloudwatch_log_group.example. Name the log group /aws/eks/<cluster>/cluster.
Before
hcl
resource "aws_eks_cluster" "example" {
depends_on = [aws_cloudwatch_log_group.example]
name = var.cluster_name
}
After
hcl
resource "aws_eks_cluster" "example" {
depends_on = [aws_cloudwatch_log_group.example]
enabled_cluster_log_types = ["api", "audit", "authenticator", "controllerManager", "scheduler"]
name = var.cluster_name
}