不同命名空间的单独索引 fluentD
separate index for different namespace fluentD
<match pod.logs.kubernetes.**>
@type elasticsearch
index_name {{.Values.fluentdelasticsearch.indexName}}
host {{.Values.fluentdelasticsearch.host}}
port 443
scheme https
type_name doc
time_key_format "%Y-%m-%dT%H:%M:%S.%N%z"
time_key time
include_timestamp true
reconnect_on_error true
reload_connections true
reload_on_failure true
resurrect_after 5
<buffer>
flush_interval 5
chunk_limit_size 2m
queued_chunks_limit_size 32
retry_forever true
</buffer>
@log_level debug
</match>
我在集群级别部署了 fluentD,集群中有两个命名空间 dev 和 test。 pods 的当前日志是在同一个索引中生成的,我需要为命名空间设置单独的索引。
<filter pod.logs.kubernetes.**>
@type kubernetes_metadata
</filter>
<match pod.logs.kubernetes.**>
@type elasticsearch_dynamic
index_name ${record['kubernetes']['namespace_name']}-index
.....
......
</match>
<match pod.logs.kubernetes.**>
@type elasticsearch
index_name {{.Values.fluentdelasticsearch.indexName}}
host {{.Values.fluentdelasticsearch.host}}
port 443
scheme https
type_name doc
time_key_format "%Y-%m-%dT%H:%M:%S.%N%z"
time_key time
include_timestamp true
reconnect_on_error true
reload_connections true
reload_on_failure true
resurrect_after 5
<buffer>
flush_interval 5
chunk_limit_size 2m
queued_chunks_limit_size 32
retry_forever true
</buffer>
@log_level debug
</match>
我在集群级别部署了 fluentD,集群中有两个命名空间 dev 和 test。 pods 的当前日志是在同一个索引中生成的,我需要为命名空间设置单独的索引。
<filter pod.logs.kubernetes.**>
@type kubernetes_metadata
</filter>
<match pod.logs.kubernetes.**>
@type elasticsearch_dynamic
index_name ${record['kubernetes']['namespace_name']}-index
.....
......
</match>