logstash-filter-useragent 2.0.0 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -1
- data/lib/logstash/filters/useragent.rb +9 -2
- data/logstash-filter-useragent.gemspec +2 -2
- data/spec/filters/useragent_spec.rb +19 -0
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4c6b3521d7a68e56571955f9a465863f25f0596
|
4
|
+
data.tar.gz: 156e6d0cf1f7696320df510e874deb54888b7df7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e08330cbeb238a629e27b4eb2e818a12016cce46a8c12f753b26aa15a875678fd6d4f7665b749fd2003e775bb881649a936312a007b4aeb1b0c07bfceeadde5
|
7
|
+
data.tar.gz: 77be20477df6051ef236c225e9d278a4c436a34f71cb771c09aede78d53f8b1d6c87a5c6c8e1a706aa22d0027109d73c6b093475a22d8450b00a4430d70e4513
|
data/CHANGELOG.md
CHANGED
@@ -1,2 +1,9 @@
|
|
1
|
+
## 2.0.0
|
2
|
+
- Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
|
3
|
+
instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
|
4
|
+
- Dependency on logstash-core update to 2.0
|
5
|
+
|
6
|
+
* 2.0.1
|
7
|
+
- Add ability to replace source with target
|
1
8
|
* 1.1.0
|
2
|
-
- Add LRU cache
|
9
|
+
- Add LRU cache
|
@@ -78,7 +78,7 @@ class LogStash::Filters::UserAgent < LogStash::Filters::Base
|
|
78
78
|
|
79
79
|
public
|
80
80
|
def filter(event)
|
81
|
-
|
81
|
+
|
82
82
|
|
83
83
|
useragent = event[@source]
|
84
84
|
useragent = useragent.first if useragent.is_a? Array
|
@@ -92,7 +92,14 @@ class LogStash::Filters::UserAgent < LogStash::Filters::Base
|
|
92
92
|
|
93
93
|
return unless ua_data
|
94
94
|
|
95
|
-
|
95
|
+
if @target.nil?
|
96
|
+
target = event
|
97
|
+
elsif @target == @source
|
98
|
+
target = event[@source] = {}
|
99
|
+
else
|
100
|
+
target = event[@target] ||= {}
|
101
|
+
end
|
102
|
+
|
96
103
|
write_to_target(target, ua_data)
|
97
104
|
|
98
105
|
filter_matched(event)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-filter-useragent'
|
4
|
-
s.version = '2.0.
|
4
|
+
s.version = '2.0.2'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Parse user agent strings into structured data based on BrowserScope data"
|
7
7
|
s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
|
21
21
|
|
22
22
|
# Gem dependencies
|
23
|
-
s.add_runtime_dependency "logstash-core", "
|
23
|
+
s.add_runtime_dependency "logstash-core", ">= 2.0.0.snapshot", "< 3.0.0"
|
24
24
|
|
25
25
|
s.add_runtime_dependency 'user_agent_parser', ['>= 2.0.0']
|
26
26
|
s.add_runtime_dependency 'lru_redux', "~> 1.1.0"
|
@@ -87,4 +87,23 @@ describe LogStash::Filters::UserAgent do
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
90
|
+
|
91
|
+
describe "Replace source with target" do
|
92
|
+
config <<-CONFIG
|
93
|
+
filter {
|
94
|
+
useragent {
|
95
|
+
source => "message"
|
96
|
+
target => "message"
|
97
|
+
}
|
98
|
+
}
|
99
|
+
CONFIG
|
100
|
+
|
101
|
+
sample "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31" do
|
102
|
+
insist { subject }.include?("message")
|
103
|
+
insist { subject["message"]["name"] } == "Chrome"
|
104
|
+
insist { subject["message"]["os"] } == "Linux"
|
105
|
+
insist { subject["message"]["major"] } == "26"
|
106
|
+
insist { subject["message"]["minor"] } == "0"
|
107
|
+
end
|
108
|
+
end
|
90
109
|
end
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-useragent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
|
-
- -
|
16
|
+
- - '>='
|
17
17
|
- !ruby/object:Gem::Version
|
18
18
|
version: 2.0.0.snapshot
|
19
|
+
- - <
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.0.0
|
19
22
|
name: logstash-core
|
20
23
|
prerelease: false
|
21
24
|
type: :runtime
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 2.0.0.snapshot
|
30
|
+
- - <
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.0.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
requirement: !ruby/object:Gem::Requirement
|
29
35
|
requirements:
|