fluent-plugin-geoip 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +8 -8
- data/Appraisals +14 -1
- data/README.md +2 -0
- data/data/COPYRIGHT.txt +1 -0
- data/data/GeoLite2-City.mmdb +0 -0
- data/data/GeoLiteCity.dat +0 -0
- data/data/LICENSE.txt +3 -0
- data/data/README.txt +1 -0
- data/fluent-plugin-geoip.gemspec +1 -1
- data/gemfiles/fluentd_v0.12_with_backport_dig.gemfile +8 -0
- data/gemfiles/{fluentd_v0.12.gemfile → fluentd_v0.12_without_backport_dig.gemfile} +2 -3
- data/gemfiles/fluentd_v1.0_with_backport_dig.gemfile +8 -0
- data/gemfiles/fluentd_v1.0_without_backport_dig.gemfile +7 -0
- data/lib/fluent/plugin/geoip.rb +9 -1
- data/test/plugin/test_filter_geoip.rb +9 -9
- data/test/plugin/test_out_geoip.rb +7 -6
- metadata +11 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ba51a787a4970750c7198634fd098dcb310c05a
|
4
|
+
data.tar.gz: 8e8fdc8b26e46c28f37bee711877e115df7293a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65b5ecb8009f1317f2f15dc1be73a935ce4298658497d3b329452ae95f66628ad20ba74014905738bb6a09ec5d6bb5005a48f25f5716cd0608ea1c2316994ee4
|
7
|
+
data.tar.gz: b7eded32d4b0c8babb7f417902e4565c592ed2af89e0bb5253165263c45704eef6feeadf1bd1787936a9e2dc96e4fecefef2cf2738ba778428c41d600fc621ff
|
data/.travis.yml
CHANGED
@@ -6,14 +6,14 @@ env:
|
|
6
6
|
global:
|
7
7
|
DOCKER_COMPOSE_VERSION: 1.8.1
|
8
8
|
matrix:
|
9
|
-
- TARGET_RUBY_VERSION=2.1 BUNDLE_GEMFILE=/app/
|
10
|
-
- TARGET_RUBY_VERSION=2.2 BUNDLE_GEMFILE=/app/
|
11
|
-
- TARGET_RUBY_VERSION=2.3 BUNDLE_GEMFILE=/app/
|
12
|
-
- TARGET_RUBY_VERSION=2.4 BUNDLE_GEMFILE=/app/
|
13
|
-
- TARGET_RUBY_VERSION=2.1 BUNDLE_GEMFILE=/app/gemfiles/fluentd_v0.
|
14
|
-
- TARGET_RUBY_VERSION=2.2 BUNDLE_GEMFILE=/app/gemfiles/fluentd_v0.
|
15
|
-
- TARGET_RUBY_VERSION=2.3 BUNDLE_GEMFILE=/app/gemfiles/fluentd_v0.
|
16
|
-
- TARGET_RUBY_VERSION=2.4 BUNDLE_GEMFILE=/app/gemfiles/fluentd_v0.
|
9
|
+
- TARGET_RUBY_VERSION=2.1 BUNDLE_GEMFILE=/app/gemfiles/fluentd_v1.0_with_backport_dig.gemfile
|
10
|
+
- TARGET_RUBY_VERSION=2.2 BUNDLE_GEMFILE=/app/gemfiles/fluentd_v1.0_with_backport_dig.gemfile
|
11
|
+
- TARGET_RUBY_VERSION=2.3 BUNDLE_GEMFILE=/app/gemfiles/fluentd_v1.0_without_backport_dig.gemfile
|
12
|
+
- TARGET_RUBY_VERSION=2.4 BUNDLE_GEMFILE=/app/gemfiles/fluentd_v1.0_without_backport_dig.gemfile
|
13
|
+
- TARGET_RUBY_VERSION=2.1 BUNDLE_GEMFILE=/app/gemfiles/fluentd_v0.12_with_backport_dig.gemfile
|
14
|
+
- TARGET_RUBY_VERSION=2.2 BUNDLE_GEMFILE=/app/gemfiles/fluentd_v0.12_with_backport_dig.gemfile
|
15
|
+
- TARGET_RUBY_VERSION=2.3 BUNDLE_GEMFILE=/app/gemfiles/fluentd_v0.12_without_backport_dig.gemfile
|
16
|
+
- TARGET_RUBY_VERSION=2.4 BUNDLE_GEMFILE=/app/gemfiles/fluentd_v0.12_without_backport_dig.gemfile
|
17
17
|
|
18
18
|
before_install:
|
19
19
|
#- sudo apt-get update
|
data/Appraisals
CHANGED
@@ -1,4 +1,17 @@
|
|
1
|
-
appraise "fluentd v0.12" do
|
1
|
+
appraise "fluentd v0.12 with backport_dig" do
|
2
2
|
gem "fluentd", "~> 0.12.0"
|
3
|
+
gem "backport_dig", "~> 1.0.0"
|
3
4
|
end
|
4
5
|
|
6
|
+
appraise "fluentd v0.12 without backport_dig" do
|
7
|
+
gem "fluentd", "~> 0.12.0"
|
8
|
+
end
|
9
|
+
|
10
|
+
appraise "fluentd v1.0 with backport_dig" do
|
11
|
+
gem "fluentd", "~> 1.0.0"
|
12
|
+
gem "backport_dig", "~> 1.0.0"
|
13
|
+
end
|
14
|
+
|
15
|
+
appraise "fluentd v1.0 without backport_dig" do
|
16
|
+
gem "fluentd", "~> 1.0.0"
|
17
|
+
end
|
data/README.md
CHANGED
@@ -28,6 +28,8 @@ $ sudo apt-get install libmaxminddb-dev
|
|
28
28
|
# for OS X
|
29
29
|
$ brew install geoip
|
30
30
|
$ brew install libmaxminddb
|
31
|
+
$ bundle config build.geoip-c --with-geoip-dir=/usr/local/include/
|
32
|
+
$ bundle config build.geoip2_c --with-opt-include=/usr/local/include/
|
31
33
|
```
|
32
34
|
|
33
35
|
## Installation
|
data/data/COPYRIGHT.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Database and Contents Copyright (c) 2017 MaxMind, Inc.
|
Binary file
|
data/data/GeoLiteCity.dat
CHANGED
Binary file
|
data/data/LICENSE.txt
ADDED
@@ -0,0 +1,3 @@
|
|
1
|
+
This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/.
|
2
|
+
|
3
|
+
This database incorporates GeoNames [http://www.geonames.org] geographical data, which is made available under the Creative Commons Attribution 3.0 License. To view a copy of this license, visit http://www.creativecommons.org/licenses/by/3.0/us/.
|
data/data/README.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Latitude and longitude are not precise and should not be used to identify a particular street address or household.
|
data/fluent-plugin-geoip.gemspec
CHANGED
@@ -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 = "0.
|
7
|
+
spec.version = "0.8.0"
|
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.}
|
data/lib/fluent/plugin/geoip.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
require 'geoip'
|
2
2
|
require 'yajl'
|
3
|
-
|
3
|
+
unless {}.respond_to?(:dig)
|
4
|
+
begin
|
5
|
+
# backport_dig is faster than dig_rb so prefer backport_dig.
|
6
|
+
# And Fluentd v1.0.1 uses backport_dig
|
7
|
+
require 'backport_dig'
|
8
|
+
rescue LoadError
|
9
|
+
require 'dig_rb'
|
10
|
+
end
|
11
|
+
end
|
4
12
|
|
5
13
|
module Fluent
|
6
14
|
class GeoIP
|
@@ -177,13 +177,13 @@ class GeoipFilterTest < Test::Unit::TestCase
|
|
177
177
|
messages = [
|
178
178
|
{'host' => '203.0.113.1', 'message' => 'invalid ip'},
|
179
179
|
{'host' => '0', 'message' => 'invalid ip'},
|
180
|
-
{'host' => '
|
180
|
+
{'host' => '66.102.3.80', 'message' => 'google bot'}
|
181
181
|
]
|
182
182
|
expected = [
|
183
183
|
{'host' => '203.0.113.1', 'message' => 'invalid ip'},
|
184
184
|
{'host' => '0', 'message' => 'invalid ip'},
|
185
|
-
{'host' => '
|
186
|
-
'geoip_city' => 'Mountain View', 'geopoint' => [-122.
|
185
|
+
{'host' => '66.102.3.80', 'message' => 'google bot',
|
186
|
+
'geoip_city' => 'Mountain View', 'geopoint' => [-122.0574, 37.419200000000004]}
|
187
187
|
]
|
188
188
|
filtered = filter(config, messages)
|
189
189
|
assert_equal(expected, filtered)
|
@@ -446,13 +446,13 @@ class GeoipFilterTest < Test::Unit::TestCase
|
|
446
446
|
messages = [
|
447
447
|
{'host' => '203.0.113.1', 'message' => 'invalid ip'},
|
448
448
|
{'host' => '0', 'message' => 'invalid ip'},
|
449
|
-
{'host' => '
|
449
|
+
{'host' => '66.102.3.80', 'message' => 'google bot'}
|
450
450
|
]
|
451
451
|
expected = [
|
452
452
|
{'host' => '203.0.113.1', 'message' => 'invalid ip'},
|
453
453
|
{'host' => '0', 'message' => 'invalid ip'},
|
454
|
-
{'host' => '
|
455
|
-
'geoip_city' => 'Mountain View', 'geopoint' => [-122.
|
454
|
+
{'host' => '66.102.3.80', 'message' => 'google bot',
|
455
|
+
'geoip_city' => 'Mountain View', 'geopoint' => [-122.0574, 37.419200000000004]}
|
456
456
|
]
|
457
457
|
filtered = filter(config, messages)
|
458
458
|
assert_equal(expected, filtered)
|
@@ -746,13 +746,13 @@ class GeoipFilterTest < Test::Unit::TestCase
|
|
746
746
|
messages = [
|
747
747
|
{'host' => '203.0.113.1', 'message' => 'invalid ip'},
|
748
748
|
{'host' => '0', 'message' => 'invalid ip'},
|
749
|
-
{'host' => '
|
749
|
+
{'host' => '66.102.3.80', 'message' => 'google bot'}
|
750
750
|
]
|
751
751
|
expected = [
|
752
752
|
{'host' => '203.0.113.1', 'message' => 'invalid ip'},
|
753
753
|
{'host' => '0', 'message' => 'invalid ip'},
|
754
|
-
{'host' => '
|
755
|
-
'geoip_city' => 'Mountain View', 'geopoint' => [-122.
|
754
|
+
{'host' => '66.102.3.80', 'message' => 'google bot',
|
755
|
+
'geoip_city' => 'Mountain View', 'geopoint' => [-122.05740356445312, 37.4192008972168]}
|
756
756
|
]
|
757
757
|
filtered = filter(config, messages)
|
758
758
|
assert_equal(expected, filtered)
|
@@ -229,7 +229,7 @@ class GeoipOutputTest < Test::Unit::TestCase
|
|
229
229
|
# 203.0.113.1 is a test address described in RFC5737
|
230
230
|
d1.emit({'host' => '203.0.113.1', 'message' => 'invalid ip'})
|
231
231
|
d1.emit({'host' => '0', 'message' => 'invalid ip'})
|
232
|
-
d1.emit({'host' => '
|
232
|
+
d1.emit({'host' => '66.102.3.80', 'message' => 'google bot'})
|
233
233
|
end
|
234
234
|
emits = d1.emits
|
235
235
|
assert_equal 3, emits.length
|
@@ -240,7 +240,7 @@ class GeoipOutputTest < Test::Unit::TestCase
|
|
240
240
|
assert_equal nil, emits[1][2]['geoip_city']
|
241
241
|
assert_equal nil, emits[1][2]['geopoint']
|
242
242
|
assert_equal 'Mountain View', emits[2][2]['geoip_city']
|
243
|
-
assert_equal [-122.
|
243
|
+
assert_equal [-122.0574, 37.419200000000004], emits[2][2]['geopoint']
|
244
244
|
end
|
245
245
|
|
246
246
|
def test_emit_record_directive
|
@@ -523,7 +523,7 @@ class GeoipOutputTest < Test::Unit::TestCase
|
|
523
523
|
# 203.0.113.1 is a test address described in RFC5737
|
524
524
|
d1.emit({'host' => '203.0.113.1', 'message' => 'invalid ip'})
|
525
525
|
d1.emit({'host' => '0', 'message' => 'invalid ip'})
|
526
|
-
d1.emit({'host' => '
|
526
|
+
d1.emit({'host' => '66.102.3.80', 'message' => 'google bot'})
|
527
527
|
end
|
528
528
|
emits = d1.emits
|
529
529
|
assert_equal 3, emits.length
|
@@ -534,7 +534,7 @@ class GeoipOutputTest < Test::Unit::TestCase
|
|
534
534
|
assert_equal nil, emits[1][2]['geoip_city']
|
535
535
|
assert_equal nil, emits[1][2]['geopoint']
|
536
536
|
assert_equal 'Mountain View', emits[2][2]['geoip_city']
|
537
|
-
assert_equal [-122.
|
537
|
+
assert_equal [-122.0574, 37.419200000000004], emits[2][2]['geopoint']
|
538
538
|
end
|
539
539
|
|
540
540
|
def test_emit_record_directive
|
@@ -848,7 +848,7 @@ class GeoipOutputTest < Test::Unit::TestCase
|
|
848
848
|
# 203.0.113.1 is a test address described in RFC5737
|
849
849
|
d1.emit({'host' => '203.0.113.1', 'message' => 'invalid ip'})
|
850
850
|
d1.emit({'host' => '0', 'message' => 'invalid ip'})
|
851
|
-
d1.emit({'host' => '
|
851
|
+
d1.emit({'host' => '66.102.3.80', 'message' => 'google bot'})
|
852
852
|
end
|
853
853
|
emits = d1.emits
|
854
854
|
assert_equal 3, emits.length
|
@@ -859,7 +859,8 @@ class GeoipOutputTest < Test::Unit::TestCase
|
|
859
859
|
assert_equal nil, emits[1][2]['geoip_city']
|
860
860
|
assert_equal nil, emits[1][2]['geopoint']
|
861
861
|
assert_equal 'Mountain View', emits[2][2]['geoip_city']
|
862
|
-
assert_equal [-122.
|
862
|
+
assert_equal [-122.05740356445312, 37.4192008972168], emits[2][2]['geopoint']
|
863
|
+
|
863
864
|
end
|
864
865
|
|
865
866
|
def test_emit_multiple_key
|
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: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kentaro Yoshida
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -164,14 +164,21 @@ files:
|
|
164
164
|
- LICENSE
|
165
165
|
- README.md
|
166
166
|
- Rakefile
|
167
|
+
- data/COPYRIGHT.txt
|
168
|
+
- data/GeoLite2-City.mmdb
|
167
169
|
- data/GeoLiteCity.dat
|
170
|
+
- data/LICENSE.txt
|
171
|
+
- data/README.txt
|
168
172
|
- docker-compose.yml
|
169
173
|
- dockerfiles/Dockerfile-ruby2.1
|
170
174
|
- dockerfiles/Dockerfile-ruby2.2
|
171
175
|
- dockerfiles/Dockerfile-ruby2.3
|
172
176
|
- dockerfiles/Dockerfile-ruby2.4
|
173
177
|
- fluent-plugin-geoip.gemspec
|
174
|
-
- gemfiles/fluentd_v0.
|
178
|
+
- gemfiles/fluentd_v0.12_with_backport_dig.gemfile
|
179
|
+
- gemfiles/fluentd_v0.12_without_backport_dig.gemfile
|
180
|
+
- gemfiles/fluentd_v1.0_with_backport_dig.gemfile
|
181
|
+
- gemfiles/fluentd_v1.0_without_backport_dig.gemfile
|
175
182
|
- lib/fluent/plugin/filter_geoip.rb
|
176
183
|
- lib/fluent/plugin/geoip.rb
|
177
184
|
- lib/fluent/plugin/out_geoip.rb
|
@@ -198,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
205
|
version: '0'
|
199
206
|
requirements: []
|
200
207
|
rubyforge_project:
|
201
|
-
rubygems_version: 2.
|
208
|
+
rubygems_version: 2.6.13
|
202
209
|
signing_key:
|
203
210
|
specification_version: 4
|
204
211
|
summary: Fluentd Filter plugin to add information about geographical location of IP
|