fluent-plugin-geoip-filter 0.1.1 → 0.2.0

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: 1aba0c3bcff83eb258fefad79cb5747a01cf3736
4
- data.tar.gz: f53204135786c2a818c3885b4215d3be959ba3ea
3
+ metadata.gz: 2be5dbe1e9076e891fdbfdc2041755e71b105396
4
+ data.tar.gz: 2d5127fcf908860c68a4b92b4ea465e966d1cf15
5
5
  SHA512:
6
- metadata.gz: 040891bdc87ac19ea736d8b0931fc0df543a161b168c8be995c1afb87f4f8f1cca1830e40d8930255fb80acb95a235768cabe04135d6a364dc367f71b6e9c436
7
- data.tar.gz: 560753360e05249d4609eaedfef3d9861dc530b5fec31b0a295e942803d6b1cb6c6fc2fd2f25a6888b2c39a0f2f3eabcafee26772fdb936f0f28ce96f62694de
6
+ metadata.gz: afde714742e31e2d8abb29ed99d7e1a18cab7831aed0d86d197dbaec2c38da0419cb3473acc5a7ffafc97fb773b9052e460171b9ea825443151e093ad3c97c58
7
+ data.tar.gz: 414414a72e6c48e158a389b4cca7a14419edb0b0b21e5a3c417a7213365aa7453bc896e99127d511d841246ba7c338e6d027445058ca5b6b5a02e3b7e5ca5cf0
data/README.md CHANGED
@@ -75,6 +75,18 @@ access.nginx: {
75
75
  join hashed data by '_'. default false.
76
76
 
77
77
 
78
+ ## VS.
79
+ [fluent-plugin-geoip](https://github.com/y-ken/fluent-plugin-geoip)
80
+ Fluentd output plugin to geolocate with geoip.
81
+ It is able to customize fields with placeholder.
82
+
83
+ * Easy to install.
84
+ * Not require to install Development Tools and geoip-dev library.
85
+ * ( fluent-plugin-geoip use geoip-c gem but our plugin use geoip. It's conflict. )
86
+ * 5-10 times faster by the LRU cache.
87
+ * See [benchmark](test/bench_geoip_filter.rb).
88
+
89
+
78
90
  ## TODO
79
91
 
80
92
  * patches welcome!
@@ -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-filter"
7
- spec.version = "0.1.1"
7
+ spec.version = "0.2.0"
8
8
  spec.authors = ["Yuri Umezaki"]
9
9
  spec.email = ["bungoume@gmail.com"]
10
10
  spec.homepage = "https://github.com/bungoume/fluent-plugin-geoip-filter"
@@ -6,7 +6,7 @@ module Fluent
6
6
  Plugin.register_filter('geoip', self)
7
7
 
8
8
  def initialize
9
- @geoip_cache = LruRedux::Cache.new(10000)
9
+ @geoip_cache = LruRedux::Cache.new(8192)
10
10
  super
11
11
  end
12
12
 
@@ -0,0 +1,44 @@
1
+ require_relative 'helper'
2
+ require 'fluent/plugin/filter_geoip'
3
+
4
+ # setup
5
+ Fluent::Test.setup
6
+ config = %[
7
+ @type geoip
8
+ out_key geo
9
+ ]
10
+ time = Time.now.to_i
11
+ tag = 'foo.bar'
12
+ driver = Fluent::Test::FilterTestDriver.new(Fluent::GeoipFilter, tag).configure(config, true)
13
+
14
+ # bench
15
+ require 'benchmark'
16
+ require 'ipaddr'
17
+ n = 100000
18
+ Benchmark.bm(7) do |x|
19
+ # 8192 random IP
20
+ x.report { driver.run { n.times { driver.emit({'client_ip' => IPAddr.new(rand(2**13)*2**19,Socket::AF_INET).to_s }, time) } } }
21
+ end
22
+
23
+
24
+ # Without LRU cache
25
+ # user system total real
26
+ # 11.410000 2.730000 14.140000 ( 15.431248)
27
+ # With LRU cache(8192) & random 1024 IP
28
+ # user system total real
29
+ # 1.250000 0.070000 1.320000 ( 1.322339)
30
+ # With LRU cache(8192) & random 8192 IP
31
+ # user system total real
32
+ # 1.890000 0.210000 2.100000 ( 2.102445)
33
+ # With LRU cache(8192) & random 16384 IP
34
+ # user system total real
35
+ # 8.450000 2.070000 10.520000 ( 12.170379)
36
+ # With LRU cache(8192) & random 65536 IP
37
+ # user system total real
38
+ # 11.890000 2.820000 14.710000 ( 16.051674)
39
+
40
+ # fluent-plugin-geoip
41
+ # (https://github.com/y-ken/fluent-plugin-geoip)
42
+ # user system total real
43
+ # 11.540000 0.270000 11.810000 ( 12.685000)
44
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-geoip-filter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuri Umezaki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-26 00:00:00.000000000 Z
11
+ date: 2016-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -111,6 +111,7 @@ files:
111
111
  - data/GeoLiteCity.dat
112
112
  - fluent-plugin-geoip-filter.gemspec
113
113
  - lib/fluent/plugin/filter_geoip.rb
114
+ - test/bench_geoip_filter.rb
114
115
  - test/helper.rb
115
116
  - test/plugin/test_filter_geoip.rb
116
117
  homepage: https://github.com/bungoume/fluent-plugin-geoip-filter
@@ -138,5 +139,6 @@ signing_key:
138
139
  specification_version: 4
139
140
  summary: Fluentd filter plugin to add geoip
140
141
  test_files:
142
+ - test/bench_geoip_filter.rb
141
143
  - test/helper.rb
142
144
  - test/plugin/test_filter_geoip.rb