logstash-filter-handsetdetection 4.1.5 → 4.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/logstash/filters/handsetdetection.rb +21 -8
- data/logstash-filter-handsetdetection.gemspec +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62dc4e2101623ea269d793a59feb13604c229b77
|
4
|
+
data.tar.gz: dabde0a0b23eeae1512b0644b9d67a07421e512d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b4102c5d7a7bfaefe613dbe7c71a5e7cc3de956496c45c4fbba82d00ae8297abfd0572aff01ea482f65e05c1e66e6a9c79ca833d6f4fc0ae0a6947dc70de00b
|
7
|
+
data.tar.gz: fd4b92c23757ccb2deea8be24809f6a43015253b65026da712530ba93fe3b94fdc8efb67ebdf0fb97b6fe2bfc537ececc4eca14dda2eae5fe04fb9bdc3b2c461
|
data/README.md
CHANGED
@@ -21,7 +21,7 @@ Extract the User-Agent header from an Apache log with Grok, and then enrich the
|
|
21
21
|
username => "xxxxxxxxxx"
|
22
22
|
password => "xxxxxxxxxxxxxxxx"
|
23
23
|
site_id => 000000
|
24
|
-
|
24
|
+
detection_type => ultimate
|
25
25
|
match => {
|
26
26
|
"agent" => "user-agent"
|
27
27
|
}
|
@@ -36,10 +36,11 @@ Extract the User-Agent header from an Apache log with Grok, and then enrich the
|
|
36
36
|
|
37
37
|
| Field | Description | Default |
|
38
38
|
| --- | --- | --- |
|
39
|
-
| `
|
39
|
+
| `detection_type` | Set to `cloud` in order to do **online** lookups against the Handset Detection API. Set to `ultimate` to use Handset Detection **Ultimate Edition**. Set to `community` to use Handset Detection **Community Edition** | `cloud` |
|
40
40
|
| `username` | Your Handset Detection API username | |
|
41
41
|
| `password` | Your Handset Detection API password | |
|
42
42
|
| `site_id` | The Handset Detection API site ID to use | |
|
43
|
+
| `db_refresh_days` | How often to update the locally stored database, in days (for Handset Detection Ultimate Edition and Community Edition) | `10` |
|
43
44
|
| `match` | An associative array mapping input field names to header names used for handset detection. For example: Extract the `user-agent` header from the `agent` input field. | `{ "agent" => "user-agent" }` |
|
44
45
|
| `filter` | Optionally, define an array of the handset spec properties to be included in the output. By default, all properties are included in the output. | [] |
|
45
46
|
| `use_proxy` | Set to `true` if accessing the web through a proxy | `false` |
|
@@ -34,11 +34,12 @@ class LogStash::Filters::HandsetDetection < LogStash::Filters::Base
|
|
34
34
|
|
35
35
|
config_name 'handsetdetection'
|
36
36
|
|
37
|
-
config :
|
37
|
+
config :detection_type, :validate => :string, :default => 'cloud'
|
38
38
|
config :username, :validate => :string, :default => ''
|
39
39
|
config :password, :validate => :string, :default => ''
|
40
40
|
config :site_id, :validate => :number, :default => 0
|
41
41
|
config :apiserver, :validate => :string, :default => 'api.handsetdetection.com'
|
42
|
+
config :db_refresh_days, :validate => :number, :default => 10
|
42
43
|
config :match, :validate => :hash, :default => { 'agent' => 'user-agent' }
|
43
44
|
config :filter, :validate => :array, :default => []
|
44
45
|
config :use_proxy, :validate => :boolean, :default => false
|
@@ -47,6 +48,8 @@ class LogStash::Filters::HandsetDetection < LogStash::Filters::Base
|
|
47
48
|
config :proxy_user, :validate => :string, :default => ''
|
48
49
|
config :proxy_pass, :validate => :string, :default => ''
|
49
50
|
config :log_unknown, :validate => :boolean, :default => true
|
51
|
+
config :cache, :validate => :boolean, :default => true
|
52
|
+
config :cache_requests, :validate => :boolean, :default => false
|
50
53
|
config :local_archive_source, :validate => :string, :default => nil
|
51
54
|
|
52
55
|
public
|
@@ -55,12 +58,11 @@ class LogStash::Filters::HandsetDetection < LogStash::Filters::Base
|
|
55
58
|
@hd_config['username'] = @username
|
56
59
|
@hd_config['secret'] = @password
|
57
60
|
@hd_config['site_id'] = @site_id
|
58
|
-
@hd_config['use_local'] = @online_api ? false : true
|
59
61
|
@hd_config['filesdir'] = Dir.tmpdir
|
60
|
-
@hd_config['cache'] = {'none' => {}}
|
62
|
+
@hd_config['cache'] = @cache ? {'memory' => {'thread_safe' => true}} : {'none' => {}}
|
61
63
|
@hd_config['debug'] = false
|
62
64
|
@hd_config['api_server'] = @apiserver
|
63
|
-
@hd_config['cache_requests'] =
|
65
|
+
@hd_config['cache_requests'] = @cache_requests
|
64
66
|
@hd_config['geoip'] = true
|
65
67
|
@hd_config['timeout'] = 30
|
66
68
|
@hd_config['use_proxy'] = @use_proxy
|
@@ -73,12 +75,23 @@ class LogStash::Filters::HandsetDetection < LogStash::Filters::Base
|
|
73
75
|
@hd_config['local_archive_source'] = @local_archive_source
|
74
76
|
|
75
77
|
@@pool = ThreadSafe::Array.new
|
76
|
-
|
78
|
+
if @detection_type == 'ultimate' or @detection_type == 'community'
|
79
|
+
@hd_config['use_local'] = true
|
77
80
|
hd = HD4.new @hd_config
|
78
|
-
hd.
|
79
|
-
|
80
|
-
|
81
|
+
path = (@detection_type == 'ultimate') ? hd.device_get_zip_path : hd.community_get_zip_path
|
82
|
+
if !File.exist?(path) or (Time.now - File.mtime(path)) / (24 * 3600) > @db_refresh_days
|
83
|
+
hd.set_timeout 500
|
84
|
+
result = (@detection_type == 'ultimate') ? hd.device_fetch_archive : hd.community_fetch_archive
|
85
|
+
raise LogStash::Error, "Error downloading the Handset Detection database. (Original cause: \"#{hd.get_reply['message']}\") Please try again." unless result
|
86
|
+
hd.set_timeout 30
|
87
|
+
else
|
88
|
+
# Do not download the ZIP file.
|
89
|
+
end
|
81
90
|
@@pool << hd
|
91
|
+
elsif @detection_type == 'cloud'
|
92
|
+
@hd_config['use_local'] = false
|
93
|
+
else
|
94
|
+
raise LogStash::ConfigurationError, 'Detection_type should be one of: cloud, ultimate, community.'
|
82
95
|
end
|
83
96
|
end
|
84
97
|
|
@@ -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.6'
|
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"
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
# Gem dependencies
|
21
21
|
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
|
22
|
-
s.add_runtime_dependency "handset_detection", "~> 4.1", ">= 4.1.
|
22
|
+
s.add_runtime_dependency "handset_detection", "~> 4.1", ">= 4.1.6"
|
23
23
|
|
24
24
|
#s.add_development_dependency 'logstash-devutils'
|
25
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-handsetdetection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Handset Detection
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-core-plugin-api
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
version: '4.1'
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 4.1.
|
42
|
+
version: 4.1.6
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,7 +49,7 @@ dependencies:
|
|
49
49
|
version: '4.1'
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 4.1.
|
52
|
+
version: 4.1.6
|
53
53
|
description: This gem is a Logstash plugin required to be installed on top of the
|
54
54
|
Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
|
55
55
|
gem is not a stand-alone program
|