Google fluentd - ใช้ตัวแปร env ในป้ายกำกับ

ฉันกำลังพยายามเพิ่มป้ายกำกับในไฟล์ปรับแต่งของ google-fluentd ตามเอกสาร https://cloud.google.com/logging/docs/agent/configuration#label-setup ระบุว่า labels ใช้สำหรับป้ายกำกับแบบคงที่ แต่มีวิธีใดบ้างที่ฉันสามารถเพิ่มตัวแปรสภาพแวดล้อมเป็นค่าให้กับป้ายกำกับเหล่านี้ได้

...
<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
...

ในข้อมูลโค้ดด้านบนนี้อ้างถึงไฟล์ /etc/google-fluentd/google-fluentd.conf หลัก ป้ายกำกับคงที่ source: transform จะถูกเพิ่มลงในบันทึก แต่ transformId ที่ได้รับค่าจาก env variable ไม่ทำงาน


person RSY    schedule 17.09.2020    source แหล่งที่มา


คำตอบ (1)


ฉันใช้งานได้โดยใช้: labels "#{ENV['LABEL_JSON']}"

จากนั้นส่งผ่านตัวแปร env - คู่ค่าคีย์เช่น "LABEL_JSON": "{\"TRANSFORM_ID\": \"transformId\", \"TRANSFORM_NAME\": \"jane\"}"

person RSY    schedule 17.09.2020