fluent-plugin-gamobile 0.0.1 → 0.1.1
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 +13 -9
- data/fluent-plugin-gamobile.gemspec +1 -1
- data/lib/fluent/plugin/out_gamobile.rb +11 -2
- metadata +9 -9
data/README.md
CHANGED
@@ -40,17 +40,21 @@ Please setup "gem install fluent-plugin-rewrite-tag-filter" before trying this s
|
|
40
40
|
|
41
41
|
<match apache.access.robot>
|
42
42
|
type gamobile
|
43
|
-
ga_account
|
43
|
+
ga_account MO-12345678-1
|
44
|
+
# toggle logger mode
|
45
|
+
development yes # Optional (default: no)
|
44
46
|
# set UserVar from record
|
45
|
-
set_var
|
47
|
+
set_var agent # Optional
|
48
|
+
# treat same user these keys are same.
|
49
|
+
unique_ident_key host,agent # Optional
|
46
50
|
# mapping internal name with record
|
47
|
-
map_domain
|
48
|
-
map_remoteaddr
|
49
|
-
map_path
|
50
|
-
map_referer
|
51
|
-
map_useragent
|
52
|
-
map_guid
|
53
|
-
map_acceptlang
|
51
|
+
map_domain domain # Optional (default: domain)
|
52
|
+
map_remoteaddr host # Optional (default: host)
|
53
|
+
map_path path # Optional (default: path)
|
54
|
+
map_referer referer # Optional (default: referer)
|
55
|
+
map_useragent agent # Optional (default: agent)
|
56
|
+
map_guid guid # Optional (default: guid)
|
57
|
+
map_acceptlang lang # Optional (default: lang)
|
54
58
|
</match>
|
55
59
|
`````
|
56
60
|
|
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "fluent-plugin-gamobile"
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.1.1"
|
7
7
|
s.authors = ["Kentaro Yoshida"]
|
8
8
|
s.email = ["y.ken.studio@gmail.com"]
|
9
9
|
s.homepage = "https://github.com/y-ken/fluent-plugin-gamobile"
|
@@ -2,6 +2,7 @@ class Fluent::GamobileOutput < Fluent::Output
|
|
2
2
|
Fluent::Plugin.register_output('gamobile', self)
|
3
3
|
|
4
4
|
config_param :ga_account, :string
|
5
|
+
config_param :development, :string, :default => 'no'
|
5
6
|
config_param :set_var, :string, :default => nil
|
6
7
|
config_param :map_domain, :string, :default => 'domain'
|
7
8
|
config_param :map_remoteaddr, :string, :default => 'host'
|
@@ -10,6 +11,7 @@ class Fluent::GamobileOutput < Fluent::Output
|
|
10
11
|
config_param :map_useragent, :string, :default => 'agent'
|
11
12
|
config_param :map_guid, :string, :default => 'guid'
|
12
13
|
config_param :map_acceptlang, :string, :default => 'lang'
|
14
|
+
config_param :unique_ident_key, :string, :default => ''
|
13
15
|
|
14
16
|
def initialize
|
15
17
|
super
|
@@ -20,6 +22,10 @@ class Fluent::GamobileOutput < Fluent::Output
|
|
20
22
|
|
21
23
|
def configure(conf)
|
22
24
|
super
|
25
|
+
@ga_account = @ga_account.gsub('UA-', 'MO-') if @ga_account.include?('UA-')
|
26
|
+
@development = Fluent::Config.bool_value(@development) || false
|
27
|
+
@unique_ident_key = @unique_ident_key.split(',')
|
28
|
+
$log.info "gamobile: unique key with #{@unique_ident_key}"
|
23
29
|
end
|
24
30
|
|
25
31
|
def emit(tag, es, chain)
|
@@ -47,7 +53,10 @@ class Fluent::GamobileOutput < Fluent::Output
|
|
47
53
|
end
|
48
54
|
|
49
55
|
def get_visitor_id
|
50
|
-
if
|
56
|
+
if !@unique_ident_key.empty?
|
57
|
+
message = "#{@ga_account}"
|
58
|
+
@unique_ident_key.map {|key| message.concat("#{get_record(key)}")}
|
59
|
+
elsif get_record(@map_guid).blank?
|
51
60
|
message = "#{get_record(@map_useragent)}#{Digest::SHA1.hexdigest(rand.to_s)}#{Time.now.to_i}"
|
52
61
|
else
|
53
62
|
message = "#{get_record(@map_guid)}#{@ga_account}"
|
@@ -79,7 +88,7 @@ class Fluent::GamobileOutput < Fluent::Output
|
|
79
88
|
set_record(record)
|
80
89
|
begin
|
81
90
|
uri = build_query
|
82
|
-
$log.info "gamobile sending report: #{uri.to_s}"
|
91
|
+
$log.info "gamobile sending report: #{uri.to_s}" if @development
|
83
92
|
Net::HTTP.start(uri.host, uri.port) do |http|
|
84
93
|
http.get(uri.request_uri, {
|
85
94
|
"user_agent" => get_record(@map_useragent).to_s,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-gamobile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-10-20 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|
16
|
-
requirement: &
|
16
|
+
requirement: &18650860 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *18650860
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: fluentd
|
27
|
-
requirement: &
|
27
|
+
requirement: &18650420 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *18650420
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: active_support
|
38
|
-
requirement: &
|
38
|
+
requirement: &18650000 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *18650000
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: i18n
|
49
|
-
requirement: &
|
49
|
+
requirement: &18649580 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *18649580
|
58
58
|
description:
|
59
59
|
email:
|
60
60
|
- y.ken.studio@gmail.com
|