Last active
December 22, 2015 17:19
-
-
Save fukata/6504937 to your computer and use it in GitHub Desktop.
fluentd DSL config. I want to extract number from hostname.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source { | |
type "forward" | |
port 24224 | |
} | |
match('test.**') { | |
type "forward" | |
num = ::Kernel.open("|hostname"){|o| o.read.chop}.gsub('hoge','').to_i / 20 + 1 # host01 => 1 | |
(num..num+1).each do |n| | |
server { | |
host "proxy%02d" % n | |
port 24224 | |
} | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment