lib/logstash/outputs/rollbar.rb in logstash-output-rollbar-0.1.0 vs lib/logstash/outputs/rollbar.rb in logstash-output-rollbar-0.1.1
- old
+ new
@@ -10,11 +10,11 @@
class LogStash::Outputs::Rollbar < LogStash::Outputs::Base
config_name "rollbar"
milestone 1
# Your Rollbar access token
- config :access_token, :validate => :string, :required => true
+ config :access_token, :validate => :password, :required => true
# The Rollbar environment
config :environment, :validate => :string, :default => 'production'
# The Rollbar event level (info, warning, error)
@@ -39,21 +39,22 @@
require 'uri'
@rb_uri = URI.parse(@endpoint)
@client = Net::HTTP.new(@rb_uri.host, @rb_uri.port)
if @rb_uri.scheme == "https"
@client.use_ssl = true
- @client.verify_mode = OpenSSL::SSL::VERIFY_NONE
+ @client.verify_mode = OpenSSL::SSL::VERIFY_PEER
end
end # def register
public
def receive(event)
return unless output?(event)
rb_item = hash_recursive
- rb_item['access_token'] = @access_token
+ rb_item['access_token'] = @access_token.value
- data = event.to_hash
+ # We'll want to remove fields from data without removing them from the original event
+ data = JSON.parse(event.to_json)
#
# If logstash has created 'rollbar' fields, we'll use those to populate the item...
#
if data['rollbar']