Skip to content

Commit 0b63234

Browse files
authored
Merge pull request #390 from fluent/1.0-add-opensearch-plugin-doc
1.0: Add OpenSearch plugin documentation
2 parents 3343240 + 76ef460 commit 0b63234

File tree

3 files changed

+169
-0
lines changed

3 files changed

+169
-0
lines changed

.gitbook.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ redirects:
8989
v1.0/articles/out_exec: plugins/output/exec.md
9090
v1.0/articles/out_mongo_replset: plugins/output/mongo_replset.md
9191
v1.0/articles/out_relabel: plugins/output/relabel.md
92+
v1.0/articles/out_opensearch: plugins/output/opensearch.md
9293

9394
# Plugin/Filter
9495
v1.0/articles/filter_geoip: plugins/filter/geoip.md

SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
* [s3](output/s3.md)
8080
* [kafka](output/kafka.md)
8181
* [elasticsearch](output/elasticsearch.md)
82+
* [opensearch](output/opensearch.md)
8283
* [mongo](output/mongo.md)
8384
* [mongo\_replset](output/mongo_replset.md)
8485
* [rewrite\_tag\_filter](output/rewrite_tag_filter.md)

output/opensearch.md

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
# opensearch
2+
3+
The `out_opensearch` Output plugin writes records into OpenSearch. By default, it creates records using [bulk api](https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/bulk/) which performs multiple indexing operations in a single API call. This reduces overhead and can greatly increase indexing speed. This means that when you first import records using the plugin, records are not immediately pushed to OpenSearch.
4+
5+
Records will be sent to OpenSearch when the `chunk_keys` condition has been met. To change the output frequency, please specify the `time` in `chunk_keys` and specify `timekey` value in the configuration.
6+
7+
This document does not describe all the parameters. For details, refer to the **Further Reading** section.
8+
9+
## Installation
10+
11+
Since `out_opensearch` has been included in the alternative distribution of `calyptia-fluentd` since v1.3.4, `calyptia-fluentd` users do not need to install it manually.
12+
13+
If you have installed Fluentd without `calyptia-fluentd`, please install this plugin using `fluent-gem` or `td-agent-gem` (for td-agent users):
14+
15+
```text
16+
$ fluent-gem install fluent-plugin-opensearch
17+
```
18+
19+
```text
20+
$ td-agent-gem install fluent-plugin-opensearch
21+
```
22+
23+
## Example Configuration
24+
25+
Here is a simple working configuration for OpenSearch instance that is running on localhost:
26+
27+
```text
28+
<match my.logs>
29+
@type opensearch
30+
host localhost
31+
port 9200
32+
logstash_format true
33+
</match>
34+
```
35+
36+
For more details on each option, read the section on [Parameters](opensearch.md#parameters).
37+
38+
## Plugin Helpers
39+
40+
* [`event_emitter`](../plugin-helper-overview/api-plugin-helper-event_emitter.md)
41+
* [`compat_parameters`](../plugin-helper-overview/api-plugin-helper-compat_parameters.md)
42+
43+
## Parameters
44+
45+
### `@type` \(required\)
46+
47+
This option must be always `opensearch`.
48+
49+
### `host` \(optional\)
50+
51+
The hostname of your OpenSearch node \(default: `localhost`\).
52+
53+
### `port` \(optional\)
54+
55+
The port number of your OpenSearch node \(default: `9200`\).
56+
57+
### `hosts` \(optional\)
58+
59+
If you want to connect to more than one OpenSearch nodes, specify this option in the following format:
60+
61+
```text
62+
hosts host1:port1,host2:port2,host3:port3
63+
# or
64+
hosts https://customhost.com:443/path,https://username:password@host-failover.com:443
65+
```
66+
67+
If you use this option, the `host` and `port` options are ignored.
68+
69+
### `user`, `password` \(optional\)
70+
71+
The login credentials to connect to the OpenSearch node \(default: `nil`\):
72+
73+
```text
74+
user fluent
75+
password mysecret
76+
```
77+
78+
### `scheme` \(optional\)
79+
80+
Specify `https` if your OpenSearch endpoint supports SSL \(default: `http`\).
81+
82+
### `path` \(optional\)
83+
84+
The REST API endpoint of OpenSearch to post write requests \(default: `nil`\).
85+
86+
### `index_name` \(optional\)
87+
88+
The index name to write events to \(default: `fluentd`\).
89+
90+
This option supports the placeholder syntax of Fluentd plugin API. For example, if you want to partition the index by tags, you can specify it like this:
91+
92+
```text
93+
index_name fluentd.${tag}
94+
```
95+
96+
Here is a more practical example which partitions the OpenSearch index by tags and timestamps:
97+
98+
```text
99+
index_name fluentd.${tag}.%Y%m%d
100+
```
101+
102+
Time placeholder needs to set up tag and time in `chunk_keys`. Also, it needs to specify timekey for time slice of chunk:
103+
104+
```text
105+
<buffer tag, time>
106+
timekey 1h # chunks per hours ("3600" also available)
107+
</buffer>
108+
```
109+
110+
For more information about buffer options checkout the [Buffer Section Configuration](../configuration/buffer-section.md).
111+
112+
### `logstash_format` \(optional\)
113+
114+
If `true`, Fluentd uses the conventional index name format `logstash-%Y.%m.%d` \(default: `false`\). This option supersedes the `index_name` option.
115+
116+
#### `@log_level` option
117+
118+
The `@log_level` option allows the user to set different levels of logging for each plugin.
119+
120+
Supported log levels: `fatal`, `error`, `warn`, `info`, `debug`, `trace`.
121+
122+
Please see the [logging article](../deployment/logging.md) for further details.
123+
124+
### `logstash_prefix` \(optional\)
125+
126+
The logstash prefix index name to write events when `logstash_format` is `true` \(default: `logstash`\).
127+
128+
## Miscellaneous
129+
130+
You can use `%{}` style placeholders to escape for URL encoding needed characters.
131+
132+
Valid configuration:
133+
134+
```text
135+
user %{demo+}
136+
password %{@secret}
137+
```
138+
139+
Valid configuration:
140+
141+
```text
142+
hosts https://%{j+hn}:%{passw@rd}@host1:443/elastic/,http://host2
143+
```
144+
145+
Invalid configuration:
146+
147+
```text
148+
user demo+
149+
password @secret
150+
```
151+
152+
## Common Output / Buffer parameters
153+
154+
For common output / buffer parameters, please check the following articles:
155+
156+
* [Output Plugin Overview](./)
157+
* [Buffer Section Configuration](../configuration/buffer-section.md)
158+
159+
## Troubleshooting
160+
161+
Please refer to the [OpenSearch's troubleshooting](https://github.com/fluent/fluent-plugin-opensearch#troubleshooting) section.
162+
163+
## Further Reading
164+
165+
* [`fluent-plugin-opensearch`](https://github.com/fluent/fluent-plugin-opensearch)
166+
167+
If this article is incorrect or outdated, or omits critical information, please [let us know](https://github.com/fluent/fluentd-docs-gitbook/issues?state=open). [Fluentd](http://www.fluentd.org/) is an open-source project under [Cloud Native Computing Foundation \(CNCF\)](https://cncf.io/). All components are available under the Apache 2 License.

0 commit comments

Comments
 (0)