I'm gonna send EKS on Fargate container logs to AWS CloudWatch Logs.
These container logs are in the same pod. And I want to send container logs to different log groups.
Now, these container logs are sent to the same log group by FireLens/Fluent Bit.
Here is the log streams in the log group.
from-fluent-bit-kube.var.log.containers.${pod_name}_${namespace}_${container_name_A}-ae7cd6e98f3d77f9819e11463370e896e76cde8c188d062020e06ad1ee736e7c.log
from-fluent-bit-kube.var.log.containers.${pod_name}_${namespace}_${container_name_B}-a57c393f0c79990dbe765e1b8bd6f665f434eef66585f2da37179e58e9e22d72.log
from-fluent-bit-kube.var.log.containers.${pod_name}_${namespace}_${container_name_C}-85e99ddd5d60482b5673ebfca3ff7f50ec90073748738e240497af2ed196e88e.log
from-fluent-bit-kube.var.log.containers.${pod_name}_${namespace}_${container_name_D}-6a1e3989e772b52591fe592603cc573beb5e58b7e18f4a7e8550ae69ac6501ed.log
(※I changed the part of log stream name to ${xxx})
(※from-fluent-bit-
is the prefix set by OUTPUT.)
To achieve this, I think OUTPUT should be like this
kind: ConfigMap
apiVersion: v1
metadata:
name: aws-logging
namespace: aws-observability
data:
output.conf: |
[OUTPUT]
Name cloudwatch_logs
Match *${namespace}_${container_name_A}*
region eu-west-1
log_group_name fluent-bit-cloudwatch-A
log_stream_prefix from-fluent-bit-
auto_create_group On
[OUTPUT]
Name cloudwatch_logs
Match *${namespace}_${container_name_B}*
region eu-west-1
log_group_name fluent-bit-cloudwatch-B
log_stream_prefix from-fluent-bit-
auto_create_group On
Is it the correct way to achieve?
If not, please give me solution.
Regards,