fluent-plugin-filter-geoip 0.5.0 → 0.5.1

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: a5523f7842532f6fbcdbb0f53bfcfc6aeab71472
4
- data.tar.gz: 9a9b2fcc94bbdbb17dde860b8d2aac6b9cda64e8
3
+ metadata.gz: a2a57f588b7e2d42cbd09351534106951450cba7
4
+ data.tar.gz: 9bcad934b659525194d165664e06fa87196e9b11
5
5
  SHA512:
6
- metadata.gz: f6dd32a6bd3699dbbef1dfe2da3ba581e2b936ceef1f268583fa759b8d35521e8951193434b6ac563c41ecd995ec2f95ca1451feae220ae0bcd281aee0e87bcd
7
- data.tar.gz: 635c1a0fc6fdfcdff9120282fa43f17f9b0649b0653ac23a75b9114ab1ce859c3c8349c9549930b8b245d1939338e9b8695bb54aee97c7862e27cdf8b75eadbf
6
+ metadata.gz: ddb690229c803f1ada3479f9313bd325074eabc778698e5787cf2a494839a84ac2aac0358e03880ba381366c23db89738ba644fcc23b50982ec8f890170f1db5
7
+ data.tar.gz: adef0e6bac3b902ec836335de51d85f0c97f3911fa6f6a4fe36f0da6f2a4cbee7cfa97b764c6524dc353144598c07a0d3b2c1d140451bac3d1960c9548976582
data/README.md CHANGED
@@ -86,10 +86,10 @@ field_delimiter .
86
86
 
87
87
  ### flatten
88
88
 
89
- If true, to flatten the result using field_delimiter (default: true).
89
+ If true, to flatten the result using field_delimiter (default: false).
90
90
 
91
91
  ```
92
- flatten true
92
+ flatten false
93
93
  ```
94
94
 
95
95
  ### locale
@@ -192,10 +192,10 @@ connection_type true
192
192
  md5_path ./geoip/database/GeoLite2-City.md5
193
193
  database_path ./geoip/database/GeoLite2-City.mmdb
194
194
 
195
- lookup_field host
195
+ lookup_field clientip
196
196
  field_prefix geoip
197
197
  field_delimiter .
198
- flatten true
198
+ flatten false
199
199
 
200
200
  locale en
201
201
 
@@ -216,14 +216,7 @@ Assuming following inputs are coming:
216
216
 
217
217
  ```javascript
218
218
  {
219
- "host":"180.195.25.228",
220
- "user":"-",
221
- "method":"GET",
222
- "path":"/category/giftcards?from=20",
223
- "code":"200",
224
- "size":"63",
225
- "referer":"-",
226
- "agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0.1) Gecko/20100101 Firefox/9.0.1"
219
+ "clientip": "200.114.49.218"
227
220
  }
228
221
  ```
229
222
 
@@ -231,35 +224,38 @@ then output bocomes as belows:
231
224
 
232
225
  ```javascript
233
226
  {
234
- "host":"180.195.25.228",
235
- "user":"-",
236
- "method":"GET",
237
- "path":"/category/giftcards?from=20",
238
- "code":"200",
239
- "size":"63",
240
- "referer":"-",
241
- "agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0.1) Gecko/20100101 Firefox/9.0.1",
242
- "geoip.continent.code":"AS",
243
- "geoip.continent.geoname_id":6255147,
244
- "geoip.continent.name":"Asia",
245
- "geoip.country.geoname_id":1694008,
246
- "geoip.country.iso_code":"PH",
247
- "geoip.country.name":"Philippines",
248
- "geoip.city.geoname_id":1728893,
249
- "geoip.city.name":"Bagumbayan",
250
- "geoip.location.latitude":13.45,
251
- "geoip.location.longitude":123.6667,
252
- "geoip.location.time_zone":"Asia/Manila",
253
- "geoip.postal.code":"4513",
254
- "geoip.registered_country.geoname_id":1694008,
255
- "geoip.registered_country.iso_code":"PH",
256
- "geoip.registered_country.name":"Philippines",
257
- "geoip.subdivisions.0.geoname_id":7521310,
258
- "geoip.subdivisions.0.iso_code":"05",
259
- "geoip.subdivisions.0.name":"Bicol",
260
- "geoip.subdivisions.1.geoname_id":1731616,
261
- "geoip.subdivisions.1.iso_code":"ALB",
262
- "geoip.subdivisions.1.name":"Province of Albay",
227
+ "clientip": "200.114.49.218",
228
+ "geoip": {
229
+ "continent": {
230
+ "code": "SA",
231
+ "geoname_id": 6255150,
232
+ "name": "South America"
233
+ },
234
+ "country": {
235
+ "geoname_id": 3686110,
236
+ "iso_code": "CO",
237
+ "name": "Colombia"
238
+ },
239
+ "city": {
240
+ "geoname_id": 3674962,
241
+ "name": "Medellín"
242
+ },
243
+ "location": {
244
+ "latitude": 6.2518,
245
+ "longitude": -75.5636,
246
+ "time_zone": "America/Bogota"
247
+ },
248
+ "registered_country": {
249
+ "geoname_id": 3686110,
250
+ "iso_code": "CO",
251
+ "name": "Colombia"
252
+ },
253
+ "subdivisions": [{
254
+ "geoname_id": 3689815,
255
+ "iso_code": "ANT",
256
+ "name": "Antioquia"
257
+ }]
258
+ }
263
259
  }
264
260
  ```
265
261
 
@@ -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-filter-geoip"
7
- spec.version = "0.5.0"
7
+ spec.version = "0.5.1"
8
8
  spec.authors = ["Minoru Osuka"]
9
9
  spec.email = ["minoru.osuka@gmail.com"]
10
10
 
@@ -119,7 +119,11 @@ module Fluent
119
119
  end
120
120
 
121
121
  if geoip.found? then
122
- record.merge!({@output_field => {}})
122
+
123
+ unless @flatten then
124
+ record.merge!({@output_field => {}})
125
+ end
126
+
123
127
  if @continent then
124
128
  continent_hash = {}
125
129
 
@@ -348,7 +352,6 @@ module Fluent
348
352
  if @connection_type then
349
353
  unless geoip.connection_type.nil? then
350
354
  if @flatten then
351
- #record[[@output_field, 'connection_type'].join(@field_delimiter)] = geoip.connection_type
352
355
  record.merge!(to_flatten(geoip.connection_type, [@output_field, 'connection_type'], @field_delimiter))
353
356
  else
354
357
  record[@output_field].merge!({'connection_type' => geoip.connection_type})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-filter-geoip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minoru Osuka
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  requirements: []
131
131
  rubyforge_project:
132
- rubygems_version: 2.5.2
132
+ rubygems_version: 2.5.1
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: Fluent filter plugin for adding GeoIP data to record.