如何在标签上使用环境变量
How do I make use of environment variables on tags
如何在标签中使用环境变量
tag raw.kubernetes.*."#{ENV['ENVIRONMENT']}"."#{ENV['REGION']}"
<source>
@id fluentd-containers.log
@type tail
path /var/log/containers/*.log
pos_file /var/log/es-containers.log.pos
tag raw.kubernetes.*."#{ENV['ENVIRONMENT']}"."#{ENV['REGION']}"
标签在 elasticsearch 中显示为
kubernetes.var.log.containers.aoo-web-qa3-b5b47b6d5-w76c2_default_app-web-fd68c32c550064d866ec2e514fe153e2bdda5a0849dbc10ecedc2c6ff30bc549.log."#{ENV['ENVIRONMENT']}"."#{ENV['REGION']}"
如前所述,您需要将引号移到标记值之外,以确保选择了环境变量。示例 -
tag "raw.kubernetes.*.#{ENV['ENVIRONMENT']}.#{ENV['REGION']}"
如何在标签中使用环境变量
tag raw.kubernetes.*."#{ENV['ENVIRONMENT']}"."#{ENV['REGION']}"
<source>
@id fluentd-containers.log
@type tail
path /var/log/containers/*.log
pos_file /var/log/es-containers.log.pos
tag raw.kubernetes.*."#{ENV['ENVIRONMENT']}"."#{ENV['REGION']}"
标签在 elasticsearch 中显示为
kubernetes.var.log.containers.aoo-web-qa3-b5b47b6d5-w76c2_default_app-web-fd68c32c550064d866ec2e514fe153e2bdda5a0849dbc10ecedc2c6ff30bc549.log."#{ENV['ENVIRONMENT']}"."#{ENV['REGION']}"
如前所述,您需要将引号移到标记值之外,以确保选择了环境变量。示例 -
tag "raw.kubernetes.*.#{ENV['ENVIRONMENT']}.#{ENV['REGION']}"