Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
Unit-test:
strategy:
matrix:
logstash: [ "7.16.3", "7.17.1" ]
logstash: [ "7.16.3", "7.17.1", "8.3.2" ]
name: Unit Test logstash-output-opensearch
runs-on: ubuntu-latest
env:
Expand All @@ -33,7 +33,7 @@ jobs:
Integration-Test-OpenSearch:
strategy:
matrix:
logstash: [ "7.16.3", "7.17.1" ]
logstash: [ "7.16.3", "7.17.1", "8.3.2" ]
opensearch: [ "1.2.1" ]
secure: [ true, false ]

Expand Down Expand Up @@ -78,4 +78,4 @@ jobs:

- name: Run Integration tests against OpenDistro-${{ matrix.opendistro }}-security-${{ matrix.secure }} for logstash ${{ matrix.logstash }}
run: |
./scripts/opendistro/docker-run.sh
./scripts/opendistro/docker-run.sh
13 changes: 8 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@
require "logstash/devutils/rake"

ECS_VERSIONS = {
v1: 'v1.5.0'
v1: 'v1.9.0'
}

ECS_LOGSTASH_INDEX_PATTERNS = %w(
ecs-logstash-*
)

task :'vendor-ecs-schemata' do
download_ecs_schema(:v1)
download_ecs_schema(:v1, 1)
download_ecs_schema(:v1, 2)
download_ecs_schema(:v1, 7)
end
task :vendor => :'vendor-ecs-schemata'

def download_ecs_schema(ecs_major_version)
def download_ecs_schema(ecs_major_version, opensearch_major_version)
$stderr.puts("Vendoring ECS #{ecs_major_version} template")
require 'net/http'
require 'json'
Expand All @@ -32,8 +34,9 @@ def download_ecs_schema(ecs_major_version)
fail "#{response.code} #{response.message}" unless (200...300).cover?(response.code.to_i)
template_directory = File.expand_path("../lib/logstash/outputs/opensearch/templates/ecs-#{ecs_major_version}", __FILE__)
Dir.mkdir(template_directory) unless File.exists?(template_directory)
File.open(File.join(template_directory, "/template.json"), "w") do |handle|
handle.write(replace_index_patterns(response.body, ECS_LOGSTASH_INDEX_PATTERNS))
template_file = File.join(template_directory, "/#{opensearch_major_version}x.json")
File.open(template_file, "w") do |handle|
handle.write(replace_index_patterns(response.body, ECS_LOGSTASH_INDEX_PATTERNS))
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/logstash/outputs/opensearch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class LogStash::Outputs::OpenSearch < LogStash::Outputs::Base
include(LogStash::PluginMixins::OpenSearch::Common)

# ecs_compatibility option, provided by Logstash core or the support adapter.
include(LogStash::PluginMixins::ECSCompatibilitySupport)
include(LogStash::PluginMixins::ECSCompatibilitySupport(:disabled, :v1, :v8))

# Generic/API config options that any document indexer output needs
include(LogStash::PluginMixins::OpenSearch::APIConfigs)
Expand Down Expand Up @@ -419,7 +419,7 @@ def setup_ecs_compatibility_related_defaults
when :disabled
@default_index = "logstash-%{+yyyy.MM.dd}"
@default_template_name = 'logstash'
when :v1
when :v1, :v8
@default_index = "ecs-logstash-%{+yyyy.MM.dd}"
@default_template_name = 'ecs-logstash'
else
Expand Down
Loading