fluent-plugin-geoip 1.3.1 → 1.3.2

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
  SHA256:
3
- metadata.gz: f90a0511cb3b631423f10611fa9b31ce69a1ba2eb815a959ee31ea83bba7cd91
4
- data.tar.gz: 0ff06245d1aa1633cebae4d3a764e24dc8a1af5c67b6c7fd7039350f55bf0067
3
+ metadata.gz: 35bca82d01d71c2eed7db735cf4e2394e6af0ec420baa511cfe74431fd0c88c4
4
+ data.tar.gz: e15c7f9fec5855d0012d97a65d0aa170338a169229e65eea5baf798c4d2d2763
5
5
  SHA512:
6
- metadata.gz: 513d669a7a40673aee8329be06f1dc4d024f286e13d1760126c0fe3b6f6ad15a06aee54c3bef8ebd227a506202d4e4886425caa540efcf80bd4bb4423ed45051
7
- data.tar.gz: afcb9809f98196b6de647e58111dc608caf8143c6bd966b44d412eada89404efb46b842755484768dcb9faba781de8c44ad8f2aa5cf3ccb8f62e34b8a3f42363
6
+ metadata.gz: c67641b18a5254169fa4c0d0fa7b32e1612c2f65c6f7ebfd5afffeaaa7c1f5a1ffa1e77334e10a7f5cecf476e0dbd6b7d64f080d93894b4b0cf8f7c4092b141d
7
+ data.tar.gz: c7e7fa0d170d4f451f9666bf471a76b193a7f0e466403992b85cb6051bc72b1a94e6f54ffe378cc5414d8cdf251a02402fa26c01507e58baf2b2db313690e4d3
data/README.md CHANGED
@@ -31,10 +31,12 @@ before use, install dependent library as:
31
31
  # for RHEL/CentOS
32
32
  $ sudo yum groupinstall "Development Tools"
33
33
  $ sudo yum install geoip-devel --enablerepo=epel
34
+ $ sudo yum install libmaxminddb-devel
34
35
 
35
36
  # for Ubuntu/Debian
36
37
  $ sudo apt-get install build-essential
37
38
  $ sudo apt-get install libgeoip-dev
39
+ $ sudo apt-get install libmaxminddb-dev
38
40
 
39
41
  # for OS X
40
42
  $ brew install geoip
@@ -191,7 +193,7 @@ We can avoid this behavior changing field order in `` like following:
191
193
 
192
194
  #### Tips: nested attributes for geoip_lookup_keys
193
195
 
194
- See [Record Accessor Plugin](https://docs.fluentd.org/v1.0/articles/api-plugin-helper-record_accessor#syntax)
196
+ See [Record Accessor Plugin Helper](https://docs.fluentd.org/plugin-helper-overview/api-plugin-helper-record_accessor)
195
197
 
196
198
  **NOTE** Since v1.3.0 does not interpret `host.ip` as nested attribute.
197
199
 
@@ -355,18 +357,18 @@ Note that filter version of `geoip` plugin does not have handling `tag` feature.
355
357
 
356
358
  #### Plugin helpers
357
359
 
358
- * [compat_parameters](https://docs.fluentd.org/v1.0/articles/api-plugin-helper-compat_parameters)
359
- * [inject](https://docs.fluentd.org/v1.0/articles/api-plugin-helper-inject)
360
+ * [compat_parameters](https://docs.fluentd.org/plugin-helper-overview/api-plugin-helper-compat_parameters)
361
+ * [inject](https://docs.fluentd.org/plugin-helper-overview/api-plugin-helper-inject)
360
362
 
361
- See also [Filter Plugin Overview](https://docs.fluentd.org/v1.0/articles/filter-plugin-overview)
363
+ See also [Filter Plugin Overview](https://docs.fluentd.org/filter)
362
364
 
363
365
  #### Supported sections
364
366
 
365
- * [Inject section configurations](https://docs.fluentd.org/v1.0/articles/inject-section)
367
+ * [Inject section configurations](https://docs.fluentd.org/configuration/inject-section)
366
368
 
367
369
  #### Parameters
368
370
 
369
- [Plugin Common Paramteters](https://docs.fluentd.org/v1.0/articles/plugin-common-parameters)
371
+ [Plugin Common Paramteters](https://docs.fluentd.org/configuration/plugin-common-parameters)
370
372
 
371
373
  **geoip_database** (string) (optional)
372
374
 
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-geoip"
7
- spec.version = "1.3.1"
7
+ spec.version = "1.3.2"
8
8
  spec.authors = ["Kentaro Yoshida"]
9
9
  spec.email = ["y.ken.studio@gmail.com"]
10
10
  spec.summary = %q{Fluentd Filter plugin to add information about geographical location of IP addresses with Maxmind GeoIP databases.}
@@ -169,11 +169,15 @@ module Fluent::Plugin
169
169
  addresses.each do |field, ip|
170
170
  geo = nil
171
171
  if ip
172
- geo = if @geoip.respond_to?(:look_up)
173
- @geoip.look_up(ip)
174
- else
175
- @geoip.lookup(ip)
176
- end
172
+ if ip.empty?
173
+ log.warn "#{field} is empty string"
174
+ else
175
+ geo = if @geoip.respond_to?(:look_up)
176
+ @geoip.look_up(ip)
177
+ else
178
+ @geoip.lookup(ip)
179
+ end
180
+ end
177
181
  end
178
182
  geodata[field] = geo
179
183
  end
@@ -209,6 +209,26 @@ class GeoipFilterTest < Test::Unit::TestCase
209
209
  assert_equal(expected, filtered)
210
210
  end
211
211
 
212
+ def test_filter_with_empty_string
213
+ config = %[
214
+ backend_library geoip2_c
215
+ geoip_lookup_keys host
216
+ <record>
217
+ geoip_city '${city.names.en["host"]}'
218
+ geopoint '[${location.longitude["host"]}, ${location.latitude["host"]}]'
219
+ </record>
220
+ skip_adding_null_record false
221
+ ]
222
+ messages = [
223
+ {'host' => '', 'message' => 'empty string ip'},
224
+ ]
225
+ expected = [
226
+ {'host' => '', 'message' => 'empty string ip', 'geoip_city' => nil, 'geopoint' => [nil, nil]},
227
+ ]
228
+ filtered = filter(config, messages)
229
+ assert_equal(expected, filtered)
230
+ end
231
+
212
232
  def test_filter_with_skip_unknown_address
213
233
  config = %[
214
234
  backend_library geoip2_c
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-geoip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kentaro Yoshida
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-01 00:00:00.000000000 Z
11
+ date: 2020-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
208
  - !ruby/object:Gem::Version
209
209
  version: '0'
210
210
  requirements: []
211
- rubygems_version: 3.0.1
211
+ rubygems_version: 3.0.3
212
212
  signing_key:
213
213
  specification_version: 4
214
214
  summary: Fluentd Filter plugin to add information about geographical location of IP