Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Logging Google fluentd-在标签中使用环境变量_Logging_Environment Variables_Fluentd_Stackdriver - Fatal编程技术网

Logging Google fluentd-在标签中使用环境变量

Logging Google fluentd-在标签中使用环境变量,logging,environment-variables,fluentd,stackdriver,Logging,Environment Variables,Fluentd,Stackdriver,我试图在GoogleFluentd的配置文件中添加标签。根据文件规定,标签用于静态标签。但是,有没有任何方法可以将环境变量作为值添加到这些标签中 ... <match **> @type google_cloud # Adding labels to the log metadata labels { "source": "transform", "transformId": "\&qu

我试图在GoogleFluentd的配置文件中添加标签。根据文件规定,
标签
用于静态标签。但是,有没有任何方法可以将环境变量作为值添加到这些标签中

...
<match **>
  @type google_cloud
  # Adding labels to the log metadata
  labels {
    "source": "transform",
    "transformId": "\"#{ENV['TRANSFORM_ID']}\""
  }
  buffer_type file
  buffer_path /var/log/google-fluentd/buffers
...
。。。
@键入谷歌云
#向日志元数据添加标签
标签{
“源”:“转换”,
“transformId”:“\”{ENV['TRANSFORM\u ID']}”
}
缓冲区类型文件
buffer\u path/var/log/google fluentd/buffers
...

在上面的代码片段中,这里指的是main
/etc/google fluentd/google fluentd.conf
文件。静态标签
source:transform
被添加到日志中,但是从
env变量
中获取值的
transformId
不起作用。

我使用以下方法实现了此功能:
标签“#{ENV['LABEL_JSON']}”

然后传递env变量-键值对,如
“LABEL\u JSON”:“{\”TRANSFORM\u ID\”:\“TRANSFORM\u ID\”,\“TRANSFORM\u NAME\”:\“jane\”}”