logstash-input-mongoprofile 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3102b42e17eee1f36dea358db6f356ef0ad0e711
4
- data.tar.gz: b64d8da8cf5a674b3f5b2a34dbbfcfab8c106404
3
+ metadata.gz: f4258635451f2deb6f7324bd52337dc7f3423b89
4
+ data.tar.gz: a7cb17868744643edb9297e9134e82d69f7abeaf
5
5
  SHA512:
6
- metadata.gz: af0482c58dc1dcac984060548e926558670964af2e5bd1d14a2d2601b1941423030ede9638618864d9947572d7fde7dd5f4e36cbbbfee9b4431d02aafe22b3c5
7
- data.tar.gz: d05f7abbaab618d1d00b338aa1a3565bbaebfed0e31979d68801b516ef7551a3cb094d8618bb9a6e2a0e3201de99ac24a7849d1a1b0ab246eb89a8cb219f1019
6
+ metadata.gz: a950b0ab5a84a5bb98fff2a3dbae8562ae9f7661888b4312982af2e4f98da2590635aff84d40656864d95cc9b4434acef6853359b1a1c4aec6df2ee804e4339b
7
+ data.tar.gz: 4be9b66027a6c8461be1ec758a758d7467ec7bef1b497c203a88a47c873cee406e2b96ece65cede232af8c1f7a6745cb0cddbf9ed4940c598f1e063046a00ac6
@@ -73,17 +73,22 @@ class MongoAccessor
73
73
  end
74
74
 
75
75
  def get_documents_by_ts(date, limit)
76
- @collection.find({:ts => {:$gt => date}, :client => {:$ne => @client_host}}).limit(limit)
76
+ @collection.find({:ts => {:$gt => date}, :client => {:$ne => @client_host}}).limit(limit).sort(:ts => -1)
77
77
  end
78
78
 
79
79
  def get_documents(limit)
80
- @collection.find({:client => {:$ne => @client_host}}).limit(limit)
80
+ @collection.find({:client => {:$ne => @client_host}}).limit(limit).sort(:ts => -1)
81
81
  end
82
82
  end
83
83
 
84
84
  class ProfileCollection
85
85
  def initialize(documents, parser)
86
- @documents = documents
86
+ @documents = []
87
+
88
+ documents.each do |document|
89
+ @documents.push(document)
90
+ end
91
+
87
92
  @parser = parser
88
93
  end
89
94
 
@@ -152,8 +157,10 @@ class Controller
152
157
  last_date_value = @last_value_store.get_last_value
153
158
 
154
159
  if last_date_value == ''
160
+ @logger.info('Getting documents from mongo first time')
155
161
  documents = @mongo_accessor.get_documents(@limit)
156
162
  else
163
+ @logger.info("Getting documents from mongo start at #{last_date_value}")
157
164
  documents = @mongo_accessor.get_documents_by_ts(last_date_value, @limit)
158
165
  end
159
166
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-mongoprofile'
3
- s.version = '0.1.4'
3
+ s.version = '0.1.5'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = 'MongoDB system.profile input plugin'
6
6
  s.description = 'MongoDB system.profile input plugin'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-mongoprofile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Antonov