Skip to content

Commit e443ac5

Browse files
authored
Merge pull request #76 from yaauie/ecs-v8
ecs: add v8 preview with v1 implementation
2 parents 40c8558 + 024fde2 commit e443ac5

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
## Unreleased
2-
- Fix: update to Gradle 7 [#75](https://github.com/logstash-plugins/logstash-filter-useragent/pull/75)
1+
## 3.3.2
2+
- Added preview of ECS-v8 support with existing ECS-v1 implementation [#76](https://github.com/logstash-plugins/logstash-filter-useragent/pull/76)
3+
- Internal: update to Gradle 7 [#75](https://github.com/logstash-plugins/logstash-filter-useragent/pull/75)
34

45
## 3.3.1
56
- Fix: invalid 3.3.0 release which did not package correctly [#71](https://github.com/logstash-plugins/logstash-filter-useragent/pull/71)

docs/index.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ filter plugins.
125125
* Value type is <<string,string>>
126126
* Supported values are:
127127
** `disabled`: does not use ECS-compatible field names (fields might be set at the root of the event)
128-
** `v1`: uses fields that are compatible with Elastic Common Schema (for example, `[user_agent][version]`)
128+
** `v1`, `v8`: uses fields that are compatible with Elastic Common Schema (for example, `[user_agent][version]`)
129129
* Default value depends on which version of Logstash is running:
130130
** When Logstash provides a `pipeline.ecs_compatibility` setting, its value is used as the default
131131
** Otherwise, the default value is `disabled`.

lib/logstash/filters/useragent.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# <https://github.com/tobie/ua-parser/>.
1515
class LogStash::Filters::UserAgent < LogStash::Filters::Base
1616

17-
include LogStash::PluginMixins::ECSCompatibilitySupport(:disabled, :v1)
17+
include LogStash::PluginMixins::ECSCompatibilitySupport(:disabled, :v1, :v8 => :v1)
1818

1919
config_name "useragent"
2020

logstash-filter-useragent.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
2222

2323
# Gem dependencies
2424
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
25-
s.add_runtime_dependency 'logstash-mixin-ecs_compatibility_support', '~> 1.1'
25+
s.add_runtime_dependency 'logstash-mixin-ecs_compatibility_support', '~> 1.3'
2626
s.add_development_dependency 'logstash-devutils'
2727
end
2828

spec/filters/useragent_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
let(:event) { LogStash::Event.new('message' => message) }
1414

1515
context 'with target', :ecs_compatibility_support do
16-
ecs_compatibility_matrix(:disabled, :v1) do |ecs_select|
16+
ecs_compatibility_matrix(:disabled, :v1, :v8 => :v1) do |ecs_select|
1717

1818
let(:ecs_compatibility?) { ecs_select.active_mode != :disabled }
1919

@@ -237,7 +237,7 @@
237237
end
238238

239239
context "manually specified regexes file", :ecs_compatibility_support do
240-
ecs_compatibility_matrix(:disabled, :v1) do |ecs_select|
240+
ecs_compatibility_matrix(:disabled, :v1, :v8 => :v1) do |ecs_select|
241241

242242
let(:ecs_compatibility?) { ecs_select.active_mode != :disabled }
243243

@@ -275,7 +275,7 @@
275275
end
276276

277277
context "without target field", :ecs_compatibility_support do
278-
ecs_compatibility_matrix(:disabled, :v1) do |ecs_select|
278+
ecs_compatibility_matrix(:disabled, :v1, :v8 => :v1) do |ecs_select|
279279

280280
let(:ecs_compatibility?) { ecs_select.active_mode != :disabled }
281281

@@ -310,7 +310,7 @@
310310
end
311311

312312
context "nested target field", :ecs_compatibility_support do
313-
ecs_compatibility_matrix(:disabled, :v1) do
313+
ecs_compatibility_matrix(:disabled, :v1, :v8 => :v1) do
314314

315315
before(:each) do
316316
allow_any_instance_of(described_class).to receive(:ecs_compatibility).and_return(ecs_compatibility)
@@ -337,7 +337,7 @@
337337
end
338338

339339
context "without user agent", :ecs_compatibility_support do
340-
ecs_compatibility_matrix(:disabled, :v1) do |ecs_select|
340+
ecs_compatibility_matrix(:disabled, :v1, :v8 => :v1) do |ecs_select|
341341

342342
let(:ecs_compatibility?) { ecs_select.active_mode != :disabled }
343343

@@ -383,7 +383,7 @@
383383
end
384384

385385
context "with prefix", :ecs_compatibility_support do
386-
ecs_compatibility_matrix(:disabled, :v1) do |ecs_select|
386+
ecs_compatibility_matrix(:disabled, :v1, :v8 => :v1) do |ecs_select|
387387

388388
let(:message) { 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0' }
389389
let(:options) { super().merge('prefix' => 'pre_') }
@@ -402,7 +402,7 @@
402402
end if ecs_select.active_mode == :disabled
403403

404404
it 'warns in ECS mode (and ignores prefix)' do
405-
expect( subject.logger ).to receive(:warn).with /Field prefix isn't supported in ECS compatibility mode/
405+
expect( subject.logger ).to receive(:warn).with %r{Field prefix isn't supported in ECS compatibility mode}
406406
subject.register
407407

408408
subject.filter(event)
@@ -416,7 +416,7 @@
416416
end
417417

418418
context "no prefix", :ecs_compatibility_support do
419-
ecs_compatibility_matrix(:disabled, :v1) do
419+
ecs_compatibility_matrix(:disabled, :v1, :v8 => :v1) do
420420

421421
let(:message) { 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0' }
422422

version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.3.1
1+
3.3.2

0 commit comments

Comments
 (0)