Skip to content

Commit 1c03373

Browse files
committed
pipeline: outputs: es: support of Upstream
Signed-off-by: Marat Abrarov <[email protected]>
1 parent 1de2cbe commit 1c03373

File tree

2 files changed

+97
-41
lines changed

2 files changed

+97
-41
lines changed

administration/configuring-fluent-bit/classic-mode/upstream-servers.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ It's common that Fluent Bit [output plugins](../../pipeline/outputs/) aims to co
55
An _Upstream_ defines a set of nodes that will be targeted by an output plugin, by the nature of the implementation an output plugin **must** support the _Upstream_ feature. The following plugin\(s\) have _Upstream_ support:
66

77
* [Forward](../../../pipeline/outputs/forward.md)
8+
* [Elasticsearch](../../../pipeline/outputs/elasticsearch.md)
89

910
The current balancing mode implemented is _round-robin_.
1011

pipeline/outputs/elasticsearch.md

Lines changed: 96 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,51 @@ operational Elasticsearch service running in your environment.
1010

1111
## Configuration Parameters
1212

13-
| Key | Description | Default |
14-
| :--- | :--- | :--- |
15-
| `Host` | IP address or hostname of the target Elasticsearch instance | `127.0.0.1` |
16-
| `Port` | TCP port of the target Elasticsearch instance | `9200` |
17-
| `Path` | Elasticsearch accepts new data on HTTP query path `/_bulk`. You can also serve Elasticsearch behind a reverse proxy on a sub-path. Define the path by adding a path prefix in the indexing HTTP POST URI. | Empty string |
18-
| `compress` | Set payload compression mechanism. Option available is `gzip`. | _none_ |
19-
| `Buffer_Size` | Specify the buffer size used to read the response from the Elasticsearch HTTP service. Use for debugging purposes where required to read full responses. Response size grows depending of the number of records inserted. To use an unlimited amount of memory, set this value to `False`. Otherwise set the value according to the [Unit Size](../../administration/configuring-fluent-bit/unit-sizes.md). | `512KB` |
20-
| `Pipeline` | Define which pipeline the database should use. For performance reasons, it's strongly suggested to do parsing and filtering on Fluent Bit side, and avoid pipelines. | _none_ |
21-
| `AWS_Auth` | Enable AWS Sigv4 Authentication for Amazon OpenSearch Service. | `Off` |
22-
| `AWS_Region` | Specify the AWS region for Amazon OpenSearch Service. | _none_ |
23-
| `AWS_STS_Endpoint` | Specify the custom STS endpoint to be used with STS API for Amazon OpenSearch Service | _none_ |
24-
| `AWS_Role_ARN` | AWS IAM Role to assume to put records to your Amazon cluster | _none_ |
25-
| `AWS_External_ID` | External ID for the AWS IAM Role specified with `aws_role_arn` | _none_ |
26-
| `AWS_Service_Name` | Service name to use in AWS Sigv4 signature. For integration with Amazon OpenSearch Serverless, set to `aoss`. See [Amazon OpenSearch Serverless](opensearch.md) for more information. | `es` |
27-
| `AWS_Profile` | AWS profile name | `default` |
28-
| `Cloud_ID` | If using Elastic's Elasticsearch Service you can specify the `cloud_id` of the cluster running. The string has the format `<deployment_name>:<base64_info>`. Once decoded, the `base64_info` string has the format `<deployment_region>$<elasticsearch_hostname>$<kibana_hostname>`. | _none_ |
29-
| `Cloud_Auth` | Specify the credentials to use to connect to Elastic's Elasticsearch Service running on Elastic Cloud | _none_ |
30-
| `HTTP_User` | Optional username credential for Elastic X-Pack access | _none_ |
31-
| `HTTP_Passwd` | Password for user defined in `HTTP_User` | _none_ |
32-
| `Index` | Index name | `fluent-bit` |
33-
| `Type` | Type name | `_doc` |
34-
| `Logstash_Format` | Enable Logstash format compatibility. This option takes a Boolean value: `True/False`, `On/Off` | `Off` |
35-
| `Logstash_Prefix` | When `Logstash_Format` is enabled, the Index name is composed using a prefix and the date, e.g: If `Logstash_Prefix` is equal to `mydata` your index will become `mydata-YYYY.MM.DD`. The last string appended belongs to the date when the data is being generated. | `logstash` |
36-
| `Logstash_Prefix_Key` | When included: the value of the key in the record will be evaluated as key reference and overrides `Logstash_Prefix` for index generation. If the key/value isn't found in the record then the `Logstash_Prefix` option will act as a fallback. The parameter is expected to be a [record accessor](../../administration/configuring-fluent-bit/classic-mode/record-accessor.md). | _none_ |
37-
| `Logstash_Prefix_Separator` | Set a separator between `Logstash_Prefix` and date.| `-` |
38-
| `Logstash_DateFormat` | Time format based on [strftime](http://man7.org/linux/man-pages/man3/strftime.3.html) to generate the second part of the Index name. | `%Y.%m.%d` |
39-
| `Time_Key` | When `Logstash_Format` is enabled, each record will get a new timestamp field. The `Time_Key` property defines the name of that field. | `@timestamp` |
40-
| `Time_Key_Format` | When `Logstash_Format` is enabled, this property defines the format of the timestamp. | `%Y-%m-%dT%H:%M:%S` |
41-
| `Time_Key_Nanos` | When `Logstash_Format` is enabled, enabling this property sends nanosecond precision timestamps. | `Off` |
42-
| `Include_Tag_Key` | When enabled, it append the Tag name to the record. | `Off` |
43-
| `Tag_Key` | When `Include_Tag_Key` is enabled, this property defines the key name for the tag. | `_flb-key` |
44-
| `Generate_ID` | When enabled, generate `_id` for outgoing records. This prevents duplicate records when retrying ES. | `Off` |
45-
| `Id_Key` | If set, `_id` will be the value of the key from incoming record and `Generate_ID` option is ignored. | _none_ |
46-
| `Write_Operation` | `Write_operation` can be any of: `create`, `index`, `update`, `upsert`. | `create` |
47-
| `Replace_Dots` | When enabled, replace field name dots with underscore. Required by Elasticsearch 2.0-2.3. | `Off` |
48-
| `Trace_Output` | Print all ElasticSearch API request payloads to `stdout` for diagnostics. | `Off` |
49-
| `Trace_Error` | If ElasticSearch returns an error, print the ElasticSearch API request and response for diagnostics. | `Off` |
50-
| `Current_Time_Index` | Use current time for index generation instead of message record. | `Off` |
51-
| `Suppress_Type_Name` | When enabled, mapping types is removed and `Type` option is ignored. Elasticsearch 8.0.0 or higher [no longer supports mapping types](https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html), and is set to `On`. | `Off` |
52-
| `Workers` | The number of [workers](../../administration/multithreading.md#outputs) to perform flush operations for this output. | `2` |
13+
The **Overridable** column indicates if a key can be overridden in the NODE section of an
14+
[Upstream](../../administration/configuring-fluent-bit/classic-mode/upstream-servers.md)
15+
configuration.
16+
17+
| Key | Description | Default | Overridable |
18+
| :--- | :--- | :--- | :--- |
19+
| `Host` | IP address or hostname of the target Elasticsearch instance. | `127.0.0.1` | Yes. Default value isn't applicable for NODE section of Upstream configuration, which **requires** Host to be specified. |
20+
| `Port` | TCP port of the target Elasticsearch instance | `9200` | Yes. Default value isn't applicable for NODE section of Upstream configuration, which **requires** Port to be specified. |
21+
| `Path` | Elasticsearch accepts new data on HTTP query path `/_bulk`. You can also serve Elasticsearch behind a reverse proxy on a sub-path. Define the path by adding a path prefix in the indexing HTTP POST URI. | Empty string | Yes |
22+
| `compress` | Set payload compression mechanism. Option available is `gzip`. | _none_ | Yes |
23+
| `Buffer_Size` | Specify the buffer size used to read the response from the Elasticsearch HTTP service. Use for debugging purposes where required to read full responses. Response size grows depending of the number of records inserted. To use an unlimited amount of memory, set this value to `False`. Otherwise set the value according to the [Unit Size](../../administration/configuring-fluent-bit/unit-sizes.md). | `512KB` | Yes |
24+
| `Pipeline` | Define which pipeline the database should use. For performance reasons, it's strongly suggested to do parsing and filtering on Fluent Bit side, and avoid pipelines. | _none_ | Yes |
25+
| `AWS_Auth` | Enable AWS Sigv4 Authentication for Amazon OpenSearch Service. | `Off` | Yes |
26+
| `AWS_Region` | Specify the AWS region for Amazon OpenSearch Service. | _none_ | Yes |
27+
| `AWS_STS_Endpoint` | Specify the custom STS endpoint to be used with STS API for Amazon OpenSearch Service | _none_ | Yes |
28+
| `AWS_Role_ARN` | AWS IAM Role to assume to put records to your Amazon cluster | _none_ | Yes |
29+
| `AWS_External_ID` | External ID for the AWS IAM Role specified with `aws_role_arn` | _none_ | Yes |
30+
| `AWS_Service_Name` | Service name to use in AWS Sigv4 signature. For integration with Amazon OpenSearch Serverless, set to `aoss`. See [Amazon OpenSearch Serverless](opensearch.md) for more information. | `es` | Yes |
31+
| `AWS_Profile` | AWS profile name | `default` | Yes |
32+
| `Cloud_ID` | If using Elastic's Elasticsearch Service you can specify the `cloud_id` of the cluster running. The string has the format `<deployment_name>:<base64_info>`. Once decoded, the `base64_info` string has the format `<deployment_region>$<elasticsearch_hostname>$<kibana_hostname>`. | _none_ | No |
33+
| `Cloud_Auth` | Specify the credentials to use to connect to Elastic's Elasticsearch Service running on Elastic Cloud | _none_ | Yes |
34+
| `HTTP_User` | Optional username credential for Elastic X-Pack access | _none_ | Yes |
35+
| `HTTP_Passwd` | Password for user defined in `HTTP_User` | _none_ | Yes |
36+
| `Index` | Index name | `fluent-bit` | Yes |
37+
| `Type` | Type name | `_doc` | Yes |
38+
| `Logstash_Format` | Enable Logstash format compatibility. This option takes a Boolean value: `True/False`, `On/Off` | `Off` | Yes |
39+
| `Logstash_Prefix` | When `Logstash_Format` is enabled, the Index name is composed using a prefix and the date, e.g: If `Logstash_Prefix` is equal to `mydata` your index will become `mydata-YYYY.MM.DD`. The last string appended belongs to the date when the data is being generated. | `logstash` | Yes |
40+
| `Logstash_Prefix_Key` | When included: the value of the key in the record will be evaluated as key reference and overrides `Logstash_Prefix` for index generation. If the key/value isn't found in the record then the `Logstash_Prefix` option will act as a fallback. The parameter is expected to be a [record accessor](../../administration/configuring-fluent-bit/classic-mode/record-accessor.md). | _none_ | Yes |
41+
| `Logstash_Prefix_Separator` | Set a separator between `Logstash_Prefix` and date.| `-` | Yes |
42+
| `Logstash_DateFormat` | Time format based on [strftime](http://man7.org/linux/man-pages/man3/strftime.3.html) to generate the second part of the Index name. | `%Y.%m.%d` | Yes |
43+
| `Time_Key` | When `Logstash_Format` is enabled, each record will get a new timestamp field. The `Time_Key` property defines the name of that field. | `@timestamp` | Yes |
44+
| `Time_Key_Format` | When `Logstash_Format` is enabled, this property defines the format of the timestamp. | `%Y-%m-%dT%H:%M:%S` | Yes |
45+
| `Time_Key_Nanos` | When `Logstash_Format` is enabled, enabling this property sends nanosecond precision timestamps. | `Off` | Yes |
46+
| `Include_Tag_Key` | When enabled, it append the Tag name to the record. | `Off` | Yes |
47+
| `Tag_Key` | When `Include_Tag_Key` is enabled, this property defines the key name for the tag. | `_flb-key` | Yes |
48+
| `Generate_ID` | When enabled, generate `_id` for outgoing records. This prevents duplicate records when retrying ES. | `Off` | Yes |
49+
| `Id_Key` | If set, `_id` will be the value of the key from incoming record and `Generate_ID` option is ignored. | _none_ | Yes |
50+
| `Write_Operation` | `Write_operation` can be any of: `create`, `index`, `update`, `upsert`. | `create` | Yes |
51+
| `Replace_Dots` | When enabled, replace field name dots with underscore. Required by Elasticsearch 2.0-2.3. | `Off` | Yes |
52+
| `Trace_Output` | Print all ElasticSearch API request payloads to `stdout` for diagnostics. | `Off` | Yes |
53+
| `Trace_Error` | If ElasticSearch returns an error, print the ElasticSearch API request and response for diagnostics. | `Off` | Yes |
54+
| `Current_Time_Index` | Use current time for index generation instead of message record. | `Off` | Yes |
55+
| `Suppress_Type_Name` | When enabled, mapping types is removed and `Type` option is ignored. Elasticsearch 8.0.0 or higher [no longer supports mapping types](https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html), and is set to `On`. | `Off` | Yes |
56+
| `Workers` | The number of [workers](../../administration/multithreading.md#outputs) to perform flush operations for this output. | `2` | No |
57+
| `Upstream` | If plugin will connect to an _Upstream_ instead of a simple host, this property defines the absolute path for the Upstream configuration file, for more details about this refer to the [Upstream Servers](../../administration/configuring-fluent-bit/classic-mode/upstream-servers.md) documentation section. | _none_ | No |
5358

5459
If you have used a common relational database, the parameters `index` and `type` can
5560
be compared to the `database` and `table` concepts.
@@ -59,6 +64,16 @@ be compared to the `database` and `table` concepts.
5964
Elasticsearch output plugin supports TLS/SSL. For more details about the properties
6065
available and general configuration, refer to[TLS/SSL](../../administration/transport-security.md).
6166

67+
### AWS Sigv4 Authentication and Upstream Servers
68+
69+
The `http_proxy`, `no_proxy`, and `TLS` parameters used for AWS Sigv4 Authentication
70+
(for connection of plugin to AWS to generate authentication signature) are never
71+
picked from the `NODE` section of the
72+
[Upstream](../../administration/configuring-fluent-bit/classic-mode/upstream-servers.md)
73+
configuration. However, `TLS` parameters for connection of the plugin to
74+
Elasticsearch **can** be overridden in the `NODE` section of Upstream, even if AWS
75+
authentication is used.
76+
6277
### `write_operation`
6378

6479
The `write_operation` can be any of:
@@ -112,7 +127,7 @@ fluent-bit -i cpu -t cpu -o es -p Host=192.168.2.3 -p Port=9200 \
112127

113128
In your main configuration file append the following `Input` and `Output` sections.
114129

115-
```python
130+
```text
116131
[INPUT]
117132
Name cpu
118133
Tag cpu
@@ -128,6 +143,46 @@ In your main configuration file append the following `Input` and `Output` sectio
128143

129144
![example configuration visualization from Calyptia](../../.gitbook/assets/image%20%282%29.png)
130145

146+
### Configuration File with Upstream
147+
148+
In your main configuration file append the following _Input_ & _Output_ sections:
149+
150+
```text
151+
[INPUT]
152+
Name cpu
153+
Tag cpu
154+
155+
[OUTPUT]
156+
Name es
157+
Match *
158+
Upstream ./upstream.conf
159+
Index my_index
160+
Type my_type
161+
```
162+
163+
Your [Upstream Servers](../../administration/configuring-fluent-bit/classic-mode/upstream-servers.md)
164+
configuration file can be similar to the following:
165+
166+
```text
167+
[UPSTREAM]
168+
name es-balancing
169+
170+
[NODE]
171+
name node-1
172+
host localhost
173+
port 9201
174+
175+
[NODE]
176+
name node-2
177+
host localhost
178+
port 9202
179+
180+
[NODE]
181+
name node-3
182+
host localhost
183+
port 9203
184+
```
185+
131186
## About Elasticsearch field names
132187

133188
Some input plugins can generate messages where the field names contains dots. For

0 commit comments

Comments
 (0)