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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddffeef64ae000e5b97809024ad24998c26332a6
4
- data.tar.gz: fd389b27d85ce52bbae79719adfbcab77227d148
3
+ metadata.gz: e4c6b3521d7a68e56571955f9a465863f25f0596
4
+ data.tar.gz: 156e6d0cf1f7696320df510e874deb54888b7df7
5
5
  SHA512:
6
- metadata.gz: 93146ffee40b0608fd60e4e22cee78211537d6a3ee449f4d558ef0a21343119d73b788f49dba86dc58c4bb8e3f87934f146774cb53b8ecffba901a1a2f07455e
7
- data.tar.gz: 5bbf9f638160972f0eff16b50fd0e0063277381f1f58e75e0e7be390dbeeb3f764b92067f4bb7cccc2a99cd83a6c7abc08390ae25d731438d3288e744040c6a0
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
- return unless filter?(event)
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
- target = @target.nil? ? event : (event[@target] ||= {})
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.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", "~> 2.0.0.snapshot"
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.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-09-23 00:00:00.000000000 Z
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: