logstash-filter-useragent 2.0.8 → 3.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 191fb843494af5cd723d3fd0eac22361e8ad75b4
4
- data.tar.gz: 8151e35d06866286783c90508e65952b912cb23b
3
+ metadata.gz: 598bbd9355cf951cd710c2b09fadc85853f26522
4
+ data.tar.gz: 767669dbe7e9824374f47c99d24a4e776d0dc96c
5
5
  SHA512:
6
- metadata.gz: 0af80cfb030c6c36e2e80c97f35141124ec9d334675639762a75ed124b005e7a722993f772ed1beb4ca3f8ac0605797b6a5d5300f9a07658db5934df213e512c
7
- data.tar.gz: 4ab2b64d9b46e29209e1540bc4ab8f591da93b780ba8ffde43d78d6b45ffe862dbdba4799f1af016ba7973a37394bf2ea0d4e3ac5f8a1a5a74f9b911a117555c
6
+ metadata.gz: aecb151986072624ead48ca4fd894a5161ad9513a3c36751fe97db8347129ef3f889a9902bcdcdc25230182890ae4c9499ebae08e2b776120609abf1abe8cab2
7
+ data.tar.gz: 6d4af28f0a412d5765a6723689d02f760f5a2aa4e649ae1acc0a2f2064884612a93250572a322e5e405a6bea6cb6d577cf1bd8660d180deba9b23f789defff0c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ ## 3.0.0
2
+ - Update the plugin to the version 2.0 of the plugin api, this change is required for Logstash 5.0 compatibility. See https://github.com/elastic/logstash/issues/5141
1
3
  # 2.0.8
2
4
  - Revert addition of Mutex. This plugin now depends on jruby having threadsafe regexps
3
5
  # 2.0.7
data/Gemfile CHANGED
@@ -1,2 +1,4 @@
1
1
  source 'https://rubygems.org'
2
- gemspec
2
+
3
+ # Specify your gem's dependencies in logstash-mass_effect.gemspec
4
+ gemspec
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012–2015 Elasticsearch <http://www.elastic.co>
1
+ Copyright (c) 2012–2016 Elasticsearch <http://www.elastic.co>
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Logstash Plugin
2
2
 
