Skip to content

Instantly share code, notes, and snippets.

@okkez
Created June 19, 2018 03:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save okkez/1ac4b1f322275e72982803856f4737a7 to your computer and use it in GitHub Desktop.
Save okkez/1ac4b1f322275e72982803856f4737a7 to your computer and use it in GitHub Desktop.
Run fluent-plugin-config-format for all built-in plugins
require_relative "./lib/fluent/test/helpers"
require_relative "./lib/fluent/command/plugin_config_formatter"
Dir.glob("./lib/fluent/plugin/*.rb").each do |entry|
require_relative entry
end
require_relative "./lib/fluent/load"
include Fluent::Test::Helpers
hash = {}
Fluent::Plugin::INPUT_REGISTRY.map.keys.each do |name|
hash["input #{name}"] = ["--format=json", "input", name]
end
Fluent::Plugin::OUTPUT_REGISTRY.map.keys.each do |name|
hash["output #{name}"] = ["--format=json", "output", name]
end
Fluent::Plugin::FILTER_REGISTRY.map.keys.each do |name|
hash["filter #{name}"] = ["--format=json", "filter", name]
end
Fluent::Plugin::BUFFER_REGISTRY.map.keys.each do |name|
hash["buffer #{name}"] = ["--format=json", "buffer", name]
end
Fluent::Plugin::STORAGE_REGISTRY.map.keys.each do |name|
hash["storage #{name}"] = ["--format=json", "storage", name]
end
Fluent::Plugin::PARSER_REGISTRY.map.keys.each do |name|
hash["parser #{name}"] = ["--format=json", "parser", name]
end
Fluent::Plugin::FORMATTER_REGISTRY.map.keys.each do |name|
hash["formatter #{name}"] = ["--format=json", "formatter", name]
end
hash.each do |key, argv|
next if [:tcp, :unix].include?(argv.last) # skip obsolete out_tcp, out_unix
begin
capture_stdout do
$log = $stdout
FluentPluginConfigFormatter.new(argv).call
end
rescue => ex
p [argv, ex]
#puts ex.backtrace
end
end
$ bundle exec ruby all.rb
[["input", :syslog], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["input", :http], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["input", :exec], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["output", :exec_filter], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["output", :exec], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["output", :stdout], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["output", :file], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["output", :null], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["output", :forward], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["filter", :stdout], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["buffer", :file], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["parser", :regexp], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["parser", :json], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["parser", :ltsv], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["parser", :syslog], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["parser", :apache_error], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["parser", :nginx], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["parser", :apache], #<NoMethodError: undefined method `first' for nil:NilClass>]
[["formatter", :out_file], #<NoMethodError: undefined method `first' for nil:NilClass>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment