mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- update old references to event.tags, event.unix_timestamp, and
event.ruby_timestamp
This commit is contained in:
parent
b4dad51c6c
commit
9b29c3e513
15 changed files with 31 additions and 32 deletions
|
@ -127,10 +127,9 @@ class LogStash::Filters::Advisor < LogStash::Filters::Base
|
|||
|
||||
if (@first == true)
|
||||
event = LogStash::Event.new
|
||||
event.source_host = Socket.gethostname
|
||||
event["host"] = Socket.gethostname
|
||||
event["message"] = @message
|
||||
event.tags << "advisor_first"
|
||||
event.source = Socket.gethostname+" advisor_plugin"
|
||||
event.tag "advisor_first"
|
||||
filter_matched(event)
|
||||
|
||||
@first = false
|
||||
|
|
|
@ -151,7 +151,7 @@ class LogStash::Filters::Base < LogStash::Plugin
|
|||
tag = event.sprintf(tag)
|
||||
@logger.debug? and @logger.debug("filters/#{self.class.name}: removing tag",
|
||||
:tag => tag)
|
||||
event.tags.delete(tag)
|
||||
event["tags"].delete(tag)
|
||||
end
|
||||
end # def filter_matched
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ class LogStash::Filters::Metaevent < LogStash::Filters::Base
|
|||
end
|
||||
|
||||
def followed_by_tags_match(event)
|
||||
(event.tags & @followed_by_tags).size == @followed_by_tags.size
|
||||
(event["tags"] & @followed_by_tags).size == @followed_by_tags.size
|
||||
end
|
||||
|
||||
def within_period(event)
|
||||
|
|
|
@ -148,7 +148,7 @@ class LogStash::Filters::Metrics < LogStash::Filters::Base
|
|||
return if @metric_meters.empty? && @metric_timers.empty?
|
||||
|
||||
event = LogStash::Event.new
|
||||
event.source_host = Socket.gethostname
|
||||
event["message"] = Socket.gethostname
|
||||
@metric_meters.each do |name, metric|
|
||||
event["#{name}.count"] = metric.count
|
||||
event["#{name}.rate_1m"] = metric.one_minute_rate
|
||||
|
|
|
@ -26,9 +26,9 @@ class LogStash::Filters::Railsparallelrequest < LogStash::Filters::Base
|
|||
|
||||
def filter(event)
|
||||
return unless filter?(event)
|
||||
return if event.tags.include? self.class.config_name
|
||||
return if event["tags"].include? self.class.config_name
|
||||
|
||||
event.tags << self.class.config_name
|
||||
event["tags"] << self.class.config_name
|
||||
|
||||
line = event["message"]
|
||||
|
||||
|
|
|
@ -65,14 +65,14 @@ class LogStash::Outputs::Base < LogStash::Plugin
|
|||
end
|
||||
|
||||
if !@tags.empty?
|
||||
if !@tags.send(@include_method) {|tag| event.tags.include?(tag)}
|
||||
if !@tags.send(@include_method) {|tag| event["tags"].include?(tag)}
|
||||
@logger.debug? and @logger.debug("Dropping event because tags don't match #{@tags.inspect}", event)
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
if !@exclude_tags.empty?
|
||||
if @exclude_tags.send(@exclude_method) {|tag| event.tags.include?(tag)}
|
||||
if @exclude_tags.send(@exclude_method) {|tag| event["tags"].include?(tag)}
|
||||
@logger.debug? and @logger.debug("Dropping event because tags contains excluded tags: #{exclude_tags.inspect}", event)
|
||||
return false
|
||||
end
|
||||
|
|
|
@ -25,14 +25,14 @@ class LogStash::Outputs::Boundary < LogStash::Outputs::Base
|
|||
# Override the start time
|
||||
# Note that Boundary requires this to be seconds since epoch
|
||||
# If overriding, it is your responsibility to type this correctly
|
||||
# By default this is set to `event.unix_timestamp.to_i`
|
||||
# By default this is set to `event["@timestamp"].to_i`
|
||||
config :start_time, :validate => :string
|
||||
|
||||
# End time
|
||||
# Override the stop time
|
||||
# Note that Boundary requires this to be seconds since epoch
|
||||
# If overriding, it is your responsibility to type this correctly
|
||||
# By default this is set to `event.unix_timestamp.to_i`
|
||||
# By default this is set to `event["@timestamp"].to_i`
|
||||
config :end_time, :validate => :string
|
||||
|
||||
# Type
|
||||
|
@ -86,10 +86,10 @@ class LogStash::Outputs::Boundary < LogStash::Outputs::Base
|
|||
boundary_event = {
|
||||
'type' => event.sprintf("%{message}"),
|
||||
'subtype' => event.sprintf("%{type}"),
|
||||
'start_time' => event.unix_timestamp.to_i,
|
||||
'end_time' => event.unix_timestamp.to_i,
|
||||
'start_time' => event["@timestamp"].to_i,
|
||||
'end_time' => event["@timestamp"].to_i,
|
||||
'links' => [],
|
||||
'tags' => event.tags,
|
||||
'tags' => event["tags"],
|
||||
}.merge boundary_event
|
||||
|
||||
request = Net::HTTP::Post.new(@uri.path)
|
||||
|
|
|
@ -23,7 +23,7 @@ class LogStash::Outputs::Circonus < LogStash::Outputs::Base
|
|||
# Annotations
|
||||
# Registers an annotation with Circonus
|
||||
# The only required field is `title` and `description`.
|
||||
# `start` and `stop` will be set to `event.unix_timestamp`
|
||||
# `start` and `stop` will be set to `event["@timestamp"]`
|
||||
# You can add any other optional annotation values as well.
|
||||
# All values will be passed through `event.sprintf`
|
||||
#
|
||||
|
@ -58,8 +58,8 @@ class LogStash::Outputs::Circonus < LogStash::Outputs::Base
|
|||
annotation_path = "#{@uri.path}annotation"
|
||||
@logger.warn("Annotation path", :data => annotation_path)
|
||||
request = Net::HTTP::Post.new(annotation_path)
|
||||
annotation_event['start'] = event.unix_timestamp.to_i unless annotation_event['start']
|
||||
annotation_event['stop'] = event.unix_timestamp.to_i unless annotation_event['stop']
|
||||
annotation_event['start'] = event["@timestamp"].to_i unless annotation_event['start']
|
||||
annotation_event['stop'] = event["@timestamp"].to_i unless annotation_event['stop']
|
||||
@logger.warn("Annotation event", :data => annotation_event)
|
||||
annotation_array << annotation_event
|
||||
begin
|
||||
|
|
|
@ -65,13 +65,13 @@ class LogStash::Outputs::Datadog < LogStash::Outputs::Base
|
|||
if @date_happened
|
||||
dd_event['date_happened'] = event.sprintf(@date_happened)
|
||||
else
|
||||
dd_event['date_happened'] = event.unix_timestamp.to_i
|
||||
dd_event['date_happened'] = event["@timestamp"].to_i
|
||||
end
|
||||
|
||||
if @dd_tags
|
||||
tagz = @dd_tags.collect {|x| event.sprintf(x) }
|
||||
else
|
||||
tagz = event.tags
|
||||
tagz = event["tags"]
|
||||
end
|
||||
dd_event['tags'] = tagz if tagz
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ class LogStash::Outputs::DatadogMetrics < LogStash::Outputs::Base
|
|||
if @dd_tags
|
||||
tagz = @dd_tags.collect {|x| event.sprintf(x) }
|
||||
else
|
||||
tagz = event.tags
|
||||
tagz = event["tags"]
|
||||
end
|
||||
dd_metrics['tags'] = tagz if tagz
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ class LogStash::Outputs::Email < LogStash::Outputs::Base
|
|||
return unless output?(event)
|
||||
@logger.debug("Event being tested for Email", :tags => @tags, :event => event)
|
||||
# Set Intersection - returns a new array with the items that are the same between the two
|
||||
if !@tags.empty? && (event.tags & @tags).size == 0
|
||||
if !@tags.empty? && (event["tags"] & @tags).size == 0
|
||||
# Skip events that have no tags in common with what we were configured
|
||||
@logger.debug("No Tags match for Email Output!")
|
||||
return
|
||||
|
|
|
@ -94,7 +94,7 @@ class LogStash::Outputs::GraphTastic < LogStash::Outputs::Base
|
|||
def receive(event)
|
||||
return unless output?(event)
|
||||
# Set Intersection - returns a new array with the items that are the same between the two
|
||||
if !@tags.empty? && (event.tags & @tags).size == 0
|
||||
if !@tags.empty? && (event["tags"] & @tags).size == 0
|
||||
# Skip events that have no tags in common with what we were configured
|
||||
@logger.debug("No Tags match for GraphTastic Output!")
|
||||
return
|
||||
|
@ -102,7 +102,7 @@ class LogStash::Outputs::GraphTastic < LogStash::Outputs::Base
|
|||
@retry = 1
|
||||
@logger.debug("Event found for GraphTastic!", :tags => @tags, :event => event)
|
||||
@metrics.each do |name, metric|
|
||||
postMetric(event.sprintf(name),event.sprintf(metric),(event.unix_timestamp*1000))# unix_timestamp is what I need in seconds - multiply by 1000 to make milliseconds.
|
||||
postMetric(event.sprintf(name),event.sprintf(metric),(event["@timestamp"]*1000))# unix_timestamp is what I need in seconds - multiply by 1000 to make milliseconds.
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -181,4 +181,4 @@ class LogStash::Outputs::GraphTastic < LogStash::Outputs::Base
|
|||
|
||||
def udpsocket; @socket ||= UDPSocket.new end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,7 +40,7 @@ class LogStash::Outputs::Librato < LogStash::Outputs::Base
|
|||
# Annotations
|
||||
# Registers an annotation with Librato
|
||||
# The only required field is `title` and `name`.
|
||||
# `start_time` and `end_time` will be set to `event.unix_timestamp`
|
||||
# `start_time` and `end_time` will be set to `event["@timestamp"].to_i`
|
||||
# You can add any other optional annotation values as well.
|
||||
# All values will be passed through `event.sprintf`
|
||||
#
|
||||
|
@ -79,7 +79,7 @@ class LogStash::Outputs::Librato < LogStash::Outputs::Base
|
|||
g_hash.each do |k,v|
|
||||
g_hash[k] = v.to_f if k=="value"
|
||||
end
|
||||
g_hash['measure_time'] = event.unix_timestamp.to_i unless g_hash['measure_time']
|
||||
g_hash['measure_time'] = event["@timestamp"].to_i unless g_hash['measure_time']
|
||||
@logger.warn("Gauges hash", :data => g_hash)
|
||||
metrics_event['gauges'] = Array.new
|
||||
metrics_event['gauges'] << g_hash
|
||||
|
@ -90,7 +90,7 @@ class LogStash::Outputs::Librato < LogStash::Outputs::Base
|
|||
c_hash.each do |k,v|
|
||||
c_hash[k] = v.to_f if k=="value"
|
||||
end
|
||||
c_hash['measure_time'] = event.unix_timestamp.to_i unless c_hash['measure_time']
|
||||
c_hash['measure_time'] = event["@timestamp"].to_i unless c_hash['measure_time']
|
||||
@logger.warn("Counters hash", :data => c_hash)
|
||||
metrics_event['counters'] = Array.new
|
||||
metrics_event['counters'] << c_hash
|
||||
|
@ -126,8 +126,8 @@ class LogStash::Outputs::Librato < LogStash::Outputs::Base
|
|||
request = Net::HTTP::Post.new(annotation_path)
|
||||
request.basic_auth(@account_id, @api_token)
|
||||
annotation_event.delete('name')
|
||||
annotation_event['start_time'] = event.unix_timestamp.to_i unless annotation_event['start_time']
|
||||
annotation_event['end_time'] = event.unix_timestamp.to_i unless annotation_event['end_time']
|
||||
annotation_event['start_time'] = event["@timestamp"].to_i unless annotation_event['start_time']
|
||||
annotation_event['end_time'] = event["@timestamp"].to_i unless annotation_event['end_time']
|
||||
annotation_hash['annotations'] << annotation_event
|
||||
@logger.warn("Annotation event", :data => annotation_event)
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ class LogStash::Outputs::Mongodb < LogStash::Outputs::Base
|
|||
document = event.to_hash.merge("@timestamp" => event["@timestamp"].to_json)
|
||||
end
|
||||
if @generateId
|
||||
document['_id'] = BSON::ObjectId.new(nil, event.ruby_timestamp)
|
||||
document['_id'] = BSON::ObjectId.new(nil, event["@timestamp"])
|
||||
end
|
||||
@db.collection(event.sprintf(@collection)).insert(document)
|
||||
rescue => e
|
||||
|
|
|
@ -79,7 +79,7 @@ class LogStash::Outputs::Riemann < LogStash::Outputs::Base
|
|||
r_event = Hash.new
|
||||
r_event[:host] = event.sprintf(@sender)
|
||||
# riemann doesn't handle floats so we reduce the precision here
|
||||
r_event[:time] = event.unix_timestamp.to_i
|
||||
r_event[:time] = event["@timestamp"].to_i
|
||||
r_event[:description] = event["message"]
|
||||
if @riemann_event
|
||||
@riemann_event.each do |key, val|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue