logstash-filter-aggregate 2.1.0 → 2.1.1

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: 847b68e7346466cf927e4975469593a48ebb9771
4
- data.tar.gz: 9b0dd0eb302cfba006c09970a2442ccf5d316fa9
3
+ metadata.gz: adf79052e26c1e6eeabb0088a906057312030eb3
4
+ data.tar.gz: ee5b2fd034f84cbd2f047bd225b0d7eaec326269
5
5
  SHA512:
6
- metadata.gz: d8d934c2ba456f1d828bf97e7cee1c5027d424e08340d6fd1be63944558c03daec0cf387b33621b4cb769dda443adb1e1693a7cf3e14b41990bd4d5b87673a34
7
- data.tar.gz: 6cdf6281964d83d2c64dc19eb764b9d15e50fdfd9fc50d29e1d7d0af10edb67f7757eef66bb2bc70dbe856dda67ee9d9c1f4908de4b33adc85411b44356e2c6e
6
+ metadata.gz: 9681cea6e04bad9b87c355480a42a09570f1d335f90cab5e3d92a39d783e2a14387414180f2561f17efeb300ac83cc8836d78426607dea64565790094a8df1f8
7
+ data.tar.gz: bbee958fccf8e6973b666941b7d035744d4416973d290bfb2e7d4d439b785643902d1199b6f18acee82874a1e2ccd9bfd0e0a0034eb2268512d9871c2478ff7e
@@ -1,3 +1,7 @@
1
+ ## 2.1.1
2
+ - bugfix: when "aggregate_maps_path" option is defined in more than one aggregate filter, raise a Logstash::ConfigurationError
3
+ - bugfix: add support for logstash hot reload feature
4
+
1
5
  ## 2.1.0
2
6
  - new feature: add new option "aggregate_maps_path" so that aggregate maps can be stored at logstash shutdown and reloaded at logstash startup
3
7
 
data/README.md CHANGED
@@ -153,10 +153,15 @@ The default value is 0, which means no timeout so no auto eviction.
153
153
  - **aggregate_maps_path:**
154
154
  The path to file where aggregate maps are stored when logstash stops and are loaded from when logstash starts.
155
155
  If not defined, aggregate maps will not be stored at logstash stop and will be lost.
156
- Should be defined for only one aggregate filter (as aggregate maps are global).
156
+ Must be defined in only one aggregate filter (as aggregate maps are global).
157
157
  Example value : `"/path/to/.aggregate_maps"`
158
158
 
159
159
 
160
+ ## Changelog
161
+
162
+ Read [CHANGELOG.md](CHANGELOG.md).
163
+
164
+
160
165
  ## Need Help?
161
166
 
162
167
  Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
@@ -173,7 +173,7 @@ class LogStash::Filters::Aggregate < LogStash::Filters::Base
173
173
  # and are loaded from when logstash starts.
174
174
  #
175
175
  # If not defined, aggregate maps will not be stored at logstash stop and will be lost.
176
- # Should be defined for only one aggregate filter (as aggregate maps are global).
176
+ # Must be defined in only one aggregate filter (as aggregate maps are global).
177
177
  #
178
178
  # Example value : `"/path/to/.aggregate_maps"`
179
179
  config :aggregate_maps_path, :validate => :string, :required => false
@@ -195,6 +195,10 @@ class LogStash::Filters::Aggregate < LogStash::Filters::Base
195
195
  # last time where eviction was launched
196
196
  @@last_eviction_timestamp = nil
197
197
 
198
+ # flag indicating if aggregate_maps_path option has been already set on one aggregate instance
199
+ @@aggregate_maps_path_set = false
200
+
201
+
198
202
  # Initialize plugin
199
203
  public
200
204
  def register
@@ -207,6 +211,16 @@ class LogStash::Filters::Aggregate < LogStash::Filters::Base
207
211
  @@eviction_instance = self
208
212
  @logger.info("Aggregate, timeout: #{@timeout} seconds")
209
213
  end
214
+
215
+ # check if aggregate_maps_path option has already been set on another instance
216
+ if (!@aggregate_maps_path.nil?)
217
+ if (@@aggregate_maps_path_set)
218
+ @@aggregate_maps_path_set = false
219
+ raise LogStash::ConfigurationError, "Option 'aggregate_maps_path' must be set on only one aggregate filter"
220
+ else
221
+ @@aggregate_maps_path_set = true
222
+ end
223
+ end
210
224
 
211
225
  # load aggregate maps from file (if option defined)
212
226
  if (!@aggregate_maps_path.nil? && File.exist?(@aggregate_maps_path))
@@ -220,6 +234,11 @@ class LogStash::Filters::Aggregate < LogStash::Filters::Base
220
234
  # Called when logstash stops
221
235
  public
222
236
  def close
237
+
238
+ # Protection against logstash reload
239
+ @@aggregate_maps_path_set = false if @@aggregate_maps_path_set
240
+ @@eviction_instance = nil unless @@eviction_instance.nil?
241
+
223
242
  @@mutex.synchronize do
224
243
  # store aggregate maps to file (if option defined)
225
244
  if (!@aggregate_maps_path.nil? && !@@aggregate_maps.empty?)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-filter-aggregate'
3
- s.version = '2.1.0'
3
+ s.version = '2.1.1'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "The aim of this filter is to aggregate information available among several events (typically log lines) belonging to a same task, and finally push aggregated information into final task event."
6
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -206,5 +206,16 @@ describe LogStash::Filters::Aggregate do
206
206
 
207
207
  end
208
208
  end
209
+
210
+ describe "when aggregate_maps_path option is defined in 2 instances, " do
211
+ it "raises Logstash::ConfigurationError" do
212
+
213
+ expect {
214
+ setup_filter({ "code" => "", "aggregate_maps_path" => "aggregate_maps1" })
215
+ setup_filter({ "code" => "", "aggregate_maps_path" => "aggregate_maps2" })
216
+ }.to raise_error(LogStash::ConfigurationError)
217
+
218
+ end
219
+ end
209
220
  end
210
221
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-aggregate
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-06 00:00:00.000000000 Z
12
+ date: 2016-05-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement