No commit activity in last 3 years
No release in over 3 years
This plugin provides directives for loop extraction
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

>= 0
~> 3.1

Runtime

>= 0.14.0
 Project Readme

fluent-plugin-config-expander

This is a plugin for Fluentd.

Requirements

fluent-plugin-config-expander fluentd ruby
>= 1.0.0 >= v0.14.0 >= 2.1
< 1.0.0 < v0.14.0 >= 1.9

ConfigExpanderInput, ConfigExpanderOutput

ConfigExpanderInput, ConfigExpanderFilter and ConfigExpanderOutput plugins provide simple configuration template to write items repeatedly. In <config> section, you can write actual configuration for actual input/filter/output plugin, with special directives for loop controls.

And also supports built-in placeholders below:

  • hostname (ex: __HOSTNAME__, __hostname__, ${hostname}, ${HOSTNAME})

Configuration

For all of input, filter and output (for <source>, <filter> and <match>), you can use 'config_expander' and its 'for' directive like below:

<match example.**>
  @type config_expander
  <config>
    @type forward
    flush_interval 30s
    <for x in 01 02 03>
      <server>
        host worker__x__.local
        port 24224
      </server>
    </for>
  </config>
</match>

Configuration above is equal to below:

<match example.**>
  @type forward
  flush_interval 30s
  <server>
    host worker01.local
    port 24224
  </server>
  <server>
    host worker02.local
    port 24224
  </server>
  <server>
    host worker03.local
    port 24224
  </server>
</match>

As placeholder, you can use '${varname}' style:

<match example.**>
  @type config_expander
  <config>
    @type forward
    flush_interval 30s
    <for node in 01 02 03>
      <server>
        host worker${node}.local
        port 24224
      </server>
    </for>
  </config>
</match>

Nested 'for' directive is valid:

<match example.**>
  @type config_expander
  <config>
    @type forward
    flush_interval 30s
    <for x in 01 02 03>
      <for p in 24221 24222 24223 24224
        <server>
          host worker__x__.local
          port __p__
        </server>
      </for>
    </for>
  </config>
</match>

Set hostname into tag in 'tail' input plugin:

<source>
  @type config_expander
  <config>
    @type tail
    @label @access_events
    format /..../
    path /var/log/access.log
    tag access.log.${hostname}
  </config>
</source>

TODO

  • more tests
  • patches welcome!

Copyright

  • Copyright (c) 2012- TAGOMORI Satoshi (tagomoris)
  • License
    • Apache License, Version 2.0