fluent-plugin-qqwry 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13b7b4e4a05362dd611e2ca9bd8d9cf1fb8fa5b5
4
- data.tar.gz: 811fcc85eaa7dae22545904f30f4687a2c11a152
3
+ metadata.gz: 61d2a4ca5c4fd25a4d3c2747e056452f4e777c58
4
+ data.tar.gz: b41d0f0fcd94506d6d79d538d6f7b85678331777
5
5
  SHA512:
6
- metadata.gz: 054d4542cb901f72524851855e6229cd52311580ab4cd5a9b75e88e1448ab4b11989f086239d6582061ef787d096179b0bce034e9b88f796d69dc1dea6de46e7
7
- data.tar.gz: 7ca2d977db399a85c87c1531a74d62a4fe23e42e6f49c67cc046c63f6bacf5dbcca58ece36d834db44954c0186967034cf2df13a70ed3ccf6c7bdd7e2c5ba61c
6
+ metadata.gz: 37ce14c2207e4e5360a96fb1c782f68ea341278577893e8c307c3d1bdcc4a24fc93ae0676042c2b40efc51dffed475cbc46793e4926352579b0dfe8b11b9f042
7
+ data.tar.gz: fa229efc868de9dc6a9764458d08a97ff717c1fa387fc007aa8ab832510352dfff9e9233a08fa65056cdd2abc5f9b11efd0547f181bce8afc2f50299ac2154fa
@@ -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.1"
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(city latitude longitude country_code3 country_code country_name dma_code area_code region)
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]][position[:qqwry_key].to_sym])
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.1
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-29 00:00:00.000000000 Z
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