Class: Fluent::Plugin::ShodanAlert

Inherits:
Input
  • Object
show all
Defined in:
lib/fluent/plugin/in_shodan_alert.rb

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/fluent/plugin/in_shodan_alert.rb', line 23

def configure(conf)
  super

  @client = Shodanz::Client.new(key: @api_key)
  begin
    log.info "Shodan client properly registered", client_info: @client.info
  rescue RuntimeError => exception
    raise Fluent::ConfigError.new "Invalid Shodan API key"
  end
end

#multi_workers_ready?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/fluent/plugin/in_shodan_alert.rb', line 19

def multi_workers_ready?
  false
end

#startObject



34
35
36
37
38
# File 'lib/fluent/plugin/in_shodan_alert.rb', line 34

def start
  super

  timer_execute("shodan_#{self.class.name}#{@alert_id.nil? ? "_#{@alert_id}" : '' }".to_sym, @interval, repeat: true, &method(:run))
end