Skip to content

Commit

Permalink
Merge pull request #55 from apptentive-engineering/fix_fields_for_1_2
Browse files Browse the repository at this point in the history
logstash formatter updates for 1.2
  • Loading branch information
roidrage committed Nov 18, 2013
2 parents 29e8aff + 5899685 commit f3f243b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 3 additions & 2 deletions lib/lograge/formatters/logstash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ module Formatters
class Logstash
def call(data)
load_dependencies
event = LogStash::Event.new("@fields" => data)
event = LogStash::Event.new(data)

event.message = "[#{data[:status]}] #{data[:method]} #{data[:path]} (#{data[:controller]}##{data[:action]})"
event.to_json
end
Expand All @@ -16,4 +17,4 @@ def load_dependencies
end
end
end
end
end
5 changes: 1 addition & 4 deletions spec/formatters/logstash_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@
}
end
subject { described_class.new.call(payload) }
it { should match(/"@source":"unknown"/) }
it { should match(/"@tags":\[\]/) }
it { should match(/"@fields":{/) }
it { should match(/"custom":"data"/) }
it { should match(/"status":200/) }
it { should match(/"method":"GET"/) }
it { should match(/"path":"\/"/) }
it { should match(/"controller":"welcome"/) }
it { should match(/"action":"index"/) }
end
end

0 comments on commit f3f243b

Please sign in to comment.