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
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,19 @@ If you want to expire AWS credentials in certain interval, you should specify `r
</endpoint>
```

### Use OpenSearch Serverless

If you want to use Serverless version of OpenSearch service, you have to specify `aoss` in `aws_service_name` under `endpoint` section:

```aconf
<endpoint>
url https://CLUSTER_ENDPOINT_URL
region us-east-2
# ...
aws_service_name aoss # default is es that is for AWS OpenSearch Service not Serverless.
</endpoint>
```

## Troubleshooting

See [Troubleshooting document](README.Troubleshooting.md)
Expand Down
3 changes: 2 additions & 1 deletion lib/fluent/plugin/out_opensearch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def initialize(retry_stream)
config_param :assume_role_web_identity_token_file, :string, :default => nil
config_param :sts_credentials_region, :string, :default => nil
config_param :refresh_credentials_interval, :time, :default => "5h"
config_param :aws_service_name, :enum, list: [:es, :aoss], :default => :es
end

config_section :buffer do
Expand Down Expand Up @@ -622,7 +623,7 @@ def client(host = nil, compress_connection = false)
lambda do |f|
f.request(
:aws_sigv4,
service: 'es',
service: @endpoint.aws_service_name.to_s,
region: @endpoint.region,
credentials: @_aws_credentials,
)
Expand Down
33 changes: 33 additions & 0 deletions test/plugin/test_out_opensearch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,39 @@ def test_configure
assert_equal "fluentd", instance.endpoint.assume_role_session_name
assert_nil instance.endpoint.assume_role_web_identity_token_file
assert_nil instance.endpoint.sts_credentials_region
assert_equal :es, instance.endpoint.aws_service_name
end

data("OpenSearch Service" => [:es, 'es'],
"OpenSearch Serverless" => [:aoss, 'aoss'])
test 'configure endpoint section w/ aws_service_name' do |data|
expected, conf = data
config = Fluent::Config::Element.new(
'ROOT', '', {
'@type' => 'opensearch',
}, [
Fluent::Config::Element.new('endpoint', '', {
'url' => "https://search-opensearch.aws.example.com/",
'region' => "local",
'access_key_id' => 'YOUR_AWESOME_KEY',
'secret_access_key' => 'YOUR_AWESOME_SECRET',
'aws_service_name' => conf,
}, []),
Fluent::Config::Element.new('buffer', 'tag', {}, [])

])
instance = driver(config).instance

assert_equal "https://search-opensearch.aws.example.com", instance.endpoint.url
assert_equal "local", instance.endpoint.region
assert_equal "YOUR_AWESOME_KEY", instance.endpoint.access_key_id
assert_equal "YOUR_AWESOME_SECRET", instance.endpoint.secret_access_key
assert_nil instance.endpoint.assume_role_arn
assert_nil instance.endpoint.ecs_container_credentials_relative_uri
assert_equal "fluentd", instance.endpoint.assume_role_session_name
assert_nil instance.endpoint.assume_role_web_identity_token_file
assert_nil instance.endpoint.sts_credentials_region
assert_equal expected, instance.endpoint.aws_service_name
end

test 'configure compression' do
Expand Down