logstash-filter-imgsize 1.0.0 → 1.0.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: 6571c16cc7f1cc835ca373dae701083d9812d9fc
4
- data.tar.gz: 41fda2a19363d034366d24c4db1e04614491a25c
3
+ metadata.gz: 3be3306ef188051314ad0bb39be5da664bdcf054
4
+ data.tar.gz: 13987f7b572c9cf4dff3750aca3ebe40604ee0d6
5
5
  SHA512:
6
- metadata.gz: a5858eb537fbbeda9eeebae6582f52d684829b74355caa201cb023a74bd32a67f2fb74deef2ade40f35b90db4a326e4e92de0e22b95ef99836d5c0b3cd3d0a90
7
- data.tar.gz: e028879a1bb3a99d9b16b9bf972a71d091dbe2b87c3c29c32c8b9fb25fed957247c15fae9ad7016a19e0f19876899e85e09df156e496a48cf40b85a600887a80
6
+ metadata.gz: 1d8b9a343b17a58e135d9441303ae4e9b724f90ee4ebc9f4fa943938e92f3638e2f8cbc5030e6ebe43fe33eed54624871104ae6cb04760a0ca191383f20e76cb
7
+ data.tar.gz: b59c93e5b8ada6e9bcc35a7f6c26d5f942826243970077f3b3f338b1b7e080166d3807954d8802cd95d694ba772f6e6e1969662f2a7287eff4cb3f89f7a5cec7
@@ -24,6 +24,7 @@ class LogStash::Filters::Imgsize < LogStash::Filters::Base
24
24
  config :image_url_field, :validate => :string, :default => "image_url"
25
25
  config :image_width_field, :validate => :string, :default => "image_width"
26
26
  config :image_height_field, :validate => :string, :default => "image_height"
27
+ config :drop_on_fail, :validate => :boolean, :default => false
27
28
 
28
29
  public
29
30
  def register
@@ -32,16 +33,17 @@ class LogStash::Filters::Imgsize < LogStash::Filters::Base
32
33
 
33
34
  public
34
35
  def filter(event)
35
- @logger.debug? && @logger.debug("Running imgsize filter", :event => event)
36
+ @logger.debug? && @logger.debug("Running imgsize filter")
36
37
  begin
37
38
  image_url = event[@image_url_field]
38
39
  width, height = FastImage.size(image_url)
40
+ event.cancel if @drop_on_fail && (width.nil? || height.nil?)
41
+ event[@image_width_field] = width
42
+ event[@image_height_field] = height
39
43
  rescue => exception
40
- @logger.error("Imgszie exception occurred. Error: #{exception} ; ImageUrl: #{image_url}")
41
- width = height = nil
44
+ @logger.warn("Imgszie exception occurred. Error: #{exception} ; ImageUrl: #{image_url}")
45
+ event.cancel if @drop_on_fail
42
46
  end
43
- event[@image_width_field] = width
44
- event[@image_height_field] = height
45
47
  filter_matched(event)
46
48
  end # def filter
47
- end # class LogStash::Filters::Example
49
+ end # class LogStash::Filters::Imgsize
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-filter-imgsize'
3
- s.version = '1.0.0'
3
+ s.version = '1.0.1'
4
4
  s.licenses = ['Apache License (2.0)']
5
- s.summary = "Getting Image size(width, height)"
6
- s.description = "Getting Image size(width, height)"
5
+ s.summary = "Make image size(width, height) filter"
6
+ s.description = "Make image size(width, height) filter"
7
7
  s.authors = ["Loup"]
8
8
  s.email = 'loup1788@gmail.com'
9
- s.homepage = "http://github.com/YukSeungChan"
9
+ s.homepage = "https://github.com/YukSeungChan/logstash-filter-imgsize"
10
10
  s.require_paths = ["lib"]
11
11
 
12
12
  # Files
@@ -18,7 +18,8 @@ Gem::Specification.new do |s|
18
18
  s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
19
19
 
20
20
  # Gem dependencies
21
- s.add_runtime_dependency "logstash-core-plugin-api", "~> 1.0"
22
- s.add_runtime_dependency "fastimage", "~> 2.0.0"
21
+ s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.20", "<= 2.99"
22
+ s.add_runtime_dependency 'fastimage', '~> 2.0', '>= 2.0.0'
23
+
23
24
  s.add_development_dependency 'logstash-devutils'
24
25
  end
metadata CHANGED
@@ -1,34 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-imgsize
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loup
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-05 00:00:00.000000000 Z
11
+ date: 2016-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-core-plugin-api
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '1.20'
20
+ - - "<="
18
21
  - !ruby/object:Gem::Version
19
- version: '1.0'
22
+ version: '2.99'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '1.0'
29
+ version: '1.20'
30
+ - - "<="
31
+ - !ruby/object:Gem::Version
32
+ version: '2.99'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: fastimage
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.0'
40
+ - - ">="
32
41
  - !ruby/object:Gem::Version
33
42
  version: 2.0.0
34
43
  type: :runtime
@@ -36,6 +45,9 @@ dependencies:
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
47
  - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '2.0'
50
+ - - ">="
39
51
  - !ruby/object:Gem::Version
40
52
  version: 2.0.0
41
53
  - !ruby/object:Gem::Dependency
@@ -52,7 +64,7 @@ dependencies:
52
64
  - - ">="
53
65
  - !ruby/object:Gem::Version
54
66
  version: '0'
55
- description: Getting Image size(width, height)
67
+ description: Make image size(width, height) filter
56
68
  email: loup1788@gmail.com
57
69
  executables: []
58
70
  extensions: []
@@ -68,7 +80,7 @@ files:
68
80
  - lib/logstash/filters/imgsize.rb
69
81
  - logstash-filter-imgsize.gemspec
70
82
  - spec/spec_helper.rb
71
- homepage: http://github.com/YukSeungChan
83
+ homepage: https://github.com/YukSeungChan/logstash-filter-imgsize
72
84
  licenses:
73
85
  - Apache License (2.0)
74
86
  metadata:
@@ -93,6 +105,6 @@ rubyforge_project:
93
105
  rubygems_version: 2.4.5.1
94
106
  signing_key:
95
107
  specification_version: 4
96
- summary: Getting Image size(width, height)
108
+ summary: Make image size(width, height) filter
97
109
  test_files:
98
110
  - spec/spec_helper.rb