-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Enable string interpolation for hash-type parameters #4385
Comments
I was checking about this issue Ideally we would need |
For this there can be different ways in which this can be done
For now i will work on the 2nd approach |
@Athishpranav2003 Thanks! I'm seeing this.
I see. <source>
@type sample
tag test
sample "{\"k1\":\"v1\",\"k2\":\"#{ENV['FOO']}\"}"
</source>
<match test>
@type stdout
</match> $ FOO=foo bundle exec fluentd -c test.conf
...
2024-08-06 16:32:53.054415966 +0900 test: {"k1":"v1","k2":"foo"}
... I think the issue is whether this could be made easier, am I right? |
Yah @daipom |
Thanks! I see! |
We need to consider this as an issue of Embedded Ruby Code.
fluentd/lib/fluent/config/literal_parser.rb Lines 183 to 199 in e763c07
fluentd/lib/fluent/config/literal_parser.rb Lines 108 to 110 in e763c07
Since it is for It may be possible to address this as a |
Also @daipom I tried looking |
The logic of The reason is unclear, but it seems that it only cares whether the string is JSON or not (regardless of the parameter type). <source>
@type sample
tag test
sample {
"k1":"v1",
"k2":"v2"
}
</source>
<match test>
@type stdout
</match> |
Is your feature request related to a problem? Please describe.
The FAQ mentions that you can use string interpolation to configure parameters using environment variables, e.g.
some_field "#{ENV['FOO_HOME']}"
, but this doesn't seem to apply to keys or values inhash
-type parameters.Describe the solution you'd like
It would be nice if string values (or keys for that matter) in
hash
parameters could also get interpolated in the waystring
parameters already do. For example let's say I want to use an HTTP output with an authorization header that includes a token passed in through the environment:Describe alternatives you've considered
For my particular example, a first-class feature to support bearer tokens in the HTTP output plugin (#3587) would likely solve my immediate problem, but also implementing more general-purpose string interpolation for hash parameters would remove the need for updates to that output plugin
Additional context
No response
The text was updated successfully, but these errors were encountered: