-
Notifications
You must be signed in to change notification settings - Fork 306
Implement ECS Compatibility Mode #952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
yaauie
merged 6 commits into
logstash-plugins:master
from
yaauie:ecs-compatibility-mode
Jul 14, 2020
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7f5785d
noop: group-templates in prep for ecs-compatible additions
yaauie 2dacfcb
consistently use `Elasticsearch#maximum_seen_major_version`
yaauie 739d025
add ecs compatibility mode v1
yaauie cd86989
bump to 10.6.0
yaauie 03d6617
docs: ECS touchups
yaauie 9dd0b56
docs: ECS touchup
yaauie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,37 @@ | ||
require "logstash/devutils/rake" | ||
|
||
ECS_VERSIONS = { | ||
v1: 'v1.5.0' | ||
} | ||
|
||
ECS_LOGSTASH_INDEX_PATTERNS = %w( | ||
ecs-logstash-* | ||
) | ||
|
||
task :'vendor-ecs-schemata' do | ||
download_ecs_schema(:v1, 6) | ||
download_ecs_schema(:v1, 7) | ||
end | ||
task :vendor => :'vendor-ecs-schemata' | ||
|
||
def download_ecs_schema(ecs_major_version, es_major) | ||
$stderr.puts("Vendoring ECS #{ecs_major_version} template for Elasticsearch #{es_major}") | ||
require 'net/http' | ||
require 'json' | ||
Net::HTTP.start('raw.githubusercontent.com', :use_ssl => true) do |http| | ||
ecs_release_tag = ECS_VERSIONS.fetch(ecs_major_version) | ||
response = http.get("/elastic/ecs/#{ecs_release_tag}/generated/elasticsearch/#{es_major}/template.json") | ||
fail "#{response.code} #{response.message}" unless (200...300).cover?(response.code.to_i) | ||
template_directory = File.expand_path("../lib/logstash/outputs/elasticsearch/templates/ecs-#{ecs_major_version}", __FILE__) | ||
Dir.mkdir(template_directory) unless File.exists?(template_directory) | ||
File.open(File.join(template_directory, "/elasticsearch-#{es_major}x.json"), "w") do |handle| | ||
handle.write(replace_index_patterns(response.body, ECS_LOGSTASH_INDEX_PATTERNS)) | ||
end | ||
end | ||
end | ||
|
||
def replace_index_patterns(template_json, replacement_index_patterns) | ||
template_obj = JSON.load(template_json) | ||
template_obj.update('index_patterns' => replacement_index_patterns) | ||
JSON.pretty_generate(template_obj) | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.