fabric8io / fluent-plugin-kubernetes_metadata_filter

Enrich your fluentd events with Kubernetes metadata
Apache License 2.0
350 stars 166 forks source link

如何获取pod_name的值 #334

Closed chenxuehui1 closed 2 years ago

chenxuehui1 commented 2 years ago

在fluentd里用这个插件,怎么才能获取到pod_name的值呢?请详细说明下

jcantrill commented 2 years ago

image

jcantrill commented 2 years ago

The podname is part of the log file path for a container and is added to the log record:

{
  "kubernetes": {
     "podname": "foo"
  }
}

or similar.

chenxuehui1 commented 2 years ago

用你们的插件怎么获取pod日志对应的pod_name值,在fluent-config.yaml里怎么配置就可以获取到pod_name,并且我要把这个pod_name的值添加到s3路径里

chenxuehui1 commented 2 years ago

用你们的插件,获取到的json部分内容如下: { "log": "2015/05/05 19:54:41 \n", "stream": "stderr", "docker": { "id": "df14e0d5ae4c07284fa636d739c8fc2e6b52bc344658de7d3f08c36a2e804115", } "kubernetes": { "host": "jimmi-redhat.localnet", "pod_name":"fabric8-console-controller-98rqc", "pod_id": "c76927af-f563-11e4-b32d-54ee7527188d", "container_name": "fabric8-console-container", "namespace_name": "default", "namespace_id": "23437884-8e08-4d95-850b-e94378c9b2fd", "labels": { "component": "fabric8Console" } } } 在fluent-config.yaml我该怎么配置来获取上面json里的pod_name值呢?

chenxuehui1 commented 2 years ago

image

我的配置如上面图片里的那样,但是没获取到pod_name的值

jcantrill commented 2 years ago

This plugin provides the information and it is up to you to understand how to manipulate fluent configuration to transform the messages as you require. This is not the appropriate forum for learning about fluentd or ruby. Please reach out to the fluent community