Repeat same match rules

59 Views Asked by At

I have following fluent.conf.

Here I have same rules for two match patterns: admin, content.

The only difference is path parameter - it contains match patterns.

<source>
  @type forward
  port 24224
  bind 0.0.0.0
</source>
<match admin>
  @type copy
   <store>
    @type file
    path /fluentd/log/admin.*.log
    time_slice_format %Y.%m.%d-%H.%M
    time_slice_wait 1m
    time_format %Y%m%dT%H%M%S%z
    compress gzip
    format json
  </store>
</match>
<match content>
  @type copy
   <store>
    @type file
    path /fluentd/log/content.*.log
    time_slice_format %Y.%m.%d-%H.%M
    time_slice_wait 1m
    time_format %Y%m%dT%H%M%S%z
    compress gzip
    format json
  </store>
</match>

I want to avoid duplication in match blocks.

My question is: Is there method to define two patterns: admin, content and make for them singe match block something like this:

<match %pattern_name%>
  @type copy
   <store>
    @type file
    path /fluentd/log/%pattern_name%.*.log
    time_slice_format %Y.%m.%d-%H.%M
    time_slice_wait 1m
    time_format %Y%m%dT%H%M%S%z
    compress gzip
    format json
  </store>
</match>
0

There are 0 best solutions below