[英]Can I use a dot in a config file of Fluentd using DSL?
guys. 伙计们 I'm been using Fluentd on my Rails app, and I want to write the config file of Fluentd using DSL.
我一直在我的Rails应用程序上使用Fluentd,并且我想使用DSL编写Fluentd的配置文件。 However, my config file doesn't work well.
但是,我的配置文件无法正常工作。 This may be caused by a dot.
这可能是由点引起的。
Here is my config file. 这是我的配置文件。
# config/fluent/fluent.rb
source {
type :forward
}
['access','debug','error'].each do|tag|
if tag == 'access'
filter("#{tag}.app.**") {
type :record_transformer
enable_ruby
record {
hoge '${hoge ? hoge : "-"}'
fuga.piyo '${fuga ? fuga : "-"}'
}
}
end
.......
And, when I execute a below command, 而且,当我执行以下命令时,
$bundle exec fluentd -c config/fluent/fluent.rb -vv
"fuga" and "piyo" fields are not correct. “ fuga”和“ piyo”字段不正确。
<source>
type forward
</source>
<filter access.app.**>
type record_transformer
enable_ruby
<record>
hoge ${hoge ? hoge : "-"}
fuga
piyo ${fuga ? fuga : "-"}
</record>
</filter>
Can you understand why?Please, help me... 你能明白为什么吗?请帮我...
Thanks. 谢谢。
Disclosure: I'm a fluentd committer and developer of config dsl. 披露:我是config dsl的熟练提交者和开发人员。
It seems a kind of bug, and cannot find any simple workaround except for self.send "fuga.piyo".to_sym, '${fuga ? fuga : "-"}'
这似乎是一种错误,除了
self.send "fuga.piyo".to_sym, '${fuga ? fuga : "-"}'
self.send "fuga.piyo".to_sym, '${fuga ? fuga : "-"}'
. self.send "fuga.piyo".to_sym, '${fuga ? fuga : "-"}'
。 I hope an issue for this on github. 我希望在github上解决这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.