fluent-plugin-qqwry 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fluent-plugin-qqwry.gemspec +2 -1
- data/lib/fluent/plugin/out_qqwry.rb +3 -2
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61d2a4ca5c4fd25a4d3c2747e056452f4e777c58
|
4
|
+
data.tar.gz: b41d0f0fcd94506d6d79d538d6f7b85678331777
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37ce14c2207e4e5360a96fb1c782f68ea341278577893e8c307c3d1bdcc4a24fc93ae0676042c2b40efc51dffed475cbc46793e4926352579b0dfe8b11b9f042
|
7
|
+
data.tar.gz: fa229efc868de9dc6a9764458d08a97ff717c1fa387fc007aa8ab832510352dfff9e9233a08fa65056cdd2abc5f9b11efd0547f181bce8afc2f50299ac2154fa
|
data/fluent-plugin-qqwry.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-qqwry"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.2"
|
8
8
|
spec.authors = ["Chris Song"]
|
9
9
|
spec.email = ["fakechris@gmail.com"]
|
10
10
|
spec.summary = %q{Fluentd Output plugin to add information about geographical location of IP addresses with QQWry databases.}
|
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_runtime_dependency "fluentd"
|
22
22
|
spec.add_runtime_dependency "fluent-mixin-rewrite-tag-name"
|
23
23
|
spec.add_runtime_dependency "qqwry"
|
24
|
+
spec.add_runtime_dependency "yajl"
|
24
25
|
end
|
@@ -6,7 +6,7 @@ class Fluent::QQWryOutput < Fluent::BufferedOutput
|
|
6
6
|
REGEXP_JSON = /(^[\[\{].+[\]\}]$|^[\d\.\-]+$)/
|
7
7
|
REGEXP_PLACEHOLDER_SINGLE = /^\$\{(?<qqwry_key>-?[^\[]+)\['(?<record_key>-?[^']+)'\]\}$/
|
8
8
|
REGEXP_PLACEHOLDER_SCAN = /(\$\{[^\}]+?\})/
|
9
|
-
QQWRY_KEYS = %w(
|
9
|
+
QQWRY_KEYS = %w(area country)
|
10
10
|
|
11
11
|
config_param :qqwry_database, :string, :default => File.dirname(__FILE__) + '/../../../data/qqwry.dat'
|
12
12
|
config_param :qqwry_lookup_key, :string, :default => 'host'
|
@@ -29,6 +29,7 @@ class Fluent::QQWryOutput < Fluent::BufferedOutput
|
|
29
29
|
|
30
30
|
def initialize
|
31
31
|
require 'qqwry'
|
32
|
+
require 'yajl'
|
32
33
|
|
33
34
|
super
|
34
35
|
end
|
@@ -159,7 +160,7 @@ class Fluent::QQWryOutput < Fluent::BufferedOutput
|
|
159
160
|
@placeholder_keys.each do |placeholder_key|
|
160
161
|
position = placeholder_key.match(REGEXP_PLACEHOLDER_SINGLE)
|
161
162
|
next if position.nil? or geodata[position[:record_key]].nil?
|
162
|
-
placeholder.store(placeholder_key, geodata[position[:record_key]]
|
163
|
+
placeholder.store(placeholder_key, geodata[position[:record_key]].send(position[:qqwry_key].to_sym))
|
163
164
|
end
|
164
165
|
return placeholder
|
165
166
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-qqwry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Song
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yajl
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description:
|
84
98
|
email:
|
85
99
|
- fakechris@gmail.com
|