lib/logstash/inputs/mongoprofile.rb in logstash-input-mongoprofile-0.1.8 vs lib/logstash/inputs/mongoprofile.rb in logstash-input-mongoprofile-0.1.9
- old
+ new
@@ -2,10 +2,11 @@
require "logstash/inputs/base"
require "logstash/namespace"
require "stud/interval"
require "socket" # for Socket.gethostname
require "mongo"
+require "date"
# Generate a repeating message.
#
# This plugin is intented only as an example.
@@ -71,10 +72,10 @@
@collection = @mongodb.collection(collection)
@client_host = client_host
end
def get_documents_by_ts(date, limit)
- @collection.find({:ts => {:$gt => date}, :client => {:$ne => @client_host}}).limit(limit).sort(:ts => -1)
+ @collection.find({:ts => {:$gt => DateTime.parse(date)}, :client => {:$ne => @client_host}}).limit(limit).sort(:ts => -1)
end
def get_documents(limit)
@collection.find({:client => {:$ne => @client_host}}).limit(limit).sort(:ts => -1)
end
\ No newline at end of file