Can I use a dot in a config file of Fluentd using DSL?

329 views Asked by At

guys. I'm been using Fluentd on my Rails app, and I want to write the config file of Fluentd using DSL. 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.

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

1

There are 1 answers

2
Satoshi Tagomori On

Disclosure: I'm a fluentd committer and developer of config dsl.

It seems a kind of bug, and cannot find any simple workaround except for self.send "fuga.piyo".to_sym, '${fuga ? fuga : "-"}'. I hope an issue for this on github.