logstash-filter-wurfl_device_detection 0.3.0
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 +7 -0
- data/Gemfile +12 -0
- data/README.md +119 -0
- data/VERSION +1 -0
- data/docs/index.asciidoc +130 -0
- data/lib/logstash-filter-wurfl_device_detection_jars.rb +5 -0
- data/lib/logstash/filters/wurfl_device_detection.rb +12 -0
- data/logstash-filter-wurfl_device_detection.gemspec +22 -0
- data/vendor/jar-dependencies/com/scientiamobile/logstash/logstash-filter-wurfl_device_detection/0.3.0/logstash-filter-wurfl_device_detection-0.3.0.jar +0 -0
- metadata +106 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 569f2d8ec0d6977801ef612c6576f8f9c5cffbb7e9af3ac790234c3ec67a4d27
|
4
|
+
data.tar.gz: f3550677c5062c336553b2e82923d81b3d7c9d71aaf46aaba5d3d2f1ad1e5e41
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 186f32f8eb0e9e6f4242d0920c374c3d51079788fabc6b3acce0b072e1aa7459aa8eb00d01bb4c8ae18909af607935e2c7de22b2b8f147dcd23327ac9a2a256f
|
7
|
+
data.tar.gz: 639d317c5b54920adf4cefea58276c78e861481ef81264e1544bba9b53c51c7f270ce3b09c16129bf2405f2ae6d44275829d1658a0b570f435cf3fce6a964ebb
|
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# AUTOGENERATED BY THE GRADLE SCRIPT. EDITS WILL BE OVERWRITTEN.
|
2
|
+
source 'https://rubygems.org'
|
3
|
+
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
|
7
|
+
use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
|
8
|
+
|
9
|
+
if Dir.exist?(logstash_path) && use_logstash_source
|
10
|
+
gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
|
11
|
+
gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
|
12
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
### WURFL Logstash plugin
|
2
|
+
|
3
|
+
This project contains a java plugin for Logstash that enriches a stream of data with device detection data obtained via WURFL Microservice.
|
4
|
+
|
5
|
+
This plugin requires Java 8+, Gradle 5.x or above and has been tested with Logstash 8.0.0 and 7.6.x
|
6
|
+
|
7
|
+
## Compile the project
|
8
|
+
|
9
|
+
From the root of the project do ` ./gradlew gem`
|
10
|
+
A file `logstash-filter-logstash_filter_wurfl_device_detection-x.y.z.gem`, where x.y.z version number
|
11
|
+
is the one defined in the `VERSION` file.
|
12
|
+
|
13
|
+
## Install the plugin on logstash
|
14
|
+
|
15
|
+
From the logstash installation `bin` directory execute
|
16
|
+
`./logstash-plugin install --local <plugin_project_home>/logstash-filter-logstash_filter_wurfl_device_detection-x.y.z.gem`
|
17
|
+
|
18
|
+
Please note that this plugin requires a `stdin` plugin as specified in the sample configuration file
|
19
|
+
`wurfl_filter.conf`; also note that the aforementioned file is a sample: you will want to create your own
|
20
|
+
production configuration file.
|
21
|
+
|
22
|
+
## Sample Logstash execution with WURFL device detection plugin - user-agent list file example
|
23
|
+
Scenario: we have a file with a list of user-agent strings. We want to output some device detection data for each input user-agent.
|
24
|
+
We can execute logstash sending the user-agent to its standard input via pipe, like this:
|
25
|
+
|
26
|
+
`head -n <number of user-agents to send> <path_to_user_agent_list> | ./logstash -f <path_to_configuration>.conf>`
|
27
|
+
|
28
|
+
In case you use the sample configuration in the file wurfl_filter.conf, you'll get an output like this:
|
29
|
+
|
30
|
+
```
|
31
|
+
{
|
32
|
+
"@timestamp" => 2020-03-10T15:50:19.917Z,
|
33
|
+
"message" => "Mozilla/5.0 (Linux; Android 5.1; DL718M Build/LMY47I) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Safari/537.36",
|
34
|
+
"@version" => "1",
|
35
|
+
"host" => "my-laptop",
|
36
|
+
"wurfl" => {
|
37
|
+
"form_factor" => "Tablet",
|
38
|
+
"brand_name" => "Digiland",
|
39
|
+
"wurfl_id" => "digiland_dl718m_ver1",
|
40
|
+
"model_name" => "DL718M"
|
41
|
+
}
|
42
|
+
```
|
43
|
+
|
44
|
+
### Example configuration 1 - Input file with a list of user-agent strings
|
45
|
+
|
46
|
+
```
|
47
|
+
input {
|
48
|
+
stdin { }
|
49
|
+
}
|
50
|
+
filter {
|
51
|
+
logstash_filter_wurfl_device_detection {
|
52
|
+
cache_size => 300000
|
53
|
+
inject_wurfl_id => true
|
54
|
+
inject_wurfl_info => false
|
55
|
+
inject_wurfl_api_version => false
|
56
|
+
static_capabilities => ["model_name", "brand_name"]
|
57
|
+
virtual_capabilities => ["form_factor"]
|
58
|
+
scheme => "http"
|
59
|
+
host => "localhost"
|
60
|
+
port => "8080"
|
61
|
+
}
|
62
|
+
}
|
63
|
+
output {
|
64
|
+
stdout { codec => rubydebug }
|
65
|
+
}
|
66
|
+
```
|
67
|
+
|
68
|
+
## Sample Logstash execution with WURFL device detection plugin - header map received from HTTP input
|
69
|
+
Scenario: we configure logstash to receive HTTP request info which we want to enrich with WURFL data.
|
70
|
+
We execute logstash:
|
71
|
+
|
72
|
+
`./logstash -f <path_to_configuration>.conf>`
|
73
|
+
|
74
|
+
The input configuration for this file is defined in http input configuration, ie:
|
75
|
+
```
|
76
|
+
input {
|
77
|
+
http {
|
78
|
+
host => "0.0.0.0"
|
79
|
+
port => "19080"
|
80
|
+
}
|
81
|
+
}
|
82
|
+
filter {
|
83
|
+
logstash_filter_wurfl_device_detection {
|
84
|
+
source => "headers"
|
85
|
+
cache_size => 300000
|
86
|
+
inject_wurfl_id => true
|
87
|
+
inject_wurfl_info => false
|
88
|
+
inject_wurfl_api_version => false
|
89
|
+
scheme => "http"
|
90
|
+
host => "localhost"
|
91
|
+
port => "8080"
|
92
|
+
}
|
93
|
+
}
|
94
|
+
output {
|
95
|
+
stdout { codec => rubydebug }
|
96
|
+
}
|
97
|
+
```
|
98
|
+
|
99
|
+
The http input plugin receives an http request to the specified host and port, with a payload map that contains the HTTP headers
|
100
|
+
to be analyzed by the WURFL plugin.
|
101
|
+
Note that the `source` name is `headers`. Also note that you can configure the logstash input as you want,
|
102
|
+
but if you want the WURFL plugin to work with headers, you must configure it so that it uses an header map.
|
103
|
+
|
104
|
+
- `stdin` and `stdout` define which input and output plugin will be used: in the first scenario we use the standard input, in the second scenario
|
105
|
+
we use the HTTP input plugin, while in both scenarios we use the ruby debug console as output.
|
106
|
+
- `cache_size` (integer) is the size of the WURFL Microservice client cache. Defaults to 100000
|
107
|
+
- `inject_wurfl_id` defines whether `wurfl_id` will be added to enriched output (defaults to true)
|
108
|
+
- `inject_wurfl_info` defines whether `wurfl_info` will be added to enriched output (defaults to false)
|
109
|
+
- `inject_wurfl_api_version` defines whether `wurfl_api_version` will be added to enriched output (defaults to false)
|
110
|
+
- `static_capabilities` defines the list of static capabilities that you want to add to the enriched output (defaults to all)
|
111
|
+
- `virtual_capabilities` defines the list of virtual capabilities that you want to add to the enriched output (defaults to all)
|
112
|
+
- `scheme` defines the connection scheme to use to connect to WURFL Microservice server (currently only HTTP is supported)
|
113
|
+
- `host` host/ip address of the WURFL Microservice server (defaults to localhost)
|
114
|
+
- `port` port of the WURFL Microservice server (defaults to 80)
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.3.0
|
data/docs/index.asciidoc
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
:plugin: logstash_filter_wurfl_device_detection
|
2
|
+
:type: filter
|
3
|
+
|
4
|
+
///////////////////////////////////////////
|
5
|
+
START - GENERATED VARIABLES, DO NOT EDIT!
|
6
|
+
///////////////////////////////////////////
|
7
|
+
:version: %VERSION%
|
8
|
+
:release_date: %RELEASE_DATE%
|
9
|
+
:changelog_url: %CHANGELOG_URL%
|
10
|
+
:include_path: ../../../../logstash/docs/include
|
11
|
+
///////////////////////////////////////////
|
12
|
+
END - GENERATED VARIABLES, DO NOT EDIT!
|
13
|
+
///////////////////////////////////////////
|
14
|
+
|
15
|
+
[id="plugins-{type}s-{plugin}"]
|
16
|
+
|
17
|
+
=== WURFL device detection filter plugin
|
18
|
+
|
19
|
+
=== Description
|
20
|
+
|
21
|
+
The WURFL device detection filter adds information about a device's capabilities, using WURFL Microservice client.
|
22
|
+
|
23
|
+
[id="plugins-{type}s-{plugin}-options"]
|
24
|
+
==== WURFL device detection Filter Configuration Options
|
25
|
+
|
26
|
+
This plugin supports the following configuration options.
|
27
|
+
|
28
|
+
[cols="<,<,<",options="header",]
|
29
|
+
|=======================================================================
|
30
|
+
|Setting |Input type|Required
|
31
|
+
| <<plugins-{type}s-{plugin}-cache_size>> |<<number,number>>|No
|
32
|
+
| <<plugins-{type}s-{plugin}-inject_wurfl_id>> |<<boolean,boolean>>|No
|
33
|
+
| <<plugins-{type}s-{plugin}-inject_wurfl_info>> |<<boolean,boolean>>|No
|
34
|
+
| <<plugins-{type}s-{plugin}-inject_wurfl_api_version>> |<<boolean,boolean>>|No
|
35
|
+
| <<plugins-{type}s-{plugin}-source>> |<<string,string>>|Yes
|
36
|
+
| <<plugins-{type}s-{plugin}-static_capabilities>> |<<array,array>>|No
|
37
|
+
| <<plugins-{type}s-{plugin}-virtual_capabilities>> |<<array,array>>|No
|
38
|
+
| <<plugins-{type}s-{plugin}-scheme>> |<<array,array>>|No
|
39
|
+
| <<plugins-{type}s-{plugin}-host>> |<<array,array>>|No
|
40
|
+
| <<plugins-{type}s-{plugin}-port>> |<<array,array>>|No
|
41
|
+
|
42
|
+
|=======================================================================
|
43
|
+
|
44
|
+
Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
|
45
|
+
filter plugins.
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
[id="plugins-{type}s-{plugin}-cache_size"]
|
50
|
+
===== `cache_size`
|
51
|
+
|
52
|
+
* Value type is <<number,number>>
|
53
|
+
* Default value is `100000`
|
54
|
+
|
55
|
+
The size of WURFL Microservice client cache. If cache size is <= 0, default value will be used.
|
56
|
+
|
57
|
+
[id="plugins-{type}s-{plugin}-inject_wurfl_id"]
|
58
|
+
===== `inject_wurfl_id`
|
59
|
+
|
60
|
+
* Value type is <<boolean,boolean>>
|
61
|
+
* Default value is `false`
|
62
|
+
|
63
|
+
Defines whether `wurfl_id` string will be added to enriched output.
|
64
|
+
|
65
|
+
[id="plugins-{type}s-{plugin}-inject_wurfl_info"]
|
66
|
+
===== `inject_wurfl_info`
|
67
|
+
|
68
|
+
* Value type is <<boolean,boolean>>
|
69
|
+
* Default value is `false`
|
70
|
+
|
71
|
+
Defines whether `wurfl_info` string will be added to enriched output.
|
72
|
+
|
73
|
+
[id="plugins-{type}s-{plugin}-inject_wurfl_api_version"]
|
74
|
+
===== `inject_wurfl_api_version`
|
75
|
+
|
76
|
+
* Value type is <<boolean,boolean>>
|
77
|
+
* Default value is `false`
|
78
|
+
|
79
|
+
Defines whether `wurfl_api_version` will be added to enriched output.
|
80
|
+
|
81
|
+
[id="plugins-{type}s-{plugin}-source"]
|
82
|
+
===== `source`
|
83
|
+
|
84
|
+
* Value type is <<string,string>>
|
85
|
+
* Default value is empty list
|
86
|
+
|
87
|
+
The field used by the filter plugin to get data for device detection. If input data is made of simple user-agents sent one by one,
|
88
|
+
you can use the default value `"message"`, if the the input data is made of all HTTP headers, the source value must be `"headers"`.
|
89
|
+
|
90
|
+
[id="plugins-{type}s-{plugin}-static_capabilities"]
|
91
|
+
===== `static_capabilities`
|
92
|
+
|
93
|
+
* Value type is <<array,array>>
|
94
|
+
* Default value is empty array which means *detect all static capabilities*
|
95
|
+
|
96
|
+
A list of WURFL static capabilities that must be detected in order to be added to the output. Default value is empty array,
|
97
|
+
which means *detect all capabilities*.
|
98
|
+
|
99
|
+
[id="plugins-{type}s-{plugin}-virtual_capabilities"]
|
100
|
+
===== `virtual_capabilities`
|
101
|
+
|
102
|
+
* Value type is <<array,array>>
|
103
|
+
* Default value is empty array which means *detect all virtual capabilities*
|
104
|
+
|
105
|
+
A list of WURFL virtual capabilities that must be detected in order to be added to the output.
|
106
|
+
|
107
|
+
[id="plugins-{type}s-{plugin}-scheme"]
|
108
|
+
===== `scheme`
|
109
|
+
|
110
|
+
* Value type is <<string,string>>
|
111
|
+
* Default value is `"http"`
|
112
|
+
|
113
|
+
Scheme used to connect to your WURFL Microservice server instance
|
114
|
+
|
115
|
+
[id="plugins-{type}s-{plugin}-host"]
|
116
|
+
===== `host`
|
117
|
+
|
118
|
+
* Value type is <<string,string>>
|
119
|
+
* Default value is `"localhost"`
|
120
|
+
|
121
|
+
Host or IP address used to connect to your WURFL Microservice server instance
|
122
|
+
|
123
|
+
[id="plugins-{type}s-{plugin}-port"]
|
124
|
+
===== `port`
|
125
|
+
|
126
|
+
* Value type is <<string,string>>
|
127
|
+
* Default value is `"80"`
|
128
|
+
|
129
|
+
Port used to connect to your WURFL Microservice server instance
|
130
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# AUTOGENERATED BY THE GRADLE SCRIPT. EDITS WILL BE OVERWRITTEN.
|
2
|
+
# encoding: utf-8
|
3
|
+
require "logstash/filters/base"
|
4
|
+
require "logstash/namespace"
|
5
|
+
require "logstash-filter-wurfl_device_detection_jars"
|
6
|
+
require "java"
|
7
|
+
|
8
|
+
class LogStash::Filters::WurflDeviceDetection < LogStash::Filters::Base
|
9
|
+
config_name "wurfl_device_detection"
|
10
|
+
|
11
|
+
def self.javaClass() Java::com.scientiamobile.logstash.WurflDeviceDetection.java_class; end
|
12
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# AUTOGENERATED BY THE GRADLE SCRIPT. EDITS WILL BE OVERWRITTEN.
|
2
|
+
Gem::Specification.new do |s|
|
3
|
+
s.name = 'logstash-filter-wurfl_device_detection'
|
4
|
+
s.version = ::File.read('VERSION').split('\n').first
|
5
|
+
s.licenses = ['Apache-2.0']
|
6
|
+
s.summary = 'Filter that augments stream with WURFL device detection data'
|
7
|
+
s.description = 'This gem is a Logstash plugin that augments stream with WURFL device detection data and is 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'
|
8
|
+
s.authors = ['Elasticsearch']
|
9
|
+
s.email = ['info@elastic.co']
|
10
|
+
s.homepage = 'http://www.elastic.co/guide/en/logstash/current/index.html'
|
11
|
+
s.require_paths = ['lib', 'vendor/jar-dependencies']
|
12
|
+
|
13
|
+
s.files = Dir["lib/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "docs/**/*"]
|
14
|
+
|
15
|
+
# Special flag to let us know this is actually a logstash plugin
|
16
|
+
s.metadata = { 'logstash_plugin' => 'true', 'logstash_group' => 'filter', 'java_plugin' => 'true'}
|
17
|
+
|
18
|
+
# Gem dependencies
|
19
|
+
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
|
20
|
+
s.add_runtime_dependency 'jar-dependencies'
|
21
|
+
s.add_development_dependency 'logstash-devutils'
|
22
|
+
end
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: logstash-filter-wurfl_device_detection
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Elasticsearch
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ">="
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '1.60'
|
19
|
+
- - "<="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.99'
|
22
|
+
name: logstash-core-plugin-api
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.60'
|
30
|
+
- - "<="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.99'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
name: jar-dependencies
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
name: logstash-devutils
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
description: This gem is a Logstash plugin that augments stream with WURFL device
|
62
|
+
detection data and is required to be installed on top of the Logstash core pipeline
|
63
|
+
using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone
|
64
|
+
program
|
65
|
+
email:
|
66
|
+
- info@elastic.co
|
67
|
+
executables: []
|
68
|
+
extensions: []
|
69
|
+
extra_rdoc_files: []
|
70
|
+
files:
|
71
|
+
- Gemfile
|
72
|
+
- README.md
|
73
|
+
- VERSION
|
74
|
+
- docs/index.asciidoc
|
75
|
+
- lib/logstash-filter-wurfl_device_detection_jars.rb
|
76
|
+
- lib/logstash/filters/wurfl_device_detection.rb
|
77
|
+
- logstash-filter-wurfl_device_detection.gemspec
|
78
|
+
- vendor/jar-dependencies/com/scientiamobile/logstash/logstash-filter-wurfl_device_detection/0.3.0/logstash-filter-wurfl_device_detection-0.3.0.jar
|
79
|
+
homepage: http://www.elastic.co/guide/en/logstash/current/index.html
|
80
|
+
licenses:
|
81
|
+
- Apache-2.0
|
82
|
+
metadata:
|
83
|
+
logstash_plugin: 'true'
|
84
|
+
logstash_group: filter
|
85
|
+
java_plugin: 'true'
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
- vendor/jar-dependencies
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubygems_version: 3.0.6
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: Filter that augments stream with WURFL device detection data
|
106
|
+
test_files: []
|