logstash-input-mongoprofile 0.1.14 → 0.1.15

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: 9f1791577f9d52eae124d6f9603624d9ff2db228
4
- data.tar.gz: 0db3f8282ddf833154b8e1db77f78496da25e91b
3
+ metadata.gz: d4b22c8ef7d441e7d6d7130e51f18990fe34f272
4
+ data.tar.gz: 3534f85ef64368f518f18ac27cb259a64c862a46
5
5
  SHA512:
6
- metadata.gz: 0bace47f999c477d705a29026390c5ef63b65a5c1d6a971c4a81cc415c121cc1cff9705b1d9c03a6f753809632ca4588869ca00655491c48c209fc7ea3d28fe7
7
- data.tar.gz: 5067c562a892770f2d0c9b588bc60810d4e5e431b3ba063564fd0b669aa1e31ee66fe3e2d5a10d5aae95d3b29e397099261969a17336dc1f9e2a026751672d8c
6
+ metadata.gz: 40e4941008a948ab16952549645d78b6a4194d566024aba8bb1b38b66c2c9d83643228d141e42a76e2399acf9927917ab632adb20499608ca0aba456ddb847b6
7
+ data.tar.gz: f560de9428f0d222f5810218cc1782efe77bd74f9143d257621b7a2191f48d7b4b3db9e41c8ae54f39f5d963bb652364b5b8c88c683f74aa025d9c8e1b5e5307
@@ -20,11 +20,12 @@ class LogStash::Inputs::Mongoprofile < LogStash::Inputs::Base
20
20
  config :url, :validate => :string, :required => true
21
21
  config :path, :validate => :string, :required => true
22
22
  config :client_host, :validate => :string, :default => '127.0.0.1'
23
+ config :generate_id, :validate => :boolean, :default => false
23
24
 
24
25
  public
25
26
  def register
26
27
  @host = Socket.gethostname
27
- @controller = Controller.new(@host, @url, 'system.profile', 1000, @path, @client_host, @logger)
28
+ @controller = Controller.new(@host, @url, 'system.profile', 1000, @path, @client_host, @logger, @generate_id)
28
29
  end
29
30
 
30
31
  # def register
@@ -83,7 +84,8 @@ class MongoAccessor
83
84
  end
84
85
 
85
86
  class ProfileCollection
86
- def initialize(documents, parser)
87
+ def initialize(documents, parser, generate_id)
88
+ @generate_id = generate_id
87
89
  @documents = []
88
90
 
89
91
  documents.each do |document|
@@ -95,7 +97,10 @@ class ProfileCollection
95
97
 
96
98
  def each
97
99
  @documents.each do |document|
98
- document['_id'] = generate_id.to_s
100
+ if @generate_id
101
+ document['_id'] = generate_id.to_s
102
+ end
103
+
99
104
  yield @parser.parse(document)
100
105
  end
101
106
  end
@@ -154,10 +159,11 @@ class LastValueStore
154
159
  end
155
160
 
156
161
  class Controller
157
- def initialize(event, url, collection, limit, path, client_host, logger)
162
+ def initialize(event, url, collection, limit, path, client_host, logger, generate_id)
158
163
  @mongo_accessor = MongoAccessor.new(url, collection, client_host)
159
164
  @last_value_store = LastValueStore.new(path, collection)
160
165
  @document_parser = DocumentParser.new(event, logger)
166
+ @generate_id = generate_id
161
167
  @limit = limit
162
168
  @logger = logger
163
169
  end
@@ -173,7 +179,7 @@ class Controller
173
179
  documents = @mongo_accessor.get_documents_by_ts(last_date_value, @limit)
174
180
  end
175
181
 
176
- profile_collection = ProfileCollection.new(documents, @document_parser)
182
+ profile_collection = ProfileCollection.new(documents, @document_parser, @generate_id)
177
183
 
178
184
  if profile_collection.get_last_document_date != nil
179
185
  @last_value_store.save_last_value(profile_collection.get_last_document_date)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-mongoprofile'
3
- s.version = '0.1.14'
3
+ s.version = '0.1.15'
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.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Antonov