fluent-plugin-geoblipper 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -4,6 +4,7 @@ A fluentd plugin to send a buffered list of lat/long pairs to pubnub.
4
4
  ## Configuration
5
5
  * **pubnub_channel** [*string*] Channel to publish to (**REQUIRED*)
6
6
  * **pubnub_publish_key** [*string*] Pubnub publishing key (**REQUIRED*)
7
+ * **pubnub_publish_key** [*string*] Pubnub subscription key (**REQUIRED*)
7
8
  * **geodata_location** [*string*] Absolute path to maxmind GeoIP database (**REQUIRED*)
8
9
  * **max_entries** [*integer*] Maximum number of lat/long pairs to publish at each flush
9
10
  * **ip_key** [*string*] Key to retrieve IP Address from each inbound record (*default: **ip***)
@@ -14,6 +15,7 @@ Example configuration:
14
15
  type geoblipper
15
16
  pubnub_channel something_good
16
17
  pubnub_publish_key pub-c-ABCDE-FGHIJK
18
+ pubnub_subscribe_key sub-c-ABCDE-FGHIJK
17
19
  geodata_location /etc/geo/GeoIPCity.dat
18
20
  max_entries 30
19
21
  ip_key host
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |gem|
3
3
  gem.name = "fluent-plugin-geoblipper"
4
- gem.version = "0.0.1"
4
+ gem.version = "0.0.2"
5
5
  gem.authors = ["Sean Dick", "Change.org"]
6
6
  gem.email = ["sean@change.org"]
7
7
  gem.homepage = "https://github.com/seanmdick/fluent-plugin-geoblipper"
@@ -9,6 +9,7 @@ class Fluent::GeoBlipperOutput < Fluent::BufferedOutput
9
9
 
10
10
  config_param :pubnub_channel, :string
11
11
  config_param :pubnub_publish_key, :string
12
+ config_param :pubnub_subscribe_key, :string
12
13
  config_param :geodata_location, :string
13
14
  config_param :max_entries, :integer, :default => -1
14
15
  config_param :ip_key, :string, :default => 'ip'
@@ -16,13 +17,14 @@ class Fluent::GeoBlipperOutput < Fluent::BufferedOutput
16
17
  def start
17
18
  super
18
19
  @geodata = GeoIP.new(@geodata_location)
19
- @pubnub = Pubnub.new( publish_key: @pubnub_publish_key )
20
+ @pubnub = Pubnub.new( publish_key: @pubnub_publish_key, subscribe_key: @pubnub_subscribe_key )
20
21
  end
21
22
 
22
23
  def format(tag, time, record)
23
24
  address = record[@ip_key]
24
25
  loc = @geodata.city(address)
25
- {latitude: loc.latitude, longitude: loc.longitude}.to_json + "\n"
26
+
27
+ {latitude: loc.latitude, longitude: loc.longitude}.to_json + "\n" if loc
26
28
  end
27
29
 
28
30
  def write(chunk)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-geoblipper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: