Class: Fluent::ScriptFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/fluent/plugin/filter_script.rb

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



7
8
9
10
# File 'lib/fluent/plugin/filter_script.rb', line 7

def configure(conf)
  super
  load_script_file(conf['path'].to_s)
end

#load_script_file(path) ⇒ Object

Raises:

  • (ConfigError)


12
13
14
15
# File 'lib/fluent/plugin/filter_script.rb', line 12

def load_script_file(path)
  raise ConfigError, "Ruby script file does not exist: #{path}" unless File.exist?(path)
  eval "self.instance_eval do;" + IO.read(path) + ";end"
end