Needed help to restructure fluentd logs #4509
Tamannaverma1912
started this conversation in
General
Replies: 1 comment 1 reply
-
You can't remove keys by You can use fomatter plugins to manage the output format. Example:
I could not find a formatter that has the feature of excluding certain keys. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all, so I have my config map like this
`apiVersion: v1
kind: ConfigMap
metadata:
name: fluentd-config
namespace: runai-team-b
labels:
log-app: fluentd
data:
fluent.conf: |
log_level debug
In this I am using record_transformer to fetch namespace_name, pod_name & container_name from the tag itself as we want to have /sensei-fs/fluentd-tam/test10/${namespace_name}/${pod_name}/${container_name}/%Y-%m-%d-%H-%M-%S/output.log file structure but another requirement that we have is we would also want to remove the metadata from logs too.
Here's an example so I am getting my logs currently like but I want to remove tag, namespace_name, pod_name & container_name from it.
{"stream":"stdout","logtag":"F","log":"level=info ts=2024-05-27T06:59:08.362480623Z caller=reloader.go:237 msg=\"started watching config file and directories for changes\" cfg=/var/lib/grafana-agent/config-in/agent.yml out=/var/lib/grafana-agent/config/agent.yml dirs=","tag":"kube.var.log.containers.loki-logs-57t7z_runai-test-project_config-reloader-0582794d56ac98cdaab2335ee04730becc6b20efacbf40e94ba5f0d9b936eb9f.log","namespace_name":"runai-test-project","pod_name":"loki-logs-57t7z","container_name":"config-reloader-0582794d56ac98cdaab2335ee04730becc6b20efacbf40e94ba5f0d9b936eb9f.log"}
So I tried using remove_keys tag,namespace_name,pod_name,container_name It didn't work. Can anyone help what can we do in here?
Beta Was this translation helpful? Give feedback.
All reactions