logstash-filter-handsetdetection 4.1.2 → 4.1.3
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 +4 -4
- data/lib/logstash/filters/handsetdetection.rb +32 -20
- data/logstash-filter-handsetdetection.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24c67374749607214c60d923de19be1130a0cfa6
|
4
|
+
data.tar.gz: 580f87ef49a41de07e47a304ba44580e870d607c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47b3c2575b70403e03dd83766d77b5965bce7eea9efafcb356015c96018a02c5b0f2447a0b50209899887afbe25f2bb05fccd9b1018dfed0748b5012e1f2bc4d
|
7
|
+
data.tar.gz: 0844e175a6b48d6e6c13672a58f3abc5f704c9f5ec9ec2ac6c9b66c53b1ffb746d062f2ae3d9423fcba64627c1f5f93ba656e52178a23bb9a952959ac81899bb
|
@@ -27,6 +27,8 @@
|
|
27
27
|
require 'logstash/filters/base'
|
28
28
|
require 'logstash/namespace'
|
29
29
|
require 'handset_detection'
|
30
|
+
require 'thread_safe'
|
31
|
+
|
30
32
|
|
31
33
|
class LogStash::Filters::HandsetDetection < LogStash::Filters::Base
|
32
34
|
|
@@ -44,6 +46,7 @@ class LogStash::Filters::HandsetDetection < LogStash::Filters::Base
|
|
44
46
|
config :proxy_port, :validate => :number, :default => 3128
|
45
47
|
config :proxy_user, :validate => :string, :default => ''
|
46
48
|
config :proxy_pass, :validate => :string, :default => ''
|
49
|
+
config :log_unknown, :validate => :boolean, :default => true
|
47
50
|
config :local_archive_source, :validate => :string, :default => nil
|
48
51
|
|
49
52
|
public
|
@@ -66,10 +69,10 @@ class LogStash::Filters::HandsetDetection < LogStash::Filters::Base
|
|
66
69
|
@hd_config['proxy_user'] = @proxy_user
|
67
70
|
@hd_config['proxy_pass'] = @proxy_pass
|
68
71
|
@hd_config['retries'] = 3
|
69
|
-
@hd_config['log_unknown'] =
|
72
|
+
@hd_config['log_unknown'] = @log_unknown
|
70
73
|
@hd_config['local_archive_source'] = @local_archive_source
|
71
74
|
|
72
|
-
@@pool =
|
75
|
+
@@pool = ThreadSafe::Array.new
|
73
76
|
unless @online_api
|
74
77
|
hd = HD4.new @hd_config
|
75
78
|
hd.set_timeout 500
|
@@ -87,25 +90,34 @@ class LogStash::Filters::HandsetDetection < LogStash::Filters::Base
|
|
87
90
|
data[dest] = event.get src
|
88
91
|
end
|
89
92
|
end
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
if @filter.empty?
|
100
|
-
event.set 'handset_specs', r['hd_specs']
|
101
|
-
else
|
102
|
-
event.set 'handset_specs', {}
|
103
|
-
@filter.each do |f|
|
104
|
-
if r['hd_specs'].key? f
|
105
|
-
event.set "[handset_specs][#{f}]", r['hd_specs'][f]
|
106
|
-
end
|
107
|
-
end
|
93
|
+
event.set 'handset_detection', {}
|
94
|
+
unless data.empty?
|
95
|
+
hd = @@pool.pop
|
96
|
+
hd = HD4.new @hd_config if hd.nil?
|
97
|
+
hd.device_detect data
|
98
|
+
r = hd.get_reply
|
99
|
+
@@pool << hd
|
100
|
+
if r.key? 'status'
|
101
|
+
event.set '[handset_detection][status]', r['status']
|
108
102
|
end
|
103
|
+
if r.key? 'message'
|
104
|
+
event.set '[handset_detection][message]', r['message']
|
105
|
+
end
|
106
|
+
if r.key? 'hd_specs'
|
107
|
+
if @filter.empty?
|
108
|
+
event.set '[handset_detection][specs]', r['hd_specs']
|
109
|
+
else
|
110
|
+
event.set '[handset_detection][specs]', {}
|
111
|
+
@filter.each do |f|
|
112
|
+
if r['hd_specs'].key? f
|
113
|
+
event.set "[handset_detection][specs][#{f}]", r['hd_specs'][f]
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
else
|
119
|
+
event.set '[handset_detection][status]', 299
|
120
|
+
event.set '[handset_detection][message]', 'Error : Missing Data'
|
109
121
|
end
|
110
122
|
filter_matched event
|
111
123
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-filter-handsetdetection'
|
3
|
-
s.version = '4.1.
|
3
|
+
s.version = '4.1.3'
|
4
4
|
s.licenses = ['MIT']
|
5
5
|
s.summary = "Handset Detection filter plugin for Logstash"
|
6
6
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|