Module: LogStash::Inputs

Defined in:
lib/logstash/namespace.rb,
lib/logstash/inputs.rb

Defined Under Namespace

Classes: Amqp, Base, Beanstalk, File, Internal, Redis, Stdin, Stomp, Syslog, Tcp

Class Method Summary collapse

Class Method Details

.from_url(url, type, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/logstash/inputs.rb', line 11

def self.from_url(url, type, &block)
  # Assume file paths if we start with "/"
  url = "file://#{url}" if url.start_with?("/")

  uri = URI.parse(url)
  # TODO(sissel): Add error handling
  # TODO(sissel): Allow plugin paths
  klass = uri.scheme.capitalize
  file = uri.scheme.downcase
  require "logstash/inputs/#{file}"
  LogStash::Inputs.const_get(klass).new(uri, type, &block)
end