Permalink
Browse files

Rollback recent refactor of inputs/base, I think I broke something

Rolled-back with: git diff -R 9a625c7..3a516f5 -- lib/logstash/inputs/base.rb | patch -p1
  • Loading branch information...
1 parent a2097a5 commit 2e229efcb8149160fbc61f71bf81f4cb78a4d464 @jordansissel jordansissel committed Sep 12, 2012
Showing with 7 additions and 12 deletions.
  1. +7 −12 lib/logstash/inputs/base.rb
@@ -62,7 +62,6 @@ def initialize(params)
@threadable = false
config_init(params)
@tags ||= []
- @format ||= "plain"
end # def initialize
public
@@ -77,21 +76,17 @@ def tag(newtag)
protected
def to_event(raw, source)
+ @format ||= "plain"
+
+ event = LogStash::Event.new
+ event.type = @type
+ event.tags = @tags.clone rescue []
+ event.source = source
case @format
when "plain"
- event = LogStash::Event.new(
- "@type" => @type,
- "@tags" => (@tags.clone rescue []),
- "@source" => source,
- "@message" => raw
- )
+ event.message = raw
when "json"
- event = LogStash::Event.new(
- "@type" => @type,
- "@tags" => (@tags.clone rescue []),
- "@source" => source,
- )
begin
fields = JSON.parse(raw)
fields.each { |k, v| event[k] = v }

0 comments on commit 2e229ef

Please sign in to comment.