vmware / fluent-plugin-vmware-log-intelligence

Fluentd output plugin that sends data to VMware Log Intelligence.
Other
8 stars 14 forks source link

How to Replace Authorization Header with Environment Variable? #25

Open RuiZhang2 opened 2 years ago

RuiZhang2 commented 2 years ago

Typically, fluentd supports environment variable replacement. However, it does not work for vmware-log-intelligence plugin. Just wondering if you have any function support which is similar to what is shown below? :

 <headers>
    ...
    Authorization Bearer #{ENV['API-Token']}"
    ...
  </headers>
4n3w commented 10 months ago

I just ran into this same issue, where my endpoint_url populates fine from an environment variable, but the token does not.

<match tmc_audit.**>
  @type vmware_log_intelligence
  endpoint_url "#{ENV['ARIA_LOG_URL']}"
  verify_ssl true
  http_compress false
  <headers>
    Content-Type application/json
    Authorization Bearer "#{ENV['ARIA_LOG_TOKEN']}"
    structure simple
  </headers>
4n3w commented 10 months ago

Actually, figured it out. It looks like it's a quirk of how the headers get parsed, this works for me:

    Authorization "Bearer #{ENV['ARIA_LOG_TOKEN']}"