Bump ruby/setup-ruby from 1.298.0 to 1.299.0 (#170)
Bumps ruby/setup-ruby from 1.298.0 to 1.299.0.
updated-dependencies:
- dependency-name: ruby/setup-ruby dependency-version: 1.299.0 dependency-type: direct:production update-type: version-update:semver-minor …
Signed-off-by: dependabot[bot] support@github.com Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802032778号
Fluent::Plugin::OpenSearch, a plugin for Fluentd
Send your logs to OpenSearch (and search them with OpenSearch Dashboards maybe?)
Requirements
NOTE: Since fluent-plugin-opensearch 1.1.0, it requires faraday 2.0 or later.
NOTE: This documentation is for fluent-plugin-opensearch 1.x or later.
Installation
Usage
In your Fluentd configuration, use
@type opensearch. Additional configuration is optional, default values would look like this:NOTE:
type_nameparameter is fixed value and cannot change and configure from_docvalue for OpenSearch 1.Index templates
This plugin creates OpenSearch indices by merely writing to them. Consider using Index Templates to gain control of what get indexed and how.
Configuration
host
You can specify OpenSearch host by this parameter.
To use IPv6 address on
hostparameter, you can use the following styles:string style
To use string style, you must quote IPv6 address due to prevent to be interpreted as JSON:
raw style
You can also specify raw IPv6 address. This will be handled as
[specified IPv6 address]:port
You can specify OpenSearch port by this parameter.
emit_error_for_missing_id
When
write_operationis configured to anything other thenindex, setting this value totruewill cause the plugin toemit_error_eventof any records which do not include an_idfield. The default (false) behavior is to silently drop the records.hosts
You can specify multiple OpenSearch hosts with separator “,”.
If you specify multiple hosts, this plugin will load balance updates to OpenSearch. This is an opensearch-ruby feature, the default strategy is round-robin.
If you specify
hostsoption,hostandportoptions are ignored.If you specify
hostsoption without port,portoption is used.Note: If you will use scheme https, do not include “https://“ in your hosts ie. host “https://domain", this will cause ES cluster to be unreachable and you will receive an error “Can not reach OpenSearch cluster”
Note: Embedded the username/password in the URL syntax is not recommended to use because it was found to cause serious connection problems. Please do not use its style on your settings and use the
userandpasswordfield (described below) instead.IPv6 addresses
When you want to specify IPv6 addresses, you must specify schema together:
If you don’t specify hosts with schema together, OpenSearch plugin complains Invalid URI for them.
user, password, path, scheme, ssl_verify
You can specify user and password for HTTP Basic authentication.
And this plugin will escape required URL encoded characters within
%{}placeholders.Specify
ssl_verify falseto skip ssl verification (defaults to true)logstash_format
This is meant to make writing data into OpenSearch indices compatible to what Logstash calls them. By doing this, one could take advantage of Kibana. See logstash_prefix and logstash_dateformat to customize this index name pattern. The index name will be
#{logstash_prefix}-#{formatted_date}truewill ignore theindex_namesetting. The default index name prefix islogstash-.include_timestamp
Adds a
@timestampfield to the log, following all settingslogstash_formatdoes, except without the restrictions onindex_name. This allows one to log to an alias in OpenSearch and utilize the rollover API.logstash_prefix
logstash_prefix_separator
logstash_dateformat
The strftime format to generate index target index name when
logstash_formatis set to true. By default, the records are inserted into indexlogstash-YYYY.MM.DD. This option, alongwithlogstash_prefixlets us insert into specified index likemylogs-YYYYMMfor a monthly index.pipeline
This param is to set a pipeline id of your opensearch to be added into the request, you can configure ingest node.
time_key_format
The format of the time stamp field (
@timestampor what you specify with time_key). This parameter only has an effect when logstash_format is true as it only affects the name of the index we write to. Please see Time#strftime for information about the value of this format.Setting this to a known format can vastly improve your log ingestion speed if all most of your logs are in the same format. If there is an error parsing this format the timestamp will default to the ingestion time. You can get a further performance improvement by installing the “strptime” gem:
fluent-gem install strptime.For example to parse ISO8601 times with sub-second precision:
time_precision
Should the record not include a
time_key, define the degree of sub-second time precision to preserve from thetimeportion of the routed event.For example, should your input plugin not include a
time_keyin the record but it able to pass atimeto the router when emitting the event (AWS CloudWatch events are an example of this), then this setting will allow you to preserve the sub-second time resolution of those events. This is the case for: fluent-plugin-cloudwatch-ingest.time_key
By default, when inserting records in Logstash format,
@timestampis dynamically created with the time at log ingestion. If you’d like to use a custom time, include an@timestampwith your record.You can specify an option
time_key(like the option described in tail Input Plugin) to replace@timestampkey.Suppose you have settings
Your input is:
The output will be
See
time_key_exclude_timestampto avoid adding@timestamp.time_key_exclude_timestamp
By default, setting
time_keywill copy the value to an additional field@timestamp. When settingtime_key_exclude_timestamp true, no additional field will be added.utc_index
By default, the records inserted into index
logstash-YYMMDDwith UTC (Coordinated Universal Time). This option allows to use local time if you describe utc_index to false.suppress_type_name
If OpenSearch cluster complains types removal warnings, this can be suppressed with:
target_index_key
Tell this plugin to find the index name to write to in the record under this key in preference to other mechanisms. Key can be specified as path to nested record using dot (‘.’) as a separator.
If it is present in the record (and the value is non falsy) the value will be used as the index name to write to and then removed from the record before output; if it is not found then it will use logstash_format or index_name settings as configured.
Suppose you have the following settings
If your input is:
The output would be
and this record will be written to the specified index (
logstash-2014.12.19) rather thanfallback.target_type_key
Similar to
target_index_keyconfig, find the type name to write to in the record under this key (or nested record). If key not found in record - fallback totype_name(default “fluentd”).target_index_affinity
Enable plugin to dynamically select logstash time based target index in update/upsert operations based on already indexed data rather than current time of indexing.
By default plugin writes data of logstash format index based on current time. For example daily based index after mignight data is written to newly created index. This is normally ok when data is coming from single source and not updated after indexing.
But if you have a use case where data is also updated after indexing and
id_keyis used to identify the document uniquely for updating. Logstash format is wanted to be used for easy data managing and retention. Updates are done right after indexing to complete the data (all data not available from single source) and no updates are done anymore later point on time. In this case problem happends at index rotation time where write to 2 indexes with same id_key value may happen.This setting will search existing data by using elastic search’s id query using
id_keyvalue (with logstash_prefix and logstash_prefix_separator index pattarn e.g.logstash-*). The index of found data is used for update/upsert. When no data is found, data is written to current logstash index as normally.This setting requires following other settings:
Suppose you have the following situation where you have 2 different match to consume data from 2 different Kafka topics independently but close in time with each other (order not known).
If your first (data1) input is:
and your second (data2) input is:
Date today is 10.05.2021 so data is written to index
myindexprefix-2021.05.10when both data1 and data2 is consumed during today. But when we are close to index rotation and data1 is consumed and indexed at2021-05-10T23:59:55.59707672Zand data2 is consumed a bit later at2021-05-11T00:00:58.222079Zi.e. logstash index has been rotated and normally data2 would have been written to indexmyindexprefix-2021.05.11. But with target_index_affinity setting as value true, data2 is now written to indexmyindexprefix-2021.05.10into same document with data1 as wanted and duplicated document is avoided.template_name
The name of the template to define. If a template by the name given is already present, it will be left unchanged, unless template_overwrite is set, in which case the template will be updated.
This parameter along with template_file allow the plugin to behave similarly to Logstash (it installs a template at creation time) so that raw records are available. See https://github.com/uken/fluent-plugin-elasticsearch/issues/33.
template_file must also be specified.
template_file
The path to the file containing the template to install.
template_name must also be specified.
templates
Specify index templates in form of hash. Can contain multiple templates.
Note: Before ES plugin v4.1.2, if
template_fileandtemplate_nameare set, then this parameter will be ignored. In 4.1.3 or later,template_fileandtemplate_namecan work withtemplates.customize_template
Specify the string and its value to be replaced in form of hash. Can contain multiple key value pair that would be replaced in the specified template_file.
If template_file and template_name are set, then this parameter will be in effect otherwise ignored.
index_date_pattern
Specify this to override the index date pattern for creating a rollover index. The default is to use “now/d”, for example: <logstash-default-{now/d}-000001>. Overriding this changes the rollover time period. Setting “now/w{xxxx.ww}” would create weekly rollover indexes instead of daily.
If empty string(
"") is specified inindex_date_pattern, index date pattern is not used. OpenSearch plugin just creates <target_index-application_name-000001> rollover index instead of <target_index-application_name-{index_date_pattern}-000001>.If customize_template is set, then this parameter will be in effect otherwise ignored.
index_prefix
This parameter is marked as obsoleted.
application_name
Specify the application name for the rollover index to be created.
template_overwrite
Always update the template, even if it already exists.
One of template_file or templates must also be specified if this is set.
max_retry_putting_template
You can specify times of retry putting template.
This is useful when OpenSearch plugin cannot connect OpenSearch to put template. Usually, booting up clustered OpenSearch containers are much slower than launching Fluentd container.
fail_on_putting_template_retry_exceed
Indicates whether to fail when
max_retry_putting_templateis exceeded. If you have multiple output plugin, you could use this property to do not fail on fluentd statup.fail_on_detecting_os_version_retry_exceed
Indicates whether to fail when
max_retry_get_os_versionis exceeded. If you want to use fallback mechanism for obtaining OpenSearch version, you could use this property to do not fail on fluentd statup.And the following parameters should be working with:
max_retry_get_os_version
You can specify times of retry obtaining OpenSearch version.
This is useful when OpenSearch plugin cannot connect OpenSearch to obtain OpenSearch version. Usually, booting up clustered OpenSearch containers are much slower than launching Fluentd container.
request_timeout
You can specify HTTP request timeout.
This is useful when OpenSearch cannot return response for bulk request within the default of 5 seconds.
reload_connections
You can tune how the opensearch-transport host reloading feature works. By default it will reload the host list from the server every 10,000th request to spread the load. This can be an issue if your OpenSearch cluster is behind a Reverse Proxy, as Fluentd process may not have direct network access to the OpenSearch nodes.
reload_on_failure
Indicates that the opensearch-transport will try to reload the nodes addresses if there is a failure while making the request, this can be useful to quickly remove a dead node from the list of addresses.
resurrect_after
You can set in the opensearch-transport how often dead connections from the opensearch-transport’s pool will be resurrected.
include_tag_key, tag_key
This will add the Fluentd tag in the JSON record. For instance, if you have a config like this:
The record inserted into OpenSearch would be
id_key
By default, all records inserted into OpenSearch get a random _id. This option allows to use a field in the record as an identifier.
This following record
{"name": "Johnny", "request_id": "87d89af7daffad6"}will trigger the following OpenSearch commandFluentd re-emits events that failed to be indexed/ingested in OpenSearch with a new and unique
_idvalue, this means that congested OpenSearch clusters that reject events (due to command queue overflow, for example) will cause Fluentd to re-emit the event with a new_id, however OpenSearch may actually process both (or more) attempts (with some delay) and create duplicate events in the index (since each have a unique_idvalue), one possible workaround is to use the fluent-plugin-genhashvalue plugin to generate a unique_hashkey in the record of each event, this_hashrecord can be used as theid_keyto prevent OpenSearch from creating duplicate events.Example configuration for fluent-plugin-genhashvalue (review the documentation of the plugin for more details)
Using nested key
Nested key specifying syntax is also supported.
With the following configuration
and the following nested record
will trigger the following OpenSearch command
parent_key
If your input is
OpenSearch command would be
if
parent_keyis not configed or theparent_keyis absent in input record, nothing will happen.Using nested key
Nested key specifying syntax is also supported.
With the following configuration
and the following nested record
will trigger the following OpenSearch command
routing_key
Similar to
parent_keyconfig, will add_routinginto opensearch command ifrouting_keyis set and the field does exist in input event.remove_keys
remove_keys_on_update
Remove keys on update will not update the configured keys in opensearch when a record is being updated. This setting only has any effect if the write operation is update or upsert.
If the write setting is upsert then these keys are only removed if the record is being updated, if the record does not exist (by id) then all of the keys are indexed.
remove_keys_on_update_key
This setting allows
remove_keys_on_updateto be configured with a key in each record, in much the same way astarget_index_keyworks. The configured key is removed before indexing in opensearch. If bothremove_keys_on_updateandremove_keys_on_update_keyis present in the record then the keys in record are used, if theremove_keys_on_update_keyis not present then the value ofremove_keys_on_updateis used as a fallback.retry_tag
This setting allows custom routing of messages in response to bulk request failures. The default behavior is to emit failed records using the same tag that was provided. When set to a value other then
nil, failed messages are emitted with the specified tag:NOTE:
retry_tagis optional. If you would rather use labels to reroute retries, add a label (e.g ‘@label @SOMELABEL’) to your fluent opensearch plugin configuration. Retry records are, by default, submitted for retry to the ROOT label, which means records will flow through your fluentd pipeline from the beginning. This may nor may not be a problem if the pipeline is idempotent - that is - you can process a record again with no changes. Use tagging or labeling to ensure your retry records are not processed again by your fluentd processing pipeline.write_operation
The write_operation can be any of:
Please note, id is required in create, update, and upsert scenario. Without id, the message will be dropped.
time_parse_error_tag
With
logstash_format true, opensearch plugin parses timestamp field for generating index name. If the record has invalid timestamp value, this plugin emits an error event to@ERRORlabel withtime_parse_error_tagconfigured tag.Default value is
opensearch_plugin.output.time.error. Note that this default values is quite different from Elasticsearch plugin.reconnect_on_error
Indicates that the plugin should reset connection on any error (reconnect on next send). By default it will reconnect only on “host unreachable exceptions”. We recommended to set this true in the presence of opensearch shield.
with_transporter_log
This is debugging purpose option to enable to obtain transporter layer log. Default value is
falsefor backward compatibility.We recommend to set this true if you start to debug this plugin.
content_type
With
content_type application/x-ndjson, opensearch plugin addsapplication/x-ndjsonasContent-Typein payload.Default value is
application/jsonwhich is default Content-Type of OpenSearch requests. If you will not use template, it recommends to setcontent_type application/x-ndjson.include_index_in_url
With this option set to true, Fluentd manifests the index name in the request URL (rather than in the request body). You can use this option to enforce an URL-based access control.
http_backend
With
http_backend typhoeus, opensearch plugin uses typhoeus faraday http backend. Typhoeus can handle HTTP keepalive.Default value is
exconwhich is default http_backend of opensearch plugin.http_backend_excon_nonblock
With
http_backend_excon_nonblock false, opensearch plugin use excon with nonblock=false. If you use opensearch plugin with jRuby for https, you may need to consider to setfalseto avoid follwoing problems.But for all other case, it strongly reccomend to set
trueto avoid process hangin problem reported in https://github.com/uken/fluent-plugin-elasticsearch/issues/732Default value is
true.compression_level
You can add gzip compression of output data. In this case
default_compression,best_compressionorbest speedoption should be chosen. By default there is no compression, default value for this option isno_compressionprefer_oj_serializer
With default behavior, OpenSearch client uses
Yajlas JSON encoder/decoder.Ojis the alternative high performance JSON encoder/decoder. When this parameter sets astrue, OpenSearch client usesOjas JSON encoder/decoder.Default value is
false.Client/host certificate options
Need to verify OpenSearch’s certificate? You can use the following parameter to specify a CA instead of using an environment variable.
Does your OpenSearch cluster want to verify client connections? You can specify the following parameters to use your client certificate, key, and key password for your connection.
If you want to configure SSL/TLS version, you can specify ssl_version parameter.
In OpenSearch plugin v4.0.2 with Ruby 2.5 or later combination, OpenSearch plugin also support
ssl_max_versionandssl_min_version.OpenSearch plugin will use TLSv1.2 as minimum ssl version and TLSv1.3 as maximum ssl version on transportation with TLS. Note that when they are used in Elastissearch plugin configuration,
ssl_versionis not used to set up TLS version.If they are not specified in the OpenSearch plugin configuration,
ssl_max_versionandssl_min_versionis set up with:In OpenSearch plugin v1.0.0 or later with Ruby 2.5 or later environment,
ssl_max_versionshould beTLSv1_3andssl_min_versionshould beTLSv1_2.Proxy Support
Starting with version 0.8.0, this gem uses excon, which supports proxy with environment variables - https://github.com/excon/excon#proxy-support
Buffer options
fluentd-plugin-opensearchextends Fluentd’s builtin Output plugin and usecompat_parametersplugin helper. It adds the following options:The value for option
buffer_chunk_limitshould not exceed valuehttp.max_content_lengthin your OpenSearch setup (by default it is 100mb).Note: If you use or evaluate Fluentd v0.14, you can use
<buffer>directive to specify buffer configuration, too. In more detail, please refer to the buffer configuration options for v0.14Note: If you use
disable_retry_limitin v0.12 orretry_foreverin v0.14 or later, please be careful to consume memory inexhaustibly.Hash flattening
OpenSearch will complain if you send object and concrete values to the same field. For example, you might have logs that look this, from different places:
{“people” => 100} {“people” => {“some” => “thing”}}
The second log line will be rejected by the OpenSearch parser because objects and concrete values can’t live in the same field. To combat this, you can enable hash flattening.
This will produce opensearch output that looks like this: {“people_some” => “thing”}
Note that the flattener does not deal with arrays at this time.
Generate Hash ID
By default, the fluentd opensearch plugin does not emit records with a _id field, leaving it to OpenSearch to generate a unique _id as the record is indexed. When an OpenSearch cluster is congested and begins to take longer to respond than the configured request_timeout, the fluentd opensearch plugin will re-send the same bulk request. Since OpenSearch can’t tell its actually the same request, all documents in the request are indexed again resulting in duplicate data. In certain scenarios, this can result in essentially and infinite loop generating multiple copies of the same data.
The bundled opensearch_genid filter can generate a unique _hash key for each record, this key may be passed to the id_key parameter in the opensearch plugin to communicate to OpenSearch the uniqueness of the requests so that duplicates will be rejected or simply replace the existing records. Here is a sample config:
Sniffer Class Name
The default Sniffer used by the
OpenSearch::Transportclass works well when Fluentd has a direct connection to all of the OpenSearch servers and can make effective use of the_nodesAPI. This doesn’t work well when Fluentd must connect through a load balancer or proxy. The parametersniffer_class_namegives you the ability to provide your own Sniffer class to implement whatever connection reload logic you require. In addition, there is a newFluent::Plugin::OpenSearchSimpleSnifferclass which reuses the hosts given in the configuration, which is typically the hostname of the load balancer or proxy. For example, a configuration like this would cause connections tologging-osto reload every 100 operations:Tips
The included sniffer class is not required
out_opensearch. You should tell Fluentd where the sniffer class exists.If you use td-agent, you must put the following lines into
TD_AGENT_DEFAULTfile:If you use Fluentd directly, you must pass the following lines as Fluentd command line option:
Selector Class Name
The default selector used by the
OpenSearch::Transportclass works well when Fluentd should behave round robin and random selector cases. This doesn’t work well when Fluentd should behave fallbacking from exhausted ES cluster to normal ES cluster. The parameterselector_class_namegives you the ability to provide your own Selector class to implement whatever selection nodes logic you require.The below configuration is using plugin built-in
OpenSearchFallbackSelector:Tips
The included selector class is required in
out_opensearchby default. But, your custom selector class is not required inout_opensearch. You should tell Fluentd where the selector class exists.If you use td-agent, you must put the following lines into
TD_AGENT_DEFAULTfile:If you use Fluentd directly, you must pass the following lines as Fluentd command line option:
Reload After
When
reload_connections true, this is the integer number of operations after which the plugin will reload the connections. The default value is 10000.Validate Client Version
When you use mismatched OpenSearch server and client libraries, fluent-plugin-opensearch cannot send data into OpenSearch. The default value is
false.Unrecoverable Error Types
Default
unrecoverable_error_typesparameter is set up strictly. Becauserejected_execution_exceptionis caused by exceeding OpenSearch’s thread pool capacity. Advanced users can increase its capacity, but normal users should follow default behavior.If you want to increase it and forcibly retrying bulk request, please consider to change
unrecoverable_error_typesparameter from default value.Change default value of
thread_pool.bulk.queue_sizein opensearch.yml: e.g.)Then, remove
rejected_execution_exceptionfromunrecoverable_error_typesparameter:Unrecoverable Record Types
Default
unrecoverable_record_typesparameter is set up loosely. Becausejson_parse_exceptionis caused by invalid JSON record. Another possible unrecoverable record error should be included within this paramater.If you want to handle
security_exceptionas unrecoverable exceptions, please consider to changeunrecoverable_record_typesparameter from default value:If this error type is included in OpenSearch response, an invalid record should be sent in
@ERRORdata pipeline.emit_error_label_event
Default
emit_error_label_eventvalue istrue.Emitting error label events is default behavior.
When using the followin configuration, OpenSearch plugin will cut error events on error handler:
verify_os_version_at_startup
Because OpenSearch plugin will ought to change behavior each of OpenSearch major versions.
For example, OpenSearch 1 requests to handle only
_doctype_name in index.If you want to disable to verify OpenSearch version at start up, set it as
false.When using the following configuration, OpenSearch plugin intends to communicate into OpenSearch 1.
The default value is
true.default_opensearch_version
This parameter changes that OpenSearch plugin assumes the default OpenSearch version. The default value is
1.custom_headers
This parameter adds additional headers to request. The default value is
{}.Not seeing a config you need?
We try to keep the scope of this plugin small and not add too many configuration options. If you think an option would be useful to others, feel free to open an issue or contribute a Pull Request.
Alternatively, consider using fluent-plugin-forest. For example, to configure multiple tags to be sent to different OpenSearch indices:
And yet another option is described in Dynamic Configuration section.
Note: If you use or evaluate Fluentd v0.14, you can use builtin placeholders. In more detail, please refer to Placeholders section.
Placeholders
v0.14 placeholders can handle
${tag}for tag,%Y%m%dlike strftime format, and custom record keys like asrecord["mykey"].Note that custom chunk key is different notations for
record_reformerandrecord_modifier. They usesrecord["some_key"]to specify placeholders, but this feature uses${key1},${key2}notation. And tag, time, and some arbitrary keys must be included in buffer directive attributes.They are used as below:
tag
time
custom key
Multi workers
Since Fluentd v0.14, multi workers feature had been implemented to increase throughput with multiple processes. This feature allows Fluentd processes to use one or more CPUs. This feature will be enabled by the following system configuration:
log_os_400_reason
By default, the error logger won’t record the reason for a 400 error from the OpenSearch API unless you set log_level to debug. However, this results in a lot of log spam, which isn’t desirable if all you want is the 400 error reasons. You can set this
trueto capture the 400 error reasons without all the other debug logs.Default value is
false.suppress_doc_wrap
By default, record body is wrapped by ‘doc’. This behavior can not handle update script requests. You can set this to suppress doc wrapping and allow record body to be untouched.
Default value is
false.ignore_exceptions
A list of exception that will be ignored - when the exception occurs the chunk will be discarded and the buffer retry mechanism won’t be called. It is possible also to specify classes at higher level in the hierarchy. For example
will match all subclasses of
ServerError-OpenSearch::Transport::Transport::Errors::BadRequest,OpenSearch::Transport::Transport::Errors::ServiceUnavailable, etc.Default value is empty list (no exception is ignored).
exception_backup
Indicates whether to backup chunk when ignore exception occurs.
Default value is
true.bulk_message_request_threshold
Configure
bulk_messagerequest splitting threshold size.Default value is
-1(unlimited).If you specify this size as negative number,
bulk_messagerequest splitting feature will be disabled.truncate_caches_interval
Specify truncating caches interval.
If it is set, timer for clearing
alias_indexesandtemplate_namescaches will be launched and executed.Default value is
nil.use_legacy_template
Use legacy template or not.
Composable template documentation is Put Index Template API | OpenSearch Reference. OpenSearch still supports legacy template but we recommend to migrate to use Composable template.
Please confirm that whether the using OpenSearch cluster(s) support the composable template feature or not when turn on the brand new feature with this parameter.
<metadata> section
Users can specify whether including
chunk_idinformation into records or not:include_chunk_id
Whether including
chunk_idfor not. Default value isfalse.chunk_id_key
Specify
chunk_id_keyto storechunk_idinformation into records. Default value ischunk_id.Configuration - OpenSearch Input
See OpenSearch Input plugin document
Configuration - OpenSearch Filter GenID
See OpenSearch Filter GenID document
Configuration - OpenSearch Output Data Stream
Since Elasticsearch 7.9 that is predessor software of OpenSearch, Data Streams was introduced.
NOTE: This feature is slated to official support. Currently, this fetaure is beta.
You can enable this feature by specifying
@type opensearch_data_stream.The matching index template will be also created automatically.
data_stream_name
You can specify OpenSearch data stream name by this parameter. This parameter is mandatory for
opensearch_data_stream.data_stream_template_name
You can specify an existing matching index template for the data stream. If not present, it creates a new matching index template.
Default value is
data_stream_name.Configuration - AWS OpenSearch Service
This settings are effective for AWS OpenSearch Service that is successor of AWS Elasticsearch service.
<endpoint> section
AWS OpenSearch Service related settings are placed in
<endpoint>directive. This is becauseelasticsearch-rubydoes not work with OpenSearch andopensearch-rubydoes not work with Elasticsearch.Configuration example is below:
region
Specify AWS region.
url
Specify AWS OpenSearch Service endpoint.
NOTE: This plugin will remove trailing slashes automatically. You don’t need to pay attention to the trailing slash characters.
access_key_id
Specify AWS access key.
secret_access_key
Specify AWS secret access key.
IAM
If you don’t want to use
access_key_idandsecret_access_keyon your endpoint configuration, you should use IAM policies instead.Assign an IAM instance role
The first step needs to assign an IAM instance role (ROLE) to your EC2 instances. You should change its name appropriately. The attaching role should not contain no policy: We’re using the role as the authenticating factor and placing the policy into the OpenSearch cluster.
Then, you should configure a policy for the OpenSearch cluster policy with substitution s for the capitalized terms:
The above policy will allow your Fluentd hosts and any traffic coming from the specified IP addresses (you querying OpenSearch Dashboard) to access the various endpoints. While not ideally secure it should allow you to get up and ingesting logs without anything
Use STS assumed role as the authenticating factor
Additionally, you can use a STS assumed role as the authenticating factor and instruct the plugin to assume this role. This is useful for cross-account access and when assigning a standard role is not possible. In this case, the endpoint configuration looks like:
The policy attached into your OpenSearch cluster becomes something like:
Ensure the environment to assume roles
You’ll need to ensure that the environment where the Fluentd plugin runs to have the capability to assume this role, by attaching a policy something like this to the instance profile:
EKS
If you want to use IAM roles for service accounts on your Amazon EKS clusters, please refer to the official documentation and specify a Service Account for your fluentd Pod.
In this case, the endpoint configuration looks like:
Expiring AWS credentials
If you want to expire AWS credentials in certain interval, you should specify
refresh_credentials_intervalparameter underendpointsection:Use OpenSearch Serverless
If you want to use Serverless version of OpenSearch service, you have to specify
aossinaws_service_nameunderendpointsection:Troubleshooting
See Troubleshooting document
Contact
If you have a question, open an Issue.
Contributing
There are usually a few feature requests, tagged Easy, Normal and Hard. Feel free to work on any one of them.
Pull Requests are welcomed.
Before sending a pull request or reporting an issue, please read the contribution guideline.
Running tests
Install dev dependencies: