Skip to content

Commit 3217d2b

Browse files
committed
Update references
Update references to either use opensearch or remove link. Signed-off-by: Vijayan Balasubramanian <[email protected]>
1 parent e359936 commit 3217d2b

File tree

6 files changed

+38
-71
lines changed

6 files changed

+38
-71
lines changed

lib/logstash/outputs/opensearch.rb

Lines changed: 24 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,18 @@
1919
require "uri" # for escaping user input
2020
require "forwardable"
2121

22-
# .Compatibility Note
23-
# [NOTE]
24-
# ================================================================================
25-
# Starting with Elasticsearch 5.3, there's an {ref}modules-http.html[HTTP setting]
26-
# called `http.content_type.required`. If this option is set to `true`, and you
27-
# are using Logstash 2.4 through 5.2, you need to update the Elasticsearch output
28-
# plugin to version 6.2.5 or higher.
22+
# This plugin is the recommended method of storing logs in OpenSearch.
23+
# If you plan on using the OpenSearch Dashboards web interface, you'll want to use this output.
2924
#
30-
# ================================================================================
31-
#
32-
# This plugin is the recommended method of storing logs in Elasticsearch.
33-
# If you plan on using the Kibana web interface, you'll want to use this output.
34-
#
35-
# This output only speaks the HTTP protocol. HTTP is the preferred protocol for interacting with Elasticsearch as of Logstash 2.0.
25+
# This output only speaks the HTTP protocol. HTTP is the preferred protocol for interacting with OpenSearch.
3626
# We strongly encourage the use of HTTP over the node protocol for a number of reasons. HTTP is only marginally slower,
37-
# yet far easier to administer and work with. When using the HTTP protocol one may upgrade Elasticsearch versions without having
27+
# yet far easier to administer and work with. When using the HTTP protocol one may upgrade OpenSearch versions without having
3828
# to upgrade Logstash in lock-step.
3929
#
40-
# You can learn more about Elasticsearch at <https://www.elastic.co/products/elasticsearch>
41-
#
42-
# ==== Template management for Elasticsearch 5.x
43-
# Index template for this version (Logstash 5.0) has been changed to reflect Elasticsearch's mapping changes in version 5.0.
44-
# Most importantly, the subfield for string multi-fields has changed from `.raw` to `.keyword` to match ES default
45-
# behavior.
46-
#
47-
# ** Users installing ES 5.x and LS 5.x **
48-
# This change will not affect you and you will continue to use the ES defaults.
49-
#
50-
# ** Users upgrading from LS 2.x to LS 5.x with ES 5.x **
51-
# LS will not force upgrade the template, if `logstash` template already exists. This means you will still use
52-
# `.raw` for sub-fields coming from 2.x. If you choose to use the new template, you will have to reindex your data after
53-
# the new template is installed.
30+
# You can learn more about OpenSearch at <https://opensearch.org/>
5431
#
5532
# ==== Retry Policy
56-
#
57-
# The retry policy has changed significantly in the 2.2.0 release.
58-
# This plugin uses the Elasticsearch bulk API to optimize its imports into Elasticsearch. These requests may experience
33+
# This plugin uses the OpenSearch bulk API to optimize its imports into OpenSearch. These requests may experience
5934
# either partial or total failures.
6035
#
6136
# The following errors are retried infinitely:
@@ -65,7 +40,7 @@
6540
# - 503 (Service unavailable) errors
6641
#
6742
# NOTE: 409 exceptions are no longer retried. Please set a higher `retry_on_conflict` value if you experience 409 exceptions.
68-
# It is more performant for Elasticsearch to retry these exceptions than this plugin.
43+
# It is more performant for OpenSearch to retry these exceptions than this plugin.
6944
#
7045
# ==== Batch Sizes ====
7146
# This plugin attempts to send batches of events as a single request. However, if
@@ -84,12 +59,10 @@
8459
#
8560
# ==== HTTP Compression
8661
#
87-
# This plugin supports request and response compression. Response compression is enabled by default and
88-
# for Elasticsearch versions 5.0 and later, the user doesn't have to set any configs in Elasticsearch for
89-
# it to send back compressed response. For versions before 5.0, `http.compression` must be set to `true` in
90-
# Elasticsearch[https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-http.html#modules-http] to take advantage of response compression when using this plugin
62+
# This plugin supports request and response compression. Response compression is enabled by default,
63+
# the user doesn't have to set any configs in OpenSearch for it to send back compressed response.
9164
#
92-
# For requests compression, regardless of the Elasticsearch version, users have to enable `http_compression`
65+
# For requests compression, users have to enable `http_compression`
9366
# setting in their Logstash config file.
9467
#
9568
class LogStash::Outputs::OpenSearch < LogStash::Outputs::Base
@@ -118,12 +91,11 @@ class LogStash::Outputs::OpenSearch < LogStash::Outputs::Base
11891
# - delete: deletes a document by id (An id is required for this action)
11992
# - create: indexes a document, fails if a document by that id already exists in the index.
12093
# - update: updates a document by id. Update has a special case where you can upsert -- update a
121-
# document if not already present. See the `upsert` option. NOTE: This does not work and is not supported
122-
# in Elasticsearch 1.x. Please upgrade to ES 2.x or greater to use this feature with Logstash!
94+
# document if not already present. See the `upsert` option.
12395
# - A sprintf style string to change the action based on the content of the event. The value `%{[foo]}`
12496
# would use the foo field for the action
12597
#
126-
# For more details on actions, check out the http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html[Elasticsearch bulk API documentation]
98+
# For more details on actions, check out the https://docs-beta.opensearch.org/opensearch/rest-api/bulk/[OpenSearch bulk API documentation]
12799
config :action, :validate => :string, :default => "index"
128100

129101
# The index to write events to. This can be dynamic using the `%{foo}` syntax.
@@ -139,7 +111,7 @@ class LogStash::Outputs::OpenSearch < LogStash::Outputs::Base
139111
:validate => :string,
140112
:deprecated => "Document types are removed entirely. You should avoid this feature"
141113

142-
# From Logstash 1.3 onwards, a template is applied to Elasticsearch during
114+
# From Logstash 1.3 onwards, a template is applied to OpenSearch during
143115
# Logstash's startup if one with the name `template_name` does not already exist.
144116
# By default, the contents of this template is the default template for
145117
# `logstash-%{+YYYY.MM.dd}` which always matches indices based on the pattern
@@ -153,7 +125,7 @@ class LogStash::Outputs::OpenSearch < LogStash::Outputs::Base
153125
# API to apply your templates manually.
154126
config :manage_template, :validate => :boolean, :default => true
155127

156-
# This configuration option defines how the template is named inside Elasticsearch.
128+
# This configuration option defines how the template is named inside OpenSearch.
157129
# Note that if you have used the template management features and subsequently
158130
# change this, you will need to prune the old template manually, e.g.
159131
#
@@ -167,7 +139,7 @@ class LogStash::Outputs::OpenSearch < LogStash::Outputs::Base
167139
config :template, :validate => :path
168140

169141
# The template_overwrite option will always overwrite the indicated template
170-
# in Elasticsearch with either the one indicated by template or the included one.
142+
# in OpenSearch with either the one indicated by template or the included one.
171143
# This option is set to false by default. If you always want to stay up to date
172144
# with the template provided by Logstash, this option could be very useful to you.
173145
# Likewise, if you have your own template file managed by puppet, for example, and
@@ -179,12 +151,9 @@ class LogStash::Outputs::OpenSearch < LogStash::Outputs::Base
179151
config :template_overwrite, :validate => :boolean, :default => false
180152

181153
# The version to use for indexing. Use sprintf syntax like `%{my_version}` to use a field value here.
182-
# See https://www.elastic.co/blog/elasticsearch-versioning-support.
183154
config :version, :validate => :string
184155

185156
# The version_type to use for indexing.
186-
# See https://www.elastic.co/blog/elasticsearch-versioning-support.
187-
# See also https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#_version_types
188157
config :version_type, :validate => ["internal", 'external', "external_gt", "external_gte", "force"]
189158

190159
# A routing override to be applied to all processed events.
@@ -203,19 +172,19 @@ class LogStash::Outputs::OpenSearch < LogStash::Outputs::Base
203172
config :upsert, :validate => :string, :default => ""
204173

205174
# Enable `doc_as_upsert` for update mode.
206-
# Create a new document with source if `document_id` doesn't exist in Elasticsearch
175+
# Create a new document with source if `document_id` doesn't exist in OpenSearch
207176
config :doc_as_upsert, :validate => :boolean, :default => false
208177

209178
# Set script name for scripted update mode
210179
config :script, :validate => :string, :default => ""
211180

212181
# Define the type of script referenced by "script" variable
213182
# inline : "script" contains inline script
214-
# indexed : "script" contains the name of script directly indexed in elasticsearch
215-
# file : "script" contains the name of script stored in elasticseach's config directory
183+
# indexed : "script" contains the name of script directly indexed in opensearch
184+
# file : "script" contains the name of script stored in opensearch's config directory
216185
config :script_type, :validate => ["inline", 'indexed', "file"], :default => ["inline"]
217186

218-
# Set the language of the used script. If not set, this defaults to painless in ES 5.0
187+
# Set the language of the used script. If not set, this defaults to painless
219188
config :script_lang, :validate => :string, :default => "painless"
220189

221190
# Set variable name passed to script (scripted update)
@@ -224,9 +193,7 @@ class LogStash::Outputs::OpenSearch < LogStash::Outputs::Base
224193
# if enabled, script is in charge of creating non-existent document (scripted update)
225194
config :scripted_upsert, :validate => :boolean, :default => false
226195

227-
# The number of times Elasticsearch should internally retry an update/upserted document
228-
# See the https://www.elastic.co/guide/en/elasticsearch/guide/current/partial-updates.html[partial updates]
229-
# for more info
196+
# The number of times OpenSearch should internally retry an update/upserted document
230197
config :retry_on_conflict, :validate => :number, :default => 1
231198

232199
# Set which ingest pipeline you wish to execute for an event. You can also use event dependent configuration
@@ -248,7 +215,7 @@ def register
248215

249216
check_action_validity
250217

251-
@logger.info("New Elasticsearch output", :class => self.class.name, :hosts => @hosts.map(&:sanitized).map(&:to_s))
218+
@logger.info("New OpenSearch output", :class => self.class.name, :hosts => @hosts.map(&:sanitized).map(&:to_s))
252219

253220
@client = build_client
254221

@@ -274,7 +241,7 @@ def register
274241
@document_level_metrics = metric.namespace(:documents)
275242
end
276243

277-
# @override post-register when ES connection established
244+
# @override post-register when OpenSearch connection established
278245
def finish_register
279246
discover_cluster_uuid
280247
install_template
@@ -315,7 +282,7 @@ def wait_for_successful_connection
315282
status = @after_successful_connection_thread && @after_successful_connection_thread.value
316283
if status.is_a?(Exception) # check if thread 'halted' with an error
317284
# keep logging that something isn't right (from every #multi_receive)
318-
@logger.error "Elasticsearch setup did not complete normally, please review previously logged errors",
285+
@logger.error "OpenSearch setup did not complete normally, please review previously logged errors",
319286
message: status.message, exception: status.class
320287
else
321288
@after_successful_connection_done = nil # do not execute __method__ again if all went well
@@ -392,7 +359,7 @@ def common_event_params(event)
392359
value = event.sprintf(@pipeline)
393360
# convention: empty string equates to not using a pipeline
394361
# this is useful when using a field reference in the pipeline setting, e.g.
395-
# elasticsearch {
362+
# opensearch {
396363
# pipeline => "%{[@metadata][pipeline]}"
397364
# }
398365
params[:pipeline] = value unless value.empty?

lib/logstash/outputs/opensearch/http_client.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module LogStash; module Outputs; class OpenSearch;
1919
# there really isn't a good reason to configure it.
2020
#
2121
# The criteria used are:
22-
# 1. We need a number that's less than 100MiB because ES
22+
# 1. We need a number that's less than 100MiB because OpenSearch
2323
# won't accept bulks larger than that.
2424
# 2. It must be large enough to amortize the connection constant
2525
# across multiple requests.
@@ -424,7 +424,7 @@ def rollover_alias_put(alias_name, alias_definition)
424424
end
425425
end
426426

427-
# Build a bulk item for an elasticsearch update action
427+
# Build a bulk item for an opensearch update action
428428
def update_action_builder(args, source)
429429
args = args.clone()
430430
if args[:_script]

lib/logstash/outputs/opensearch/http_client_builder.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def self.build(logger, hosts, params)
9393

9494
raise(
9595
LogStash::ConfigurationError,
96-
"External versioning is not supported by the update action. See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html."
96+
"External versioning is not supported by the update action."
9797
) if params['action'] == 'update' and external_version_types.include?(params.fetch('version_type', ''))
9898

9999
# Update API setup
@@ -141,7 +141,7 @@ def self.setup_ssl(logger, params)
141141
end
142142
if !params["ssl_certificate_verification"]
143143
logger.warn [
144-
"** WARNING ** Detected UNSAFE options in elasticsearch output configuration!",
144+
"** WARNING ** Detected UNSAFE options in opensearch output configuration!",
145145
"** WARNING ** You have enabled encryption but DISABLED certificate verification.",
146146
"** WARNING ** To make sure your data is secure change :ssl_certificate_verification to true"
147147
].join("\n")

lib/logstash/plugin_mixins/opensearch/api_configs.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,13 @@ module APIConfigs
136136
:custom_headers => { :validate => :hash, :default => {} },
137137

138138
# Sets the host(s) of the remote instance. If given an array it will load balance requests across the hosts specified in the `hosts` parameter.
139-
# Remember the `http` protocol uses the http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-http.html#modules-http[http] address (eg. 9200, not 9300).
139+
# Remember the `http` protocol uses the http address (eg. 9200, not 9300).
140140
# `"127.0.0.1"`
141141
# `["127.0.0.1:9200","127.0.0.2:9200"]`
142142
# `["http://127.0.0.1"]`
143143
# `["https://127.0.0.1:9200"]`
144144
# `["https://127.0.0.1:9200/mypath"]` (If using a proxy on a subpath)
145-
# It is important to exclude http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-node.html[dedicated master nodes] from the `hosts` list
145+
# It is important to exclude dedicated master nodes from the `hosts` list
146146
# to prevent LS from sending bulk requests to the master nodes. So this parameter should only reference either data or client nodes in OpenSearch.
147147
#
148148
# Any special characters present in the URLs here MUST be URL escaped! This means `#` should be put in as `%23` for instance.

lib/logstash/plugin_mixins/opensearch/common.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def build_client
4141
def setup_hosts
4242
@hosts = Array(@hosts)
4343
if @hosts.empty?
44-
@logger.info("No 'host' set in elasticsearch output. Defaulting to localhost")
44+
@logger.info("No 'host' set in opensearch output. Defaulting to localhost")
4545
@hosts.replace(["localhost"])
4646
end
4747
end

spec/unit/outputs/opensearch_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
require "logstash/outputs/opensearch"
1515

1616
describe LogStash::Outputs::OpenSearch do
17-
subject(:elasticsearch_output_instance) { described_class.new(options) }
17+
subject(:opensearch_output_instance) { described_class.new(options) }
1818
let(:options) { {} }
1919
let(:maximum_seen_major_version) { [7].sample }
2020

@@ -331,12 +331,12 @@
331331
let(:logger_stub) { double("logger").as_null_object }
332332

333333
before(:each) do
334-
allow(elasticsearch_output_instance.client).to receive(:logger).and_return(logger_stub)
334+
allow(opensearch_output_instance.client).to receive(:logger).and_return(logger_stub)
335335

336-
allow(elasticsearch_output_instance.client).to receive(:bulk).and_call_original
336+
allow(opensearch_output_instance.client).to receive(:bulk).and_call_original
337337

338338
max_bytes = payload_size * 3 / 4 # ensure a failure first attempt
339-
allow(elasticsearch_output_instance.client.pool).to receive(:post) do |path, params, body|
339+
allow(opensearch_output_instance.client.pool).to receive(:post) do |path, params, body|
340340
if body.length > max_bytes
341341
max_bytes *= 2 # ensure a successful retry
342342
double("Response", :code => 413, :body => "")
@@ -347,13 +347,13 @@
347347
end
348348

349349
it 'retries the 413 until it goes away' do
350-
elasticsearch_output_instance.multi_receive([event])
350+
opensearch_output_instance.multi_receive([event])
351351

352-
expect(elasticsearch_output_instance.client).to have_received(:bulk).twice
352+
expect(opensearch_output_instance.client).to have_received(:bulk).twice
353353
end
354354

355355
it 'logs about payload quantity and size' do
356-
elasticsearch_output_instance.multi_receive([event])
356+
opensearch_output_instance.multi_receive([event])
357357

358358
expect(logger_stub).to have_received(:warn)
359359
.with(a_string_matching(/413 Payload Too Large/),

0 commit comments

Comments
 (0)