Skip to content

Commit

Permalink
Merge pull request #106 from adiforluls/aditya/ds-fix
Browse files Browse the repository at this point in the history
Check OS cluster for data streams and templates for index template creation
  • Loading branch information
cosmo0920 authored Jun 26, 2023
2 parents d50cda9 + 441b88a commit fcbf9c0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/fluent/plugin/out_opensearch_data_stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def validate_data_stream_parameters
def create_index_template(datastream_name, template_name, host = nil)
# Create index template from file
if @template_file
return if data_stream_exist?(datastream_name, host) or template_exists?(template_name, host)
template_installation_actual(template_name, @customize_template, @application_name, datastream_name, host)
else # Create default index template
return if data_stream_exist?(datastream_name, host) or template_exists?(template_name, host)
Expand Down Expand Up @@ -159,13 +160,10 @@ def write(chunk)
end
data_stream_name = extract_placeholders(@data_stream_name, chunk).downcase
data_stream_template_name = extract_placeholders(@data_stream_template_name, chunk).downcase
unless @data_stream_names.include?(data_stream_name)
begin
create_index_template(data_stream_name, data_stream_template_name, host)
@data_stream_names << data_stream_name
rescue => e
raise Fluent::ConfigError, "Failed to create data stream: <#{data_stream_name}> #{e.message}"
end
begin
create_index_template(data_stream_name, data_stream_template_name, host)
rescue => e
raise Fluent::ConfigError, "Failed to create data stream: <#{data_stream_name}> #{e.message}"
end
end

Expand Down

0 comments on commit fcbf9c0

Please sign in to comment.