Use kubernetes app label in logGroupTemplate
- Dominant language
- Mustache
- Stars
- 1.3k
- Forks
- 1.1k
- Avg merge
- 22m
- Merged PRs (30d)
- 5
Description
**Describe the bug**
We always used the following terraform module: https://github.com/DNXLabs/terraform-aws-eks-cloudwatch-logs but have not switched to directly using this chart because that module is no longer maintained. That TF module would in the background use the [aws-for-fluent-bit](https://hub.helm.sh/charts/aws/aws-for-fluent-bit) chart.
The logGroup used was like this:
```
set {
name = "cloudWatch.logGroupName"
value = "/aws/eks/${var.cluster_name}/$(kubernetes['labels']['app'])"
}
```
So this resulted in `/aws/eks/staging/some_app_label`. I'd like to have the same structure with this chart directly. (And now also the latest version).
I used the following in my terraform:
```
set {
name = "cloudWatchLogs.logGroupTemplate"
value = "/aws/eks/${local.cluster_name}/$kubernetes['labels']['app']"
}
```
However this would let fluentbit really spam cloudwatch with these log messages:
```
[2023/03/21 13:43:57] [ warn] [record accessor] translation failed, root key=kubernetes
[2023/03/21 13:43:57] [ warn] [record accessor] translation failed, root key=kubernetes
```
If I use the format `/aws/eks/${local.cluster_name}/$kubernetes['namespace_name']` it works fine.
How can I get the `['labels']['app']` format to work? Is logGroupTemplate indeed correct?
**Steps to reproduce**
See above
**Expected outcome**
See above
**Environment**
* Chart name: `aws-for-fluent-bit`
* Chart version: `0.1.24`
* Kubernetes version: `1.22`
* Using EKS (yes/no), if so version? `1.22.17-eks-48e63af`
**Additional Context**:
I did found this MR: https://github.com/aws/eks-charts/pull/903 but not 100% sure if it is related to my issue or not.
Contributor guide
Research direction
Start with the aws-for-fluent-bit chart's cloudWatchLogs.logGroupTemplate configuration and compare it with the working namespace_name form and the referenced MR 903. Reproduce the app-label template on the stated chart and Kubernetes versions; done means the log group uses the app label and the record-accessor warnings stop.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, helm, kubernetes
- Domain
- cloud, infrastructure, observability-sre
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100