fluent-plugin-geoblipper 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.
- data/README.md +2 -0
- data/fluent-plugin-geoblipper.gemspec +1 -1
- data/lib/fluent/plugin/out_geoblipper.rb +4 -2
- metadata +1 -1
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.
|
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
|
-
|
26
|
+
|
27
|
+
{latitude: loc.latitude, longitude: loc.longitude}.to_json + "\n" if loc
|
26
28
|
end
|
27
29
|
|
28
30
|
def write(chunk)
|