3
- [![Build Status](https://travis-ci.org/logstash-plugins/logstash-filter-useragent.svg?branch=master)](https://travis-ci.org/logstash-plugins/logstash-filter-useragent)
3
+ [![Travis Build Status](https://travis-ci.org/logstash-plugins/logstash-filter-useragent.svg)](https://travis-ci.org/logstash-plugins/logstash-filter-useragent)
4
4
 
5
5
  This is a plugin for [Logstash](https://github.com/elastic/logstash).
6
6
 
@@ -55,7 +55,12 @@ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
55
55
  ```
56
56
  - Install plugin
57
57
  ```sh
58
+ # Logstash 2.3 and higher
59
+ bin/logstash-plugin install --no-verify
60
+
61
+ # Prior to Logstash 2.3
58
62
  bin/plugin install --no-verify
63
+
59
64
  ```
60
65
  - Run Logstash with your plugin
61
66
  ```sh
@@ -73,7 +78,12 @@ gem build logstash-filter-awesome.gemspec
73
78
  ```
74
79
  - Install the plugin from the Logstash home
75
80
  ```sh
76
- bin/plugin install /your/local/plugin/logstash-filter-awesome.gem
81
+ # Logstash 2.3 and higher
82
+ bin/logstash-plugin install --no-verify
83
+
84
+ # Prior to Logstash 2.3
85
+ bin/plugin install --no-verify
86
+
77
87
  ```
78
88
  - Start Logstash and proceed to test the plugin
79
89
 
@@ -93,7 +93,7 @@ class LogStash::Filters::UserAgent < LogStash::Filters::Base
93
93
  end
94
94
 
95
95
  def filter(event)
96
- useragent = event[@source]
96
+ useragent = event.get(@source)
97
97
  useragent = useragent.first if useragent.is_a?(Array)
98
98
 
99
99
  return if useragent.nil? || useragent.empty?
@@ -135,7 +135,7 @@ class LogStash::Filters::UserAgent < LogStash::Filters::Base
135
135
  def set_fields(event, ua_data)
136
136
  # UserAgentParser outputs as US-ASCII.
137
137
 
138
- event[@prefixed_name] = ua_data.name.dup.force_encoding(Encoding::UTF_8)
138
+ event.set(@prefixed_name, ua_data.name.dup.force_encoding(Encoding::UTF_8))
139
139
 
140
140
  #OSX, Andriod and maybe iOS parse correctly, ua-agent parsing for Windows does not provide this level of detail
141
141
 
@@ -143,23 +143,23 @@ class LogStash::Filters::UserAgent < LogStash::Filters::Base
143
143
  # and corrupt the cache. See uap source here for details https://github.com/ua-parser/uap-ruby/tree/master/lib/user_agent_parser
144
144
  if (os = ua_data.os)
145
145
  # The OS is a rich object
146
- event[@prefixed_os] = ua_data.os.to_s.dup.force_encoding(Encoding::UTF_8)
147
- event[@prefixed_os_name] = os.name.dup.force_encoding(Encoding::UTF_8) if os.name
146
+ event.set(@prefixed_os, ua_data.os.to_s.dup.force_encoding(Encoding::UTF_8))
147
+ event.set(@prefixed_os_name, os.name.dup.force_encoding(Encoding::UTF_8)) if os.name
148
148
 
149
149
  # These are all strings
150
150
  if (os_version = os.version)
151
- event[@prefixed_os_major] = os_version.major.dup.force_encoding(Encoding::UTF_8) if os_version.major
152
- event[@prefixed_os_minor] = os_version.minor.dup.force_encoding(Encoding::UTF_8) if os_version.minor
151
+ event.set(@prefixed_os_major, os_version.major.dup.force_encoding(Encoding::UTF_8)) if os_version.major
152
+ event.set(@prefixed_os_minor, os_version.minor.dup.force_encoding(Encoding::UTF_8)) if os_version.minor
153
153
  end
154
154
  end
155
155
 
156
- event[@prefixed_device] = ua_data.device.to_s.dup.force_encoding(Encoding::UTF_8) if ua_data.device
156
+ event.set(@prefixed_device, ua_data.device.to_s.dup.force_encoding(Encoding::UTF_8)) if ua_data.device
157
157
 
158
158
  if (ua_version = ua_data.version)
159
- event[@prefixed_major] = ua_version.major.dup.force_encoding(Encoding::UTF_8) if ua_version.major
160
- event[@prefixed_minor] = ua_version.minor.dup.force_encoding(Encoding::UTF_8) if ua_version.minor
161
- event[@prefixed_patch] = ua_version.patch.dup.force_encoding(Encoding::UTF_8) if ua_version.patch
162
- event[@prefixed_build] = ua_version.patch_minor.dup.force_encoding(Encoding::UTF_8) if ua_version.patch_minor
159
+ event.set(@prefixed_major, ua_version.major.dup.force_encoding(Encoding::UTF_8)) if ua_version.major
160
+ event.set(@prefixed_minor, ua_version.minor.dup.force_encoding(Encoding::UTF_8)) if ua_version.minor
161
+ event.set(@prefixed_patch, ua_version.patch.dup.force_encoding(Encoding::UTF_8)) if ua_version.patch
162
+ event.set(@prefixed_build, ua_version.patch_minor.dup.force_encoding(Encoding::UTF_8)) if ua_version.patch_minor
163
163
  end
164
164
  end
165
165
  end
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-useragent'
4
- s.version = '2.0.8'
4
+ s.version = '3.0.0'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Parse user agent strings into structured data based on BrowserScope data"
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"
7
+ 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"
8
8
  s.authors = ["Elastic"]
9
9
  s.email = 'info@elastic.co'
10
10
  s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
@@ -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-plugin-api", "~> 1.0"
23
+ s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.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"
@@ -17,10 +17,10 @@ describe LogStash::Filters::UserAgent do
17
17
 
18
18
  sample "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31" do
19
19
  insist { subject }.include?("ua")
20
- insist { subject["ua"]["name"] } == "Chrome"
21
- insist { subject["ua"]["os"] } == "Linux"
22
- insist { subject["ua"]["major"] } == "26"
23
- insist { subject["ua"]["minor"] } == "0"
20
+ insist { subject.get("[ua][name]") } == "Chrome"
21
+ insist { subject.get("[ua][os]") } == "Linux"
22
+ insist { subject.get("[ua][major]") } == "26"
23
+ insist { subject.get("[ua][minor]") } == "0"
24
24
  end
25
25
  end
26
26
 
@@ -34,10 +34,10 @@ describe LogStash::Filters::UserAgent do
34
34
  CONFIG
35
35
 
36
36
  sample "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31" do
37
- insist { subject["name"] } == "Chrome"
38
- insist { subject["os"] } == "Linux"
39
- insist { subject["major"] } == "26"
40
- insist { subject["minor"] } == "0"
37
+ insist { subject.get("name") } == "Chrome"
38
+ insist { subject.get("os") } == "Linux"
39
+ insist { subject.get("major") } == "26"
40
+ insist { subject.get("minor") } == "0"
41
41
  end
42
42
  end
43
43
 
@@ -91,7 +91,7 @@ describe LogStash::Filters::UserAgent do
91
91
  }.each do |field, uad_getter|
92
92
  context "for the #{field} field" do
93
93
  let(:value) {uad_getter.call(ua_data)}
94
- let(:target_field) { target[field]}
94
+ let(:target_field) { target.get(field)}
95
95
 
96
96
  it "should not have a nil value" do
97
97
  expect(target_field).to be_truthy
@@ -120,10 +120,10 @@ describe LogStash::Filters::UserAgent do
120
120
 
121
121
  sample "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31" do
122
122
  insist { subject.to_hash }.include?("message")
123
- insist { subject["message"]["name"] } == "Chrome"
124
- insist { subject["message"]["os"] } == "Linux"
125
- insist { subject["message"]["major"] } == "26"
126
- insist { subject["message"]["minor"] } == "0"
123
+ insist { subject.get("[message][name]") } == "Chrome"
124
+ insist { subject.get("[message][os]") } == "Linux"
125
+ insist { subject.get("[message][major]") } == "26"
126
+ insist { subject.get("[message][minor]") } == "0"
127
127
  end
128
128
  end
129
129
  end
metadata CHANGED
@@ -1,21 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-useragent
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.8
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-04 00:00:00.000000000 Z
11
+ date: 2016-05-06 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
- version: '1.0'
18
+ version: '2.0'
19
19
  name: logstash-core-plugin-api
20
20
  prerelease: false
21
21
  type: :runtime
@@ -23,7 +23,7 @@ dependencies:
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- 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
69
+ 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
70
70
  email: info@elastic.co
71
71
  executables: []
72
72
  extensions: []