Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create a fluentdconfig with an environment variable replacement #315

Open
allenmun197 opened this issue Apr 14, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@allenmun197
Copy link

allenmun197 commented Apr 14, 2022

Describe the bug

This bug seems to come from the reloader as creating a fluentdconfig with an env var replacement like "#{ENV['HEC_ENDPOINT']}"

When deploying a fluentdconfig like

apiVersion: logs.vdp.vmware.com/v1beta1
kind: FluentdConfig
metadata:
  name: fluentd-config
spec:
  fluentconf: |-
    <match **>
        @type splunk_hec
        format json
        hec_host "#{ENV['HEC_ENDPOINT']}"
        hec_port 8089
        hec_token <hec_token>
        index some_index
        sourcetype app_log
        reconnect_on_error true
        reload_on_failure true
        reload_connections false
      <buffer>
        @type file
        path /var/log/buffer/
        flush_thread_count 8
        flush_mode interval
        flush_interval 10s
        chunk_limit_size 16MB
        retry_wait 5
        retry_max_times 10
        retry_forever false
        retry_timeout 2h
        retry_exponential_backoff_base 2
      </buffer>
    </match>

It will error out the validator in the reloader. Seeing this in our logs.

time="2022-04-14T14:55:33Z" level=debug msg="Checked config for namespace default with fluentd and got: 2022-04-14 14:55:33 +0000 [error]: config error file=\"/tmp/validate-ext-default4277819843\" error_class=Fluent::ConfigError error=\"One of `hec_host` or `full_url` is required.\""
time="2022-04-14T14:55:33Z" level=error msg="error running validation command: exit status 2"
time="2022-04-14T14:55:33Z" level=info msg="Configuration for namespace default cannot be validated with fluentd validator"

This did not seem to be a problem with v1.14.1 of the kube-fluentd-operator. Currently we are using v1.16.3.

Reproduction steps

1.  Install kube-fluentd-operator from the in repository helm-chart
2.  Apply the given manifest

apiVersion: logs.vdp.vmware.com/v1beta1
kind: FluentdConfig
metadata:
  name: fluentd-config
spec:
  fluentconf: |-
    <match **>
        @type splunk_hec
        format json
        hec_host "#{ENV['HEC_ENDPOINT']}"
        hec_port 8089
        hec_token <hec_token>
        index some_index
        sourcetype app_log
        reconnect_on_error true
        reload_on_failure true
        reload_connections false
      <buffer>
        @type file
        path /var/log/buffer/
        flush_thread_count 8
        flush_mode interval
        flush_interval 10s
        chunk_limit_size 16MB
        retry_wait 5
        retry_max_times 10
        retry_forever false
        retry_timeout 2h
        retry_exponential_backoff_base 2
      </buffer>
    </match>
  1. Check the logs on any log-router pod in the reloader container


### Expected behavior

The reloader should be able to accept this valid fluentd config syntax and reload the config.

### Additional context

_No response_
@allenmun197 allenmun197 added the bug Something isn't working label Apr 14, 2022
@cneepa
Copy link

cneepa commented Sep 27, 2022

Hi, we are facing the same issue after upgrading from 1.15.1 to 1.16.7.
What will be the version which might have introduced the bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants