logstash-output-opensearch 1.0.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/ADMINS.md +29 -0
- data/CODE_OF_CONDUCT.md +25 -0
- data/CONTRIBUTING.md +99 -0
- data/DEVELOPER_GUIDE.md +208 -0
- data/Gemfile +20 -0
- data/LICENSE +202 -0
- data/MAINTAINERS.md +71 -0
- data/NOTICE +2 -0
- data/README.md +37 -0
- data/RELEASING.md +36 -0
- data/SECURITY.md +3 -0
- data/lib/logstash/outputs/opensearch.rb +449 -0
- data/lib/logstash/outputs/opensearch/distribution_checker.rb +44 -0
- data/lib/logstash/outputs/opensearch/http_client.rb +465 -0
- data/lib/logstash/outputs/opensearch/http_client/manticore_adapter.rb +140 -0
- data/lib/logstash/outputs/opensearch/http_client/pool.rb +467 -0
- data/lib/logstash/outputs/opensearch/http_client_builder.rb +182 -0
- data/lib/logstash/outputs/opensearch/template_manager.rb +60 -0
- data/lib/logstash/outputs/opensearch/templates/ecs-disabled/1x.json +44 -0
- data/lib/logstash/outputs/opensearch/templates/ecs-disabled/7x.json +44 -0
- data/lib/logstash/plugin_mixins/opensearch/api_configs.rb +168 -0
- data/lib/logstash/plugin_mixins/opensearch/common.rb +294 -0
- data/lib/logstash/plugin_mixins/opensearch/noop_distribution_checker.rb +18 -0
- data/logstash-output-opensearch.gemspec +40 -0
- data/spec/fixtures/_nodes/nodes.json +74 -0
- data/spec/fixtures/htpasswd +2 -0
- data/spec/fixtures/nginx_reverse_proxy.conf +22 -0
- data/spec/fixtures/scripts/painless/scripted_update.painless +2 -0
- data/spec/fixtures/scripts/painless/scripted_update_nested.painless +1 -0
- data/spec/fixtures/scripts/painless/scripted_upsert.painless +1 -0
- data/spec/integration/outputs/compressed_indexing_spec.rb +76 -0
- data/spec/integration/outputs/create_spec.rb +76 -0
- data/spec/integration/outputs/delete_spec.rb +72 -0
- data/spec/integration/outputs/index_spec.rb +164 -0
- data/spec/integration/outputs/index_version_spec.rb +110 -0
- data/spec/integration/outputs/ingest_pipeline_spec.rb +82 -0
- data/spec/integration/outputs/metrics_spec.rb +75 -0
- data/spec/integration/outputs/no_opensearch_on_startup_spec.rb +67 -0
- data/spec/integration/outputs/painless_update_spec.rb +147 -0
- data/spec/integration/outputs/parent_spec.rb +103 -0
- data/spec/integration/outputs/retry_spec.rb +182 -0
- data/spec/integration/outputs/routing_spec.rb +70 -0
- data/spec/integration/outputs/sniffer_spec.rb +70 -0
- data/spec/integration/outputs/templates_spec.rb +105 -0
- data/spec/integration/outputs/update_spec.rb +123 -0
- data/spec/opensearch_spec_helper.rb +141 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/unit/http_client_builder_spec.rb +194 -0
- data/spec/unit/outputs/error_whitelist_spec.rb +62 -0
- data/spec/unit/outputs/opensearch/http_client/manticore_adapter_spec.rb +159 -0
- data/spec/unit/outputs/opensearch/http_client/pool_spec.rb +306 -0
- data/spec/unit/outputs/opensearch/http_client_spec.rb +292 -0
- data/spec/unit/outputs/opensearch/template_manager_spec.rb +36 -0
- data/spec/unit/outputs/opensearch_proxy_spec.rb +112 -0
- data/spec/unit/outputs/opensearch_spec.rb +800 -0
- data/spec/unit/outputs/opensearch_ssl_spec.rb +179 -0
- metadata +289 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1442c3f5b382cf09b452e6e4464dc04de5add0c1ef5a2d0ffd575f765364a166
|
4
|
+
data.tar.gz: 1a6055265e1be76ab8f4b54ecea6a3136e0b375f4578463609f2ccbab162c67a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4007705f78e0d2e4f4872f3a9704d1a936a9e086dbebda06877dc0db5ebcc522dbf4550d30acf60317baea74813e813d26ae36355130d42d373e02e8d423971d
|
7
|
+
data.tar.gz: ecd5d013db35fd54a3faa7c7dbda5c4e36c588798245909f49f25aedb4a0639d0bd479608510d2e3d382dcd8c731f201449304771821141cf9e543ade9a16cf6
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/ADMINS.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
## Overview
|
2
|
+
|
3
|
+
This document explains who the admins are (see below), what they do in this repo, and how they should be doing it. If you're interested in becoming a maintainer, see [MAINTAINERS](MAINTAINERS.md). If you're interested in contributing, see [CONTRIBUTING](CONTRIBUTING.md).
|
4
|
+
|
5
|
+
## Current Admins
|
6
|
+
|
7
|
+
| Admin | GitHub ID | Affiliation |
|
8
|
+
| -------------------------| --------------------------------------- | ----------- |
|
9
|
+
| Charlotte | [CEHENKLE](https://github.com/CEHENKLE) | Amazon |
|
10
|
+
| Henri Yandell | [hyandell](https://github.com/hyandell) | Amazon |
|
11
|
+
|
12
|
+
|
13
|
+
## Admin Responsibilities
|
14
|
+
|
15
|
+
As an admin you own stewartship of the repository and its settings. Admins have [admin-level permissions on a repository](https://docs.github.com/en/organizations/managing-access-to-your-organizations-repositories/repository-permission-levels-for-an-organization). Use those privileges to serve the community and protect the repository as follows.
|
16
|
+
|
17
|
+
### Prioritize Security
|
18
|
+
|
19
|
+
Security is your number one priority. Manage security keys and safeguard access to the repository.
|
20
|
+
|
21
|
+
Note that this repository is monitored and supported 24/7 by Amazon Security, see [Reporting a Vulnerability](SECURITY.md) for details.
|
22
|
+
|
23
|
+
### Enforce Code of Conduct
|
24
|
+
|
25
|
+
Act on [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) violations by revoking access, and blocking malicious actors.
|
26
|
+
|
27
|
+
### Adopt Organizational Best Practices
|
28
|
+
|
29
|
+
Adopt organizational best practices, work in the open, and collaborate with other admins by opening issues before making process changes. Prefer consistency, and avoid diverging from practices in the opensearch-project organization.
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
This code of conduct applies to all spaces provided by the OpenSource project including in code, documentation, issue trackers, mailing lists, chat channels, wikis, blogs, social media and any other communication channels used by the project.
|
3
|
+
|
4
|
+
|
5
|
+
**Our open source communities endeavor to:**
|
6
|
+
|
7
|
+
* Be Inclusive: We are committed to being a community where everyone can join and contribute. This means using inclusive and welcoming language.
|
8
|
+
* Be Welcoming: We are committed to maintaining a safe space for everyone to be able to contribute.
|
9
|
+
* Be Respectful: We are committed to encouraging differing viewpoints, accepting constructive criticism and work collaboratively towards decisions that help the project grow. Disrespectful and unacceptable behavior will not be tolerated.
|
10
|
+
* Be Collaborative: We are committed to supporting what is best for our community and users. When we build anything for the benefit of the project, we should document the work we do and communicate to others on how this affects their work.
|
11
|
+
|
12
|
+
|
13
|
+
**Our Responsibility. As contributors, members, or bystanders we each individually have the responsibility to behave professionally and respectfully at all times. Disrespectful and unacceptable behaviors include, but are not limited to:**
|
14
|
+
|
15
|
+
* The use of violent threats, abusive, discriminatory, or derogatory language;
|
16
|
+
* Offensive comments related to gender, gender identity and expression, sexual orientation, disability, mental illness, race, political or religious affiliation;
|
17
|
+
* Posting of sexually explicit or violent content;
|
18
|
+
* The use of sexualized language and unwelcome sexual attention or advances;
|
19
|
+
* Public or private harassment of any kind;
|
20
|
+
* Publishing private information, such as physical or electronic address, without permission;
|
21
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting;
|
22
|
+
* Advocating for or encouraging any of the above behaviors.
|
23
|
+
* Enforcement and Reporting Code of Conduct Issues:
|
24
|
+
|
25
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported. [Contact us](mailto:opensource-codeofconduct@amazon.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances.
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
- [Contributing to logstash-output-opensearch](#contributing-to-logstash-output-opensearch)
|
2
|
+
- [First Things First](#first-things-first)
|
3
|
+
- [Ways to Contribute](#ways-to-contribute)
|
4
|
+
- [Bug Reports](#bug-reports)
|
5
|
+
- [Feature Requests](#feature-requests)
|
6
|
+
- [Documentation Changes](#documentation-changes)
|
7
|
+
- [Contributing Code](#contributing-code)
|
8
|
+
- [Developer Certificate of Origin](#developer-certificate-of-origin)
|
9
|
+
- [Review Process](#review-process)
|
10
|
+
|
11
|
+
## Contributing to logstash-output-opensearch
|
12
|
+
|
13
|
+
logstash-output-opensearch is a community project that is built and maintained by people just like **you**. We're glad you're interested in helping out. There are several different ways you can do it, but before we talk about that, let's talk about how to get started.
|
14
|
+
|
15
|
+
## First Things First
|
16
|
+
|
17
|
+
1. **When in doubt, open an issue** - For almost any type of contribution, the first step is opening an issue. Even if you think you already know what the solution is, writing down a description of the problem you're trying to solve will help everyone get context when they review your pull request. If it's truly a trivial change (e.g. spelling error), you can skip this step -- but as the subject says, when it doubt, [open an issue]1. **When in doubt, open an issue** - For almost any type of contribution, the first step is opening an issue. Even if you think you already know what the solution is, writing down a description of the problem you're trying to solve will help everyone get context when they review your pull request. If it's truly a trivial change (e.g. spelling error), you can skip this step -- but as the subject says, when it doubt, [open an issue](https://github.com/opensearch-project/logstash-output-opensearch/issues).
|
18
|
+
|
19
|
+
2. **Only submit your own work** (or work you have sufficient rights to submit) - Please make sure that any code or documentation you submit is your work or you have the rights to submit. We respect the intellectual property rights of others, and as part of contributing, we'll ask you to sign your contribution with a "Developer Certificate of Origin" (DCO) that states you have the rights to submit this work and you understand we'll
|
20
|
+
use your contribution. There's more information about this topic in the [DCO section](#developer-certificate-of-origin).
|
21
|
+
## Ways to Contribute
|
22
|
+
|
23
|
+
**Please note:** logstash-output-opensearch is a fork of [logstash-output-elasticsearch 11.0.2](https://github.com/logstash-plugins/logstash-output-elasticsearch), and is currently in a pre-alpha state, so it's still very much a work in progress. If you do find references to Elasticsearch (outside of attributions and copyrights!) please [open an issue](https://github.com/opensearch-project/OpenSearch/issues)
|
24
|
+
|
25
|
+
### Bug Reports
|
26
|
+
|
27
|
+
Ugh! Bugs!
|
28
|
+
|
29
|
+
A bug is when software behaves in a way that you didn't expect and the developer didn't intend. To help us understand what's going on, we first want to make sure you're working from the latest version.
|
30
|
+
|
31
|
+
Once you've confirmed that the bug still exists in the latest version, you'll want to check to make sure it's not something we already know about on the [open issues GitHub page](https://github.com/opensearch-project/logstash-output-opensearch/issues).
|
32
|
+
|
33
|
+
If you've upgraded to the latest version and you can't find it in our open issues list, then you'll need to tell us how to reproduce it Provide as much information as you can. You may think that the problem lies with your query, when actually it depends on how your data is indexed. The easier it is for us to recreate your problem, the faster it is likely to be fixed.
|
34
|
+
### Feature Requests
|
35
|
+
|
36
|
+
If you've thought of a way that logstash-output-opensearch could be better, we want to hear about it. We track feature requests using GitHub, so please feel free to open an issue which describes the feature you would like to see, why you need it, and how it should work.
|
37
|
+
|
38
|
+
### Documentation Changes
|
39
|
+
|
40
|
+
//TODO
|
41
|
+
|
42
|
+
### Contributing Code
|
43
|
+
|
44
|
+
As with other types of contributions, the first step is to [**open an issue on GitHub**](https://github.com/opensearch-project/logstash-output-opensearch/issues/new/choose). Opening an issue before you make changes makes sure that someone else isn't already working on that particular problem. It also lets us all work together to find the right approach before you spend a bunch of time on a PR. So again, when in doubt, open an issue.
|
45
|
+
|
46
|
+
## Developer Certificate of Origin
|
47
|
+
|
48
|
+
logstash-output-opensearch is an open source product released under the Apache 2.0 license (see either [the Apache site](https://www.apache.org/licenses/LICENSE-2.0) or the [LICENSE.txt file](./LICENSE.txt)). The Apache 2.0 license allows you to freely use, modify, distribute, and sell your own products that include Apache 2.0 licensed software.
|
49
|
+
|
50
|
+
We respect intellectual property rights of others and we want to make sure all incoming contributions are correctly attributed and licensed. A Developer Certificate of Origin (DCO) is a lightweight mechanism to do that.
|
51
|
+
|
52
|
+
The DCO is a declaration attached to every contribution made by every developer. In the commit message of the contribution, the developer simply adds a `Signed-off-by` statement and thereby agrees to the DCO, which you can find below or at [DeveloperCertificate.org](http://developercertificate.org/).
|
53
|
+
|
54
|
+
```
|
55
|
+
Developer's Certificate of Origin 1.1
|
56
|
+
|
57
|
+
By making a contribution to this project, I certify that:
|
58
|
+
|
59
|
+
(a) The contribution was created in whole or in part by me and I
|
60
|
+
have the right to submit it under the open source license
|
61
|
+
indicated in the file; or
|
62
|
+
|
63
|
+
(b) The contribution is based upon previous work that, to the
|
64
|
+
best of my knowledge, is covered under an appropriate open
|
65
|
+
source license and I have the right under that license to
|
66
|
+
submit that work with modifications, whether created in whole
|
67
|
+
or in part by me, under the same open source license (unless
|
68
|
+
I am permitted to submit under a different license), as
|
69
|
+
Indicated in the file; or
|
70
|
+
|
71
|
+
(c) The contribution was provided directly to me by some other
|
72
|
+
person who certified (a), (b) or (c) and I have not modified
|
73
|
+
it.
|
74
|
+
|
75
|
+
(d) I understand and agree that this project and the contribution
|
76
|
+
are public and that a record of the contribution (including
|
77
|
+
all personal information I submit with it, including my
|
78
|
+
sign-off) is maintained indefinitely and may be redistributed
|
79
|
+
consistent with this project or the open source license(s)
|
80
|
+
involved.
|
81
|
+
```
|
82
|
+
We require that every contribution to logstash-output-opensearch is signed with a Developer Certificate of Origin. Additionally, please use your real name. We do not accept anonymous contributors nor those utilizing pseudonyms.
|
83
|
+
|
84
|
+
Each commit must include a DCO which looks like this
|
85
|
+
|
86
|
+
```
|
87
|
+
Signed-off-by: Jane Smith <jane.smith@email.com>
|
88
|
+
```
|
89
|
+
You may type this line on your own when writing your commit messages. However, if your user.name and user.email are set in your git configs, you can use `-s` or `– – signoff` to add the `Signed-off-by` line to the end of the commit message.
|
90
|
+
|
91
|
+
## Review Process
|
92
|
+
|
93
|
+
We deeply appreciate everyone who takes the time to make a contribution. We will review all contributions as quickly as possible. As a reminder, [opening an issue](https://github.com/opensearch-project/logstash-output-opensearch/issues/new/choose) discussing your change before you make it is the best way to smooth the PR process. This will prevent a rejection because someone else is already working on the problem, or because the solution is incompatible with the architectural direction.
|
94
|
+
|
95
|
+
During the PR process, expect that there will be some back-and-forth. Please try to respond to comments in a timely fashion, and if you don't wish to continue with the PR, let us know. If a PR takes too many iterations for its complexity or size, we may reject it. Additionally, if you stop responding we may close the PR as abandoned. In either case, if you feel this was done in error, please add a comment on the PR.
|
96
|
+
|
97
|
+
If we accept the PR, a [maintainer](MAINTAINERS.md) will merge your change and usually take care of backporting it to appropriate branches ourselves.
|
98
|
+
|
99
|
+
If we reject the PR, we will close the pull request with a comment explaining why. This decision isn't always final: if you feel we have misunderstood your intended change or otherwise think that we should reconsider then please continue the conversation with a comment on the PR and we'll do our best to address any further points you raise.
|
data/DEVELOPER_GUIDE.md
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
- [Developer Guide](#developer-guide)
|
2
|
+
- [Getting Started](#getting-started)
|
3
|
+
- [Git Clone logstash-output-opensearch](#git-clone-logstash-output-opensearch-repo)
|
4
|
+
- [Install Prerequisites](#install-prerequisites)
|
5
|
+
- [JRuby](#JRuby)
|
6
|
+
- [Docker](#docker)
|
7
|
+
- [Run Tests](#run-tests)
|
8
|
+
- [Run plugin](#run-plugin-in-logstash)
|
9
|
+
- [Configuration for Logstash Output OpenSearch Plugin](#configuration-for-logstash-output-opensearch-plugin)
|
10
|
+
- [Submitting Changes](#submitting-changes)
|
11
|
+
|
12
|
+
# Developer Guide
|
13
|
+
|
14
|
+
So you want to contribute code to logstash-output-opensearch? Excellent! We're glad you're here. Here's what you need to do.
|
15
|
+
|
16
|
+
## Getting Started
|
17
|
+
|
18
|
+
### Fork the logstash-output-opensearch Repo
|
19
|
+
|
20
|
+
Fork [opensearch-project/logstash-output-opensearch](https://github.com/opensearch-project/logstash-output-opensearch) and clone locally.
|
21
|
+
|
22
|
+
Example:
|
23
|
+
```bash
|
24
|
+
git clone https://github.com/[your username]/logstash-output-opensearch.git.
|
25
|
+
```
|
26
|
+
|
27
|
+
### Install Prerequisites
|
28
|
+
|
29
|
+
#### JRuby
|
30
|
+
|
31
|
+
This plugin builds using [JRuby](https://www.jruby.org/). This means you'll need JRuby with the Bundler gem installed.
|
32
|
+
|
33
|
+
One easy way to get JRuby on is to use [rvm](https://rvm.io/rvm). Please check [here](https://rvm.io/rvm/install) on how to install rvm on your system.
|
34
|
+
If you use [rvm](https://rvm.io/rvm), then installing JRuby is also a piece of cake:
|
35
|
+
```bash
|
36
|
+
#Installing Jruby
|
37
|
+
rvm install jruby
|
38
|
+
|
39
|
+
# Use JRuby as interpreter for current shell
|
40
|
+
rvm use jruby
|
41
|
+
|
42
|
+
# If you want to set JRuby as default interpreter, use below command
|
43
|
+
rvm --default use jruby
|
44
|
+
|
45
|
+
#Installing bundler
|
46
|
+
gem install bundler
|
47
|
+
```
|
48
|
+
|
49
|
+
#### Docker
|
50
|
+
|
51
|
+
[Docker](https://docs.docker.com/install/) is required for executing unit and integration tests.
|
52
|
+
|
53
|
+
### Run Tests
|
54
|
+
|
55
|
+
Unit tests and integration tests are executed inside Docker environment.
|
56
|
+
Perform the following from your project root directory eg: `~/workspace/logstash-output-opensearch`
|
57
|
+
|
58
|
+
#### Run Unit Tests
|
59
|
+
|
60
|
+
```bash
|
61
|
+
# Set up Environment variable for docker to pull your test environment
|
62
|
+
export LOGSTASH_VERSION=7.13.2 # will use latest version if not specified.
|
63
|
+
|
64
|
+
# Set up docker ( this will build, install into Logstash )
|
65
|
+
scripts/unit-test/docker-setup.sh
|
66
|
+
|
67
|
+
# Run tests
|
68
|
+
scripts/unit-test/docker-run.sh
|
69
|
+
```
|
70
|
+
|
71
|
+
#### Run Integration Tests
|
72
|
+
1. Tests against OpenSearch clusters.
|
73
|
+
|
74
|
+
```bash
|
75
|
+
# Set up Environment variable for Docker to pull your test environment
|
76
|
+
export LOGSTASH_VERSION=7.13.2 # will use latest version if not specified.
|
77
|
+
export OPENSEARCH_VERSION=1.0.0-rc1 # will use latest if not specified.
|
78
|
+
|
79
|
+
# Set up docker ( this will build, install into Logstash )
|
80
|
+
scripts/opensearch/docker-setup.sh
|
81
|
+
|
82
|
+
# Run tests
|
83
|
+
scripts/opensearch/docker-run.sh
|
84
|
+
```
|
85
|
+
|
86
|
+
2. Tests against Secured OpenSearch clusters
|
87
|
+
|
88
|
+
```bash
|
89
|
+
# Set up Environment variable for Docker to pull your test environment
|
90
|
+
export LOGSTASH_VERSION=7.13.2 # will use latest version if not specified.
|
91
|
+
export OPENSEARCH_VERSION=1.0.0-rc1 # will use latest if not specified.
|
92
|
+
export SECURE_INTEGRATION=true # to run against cluster with security plugin
|
93
|
+
# Set up docker ( this will build, install into Logstash )
|
94
|
+
scripts/opensearch/docker-setup.sh
|
95
|
+
|
96
|
+
# Run tests
|
97
|
+
scripts/opensearch/docker-run.sh
|
98
|
+
```
|
99
|
+
|
100
|
+
3. Tests against OpenDistro clusters.
|
101
|
+
|
102
|
+
```bash
|
103
|
+
# Set up Environment variable for docker to pull your test environment
|
104
|
+
export LOGSTASH_VERSION=7.13.2 # will use latest version if not specified.
|
105
|
+
export OPENDISTRO_VERSION=1.13.2 # will use latest if not specified.
|
106
|
+
|
107
|
+
# Set up docker ( this will build, install into Logstash )
|
108
|
+
scripts/opendistro/docker-setup.sh
|
109
|
+
|
110
|
+
# Run tests
|
111
|
+
scripts/opendistro/docker-run.sh
|
112
|
+
```
|
113
|
+
|
114
|
+
### Run plugin in Logstash
|
115
|
+
|
116
|
+
#### 2.1 Run in a local Logstash clone
|
117
|
+
|
118
|
+
1. Edit Logstash `Gemfile` and add the local plugin path, for example:
|
119
|
+
|
120
|
+
```ruby
|
121
|
+
gem "logstash-output-opensearch", :path => "/your/local/logstash-output-opensearch"
|
122
|
+
```
|
123
|
+
|
124
|
+
2. Install the plugin:
|
125
|
+
|
126
|
+
```sh
|
127
|
+
# Logstash 2.3 and higher
|
128
|
+
bin/logstash-plugin install --no-verify
|
129
|
+
|
130
|
+
# Prior to Logstash 2.3
|
131
|
+
bin/plugin install --no-verify
|
132
|
+
```
|
133
|
+
|
134
|
+
3. Run Logstash with your plugin:
|
135
|
+
|
136
|
+
```sh
|
137
|
+
bin/logstash -e 'output {opensearch {}}'
|
138
|
+
```
|
139
|
+
|
140
|
+
At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, run Logstash again.
|
141
|
+
|
142
|
+
#### 2.2 Run in an installed Logstash
|
143
|
+
|
144
|
+
Build the gem locally and install it using:
|
145
|
+
|
146
|
+
1. Build your plugin gem:
|
147
|
+
|
148
|
+
```sh
|
149
|
+
gem build logstash-output-opensearch.gemspec
|
150
|
+
```
|
151
|
+
That’s it! Your gem should be built and be in the same path with the name
|
152
|
+
```
|
153
|
+
Successfully built RubyGem
|
154
|
+
Name: logstash-output-opensearch
|
155
|
+
Version: 1.0.0
|
156
|
+
File: logstash-output-opensearch-1.0.0.gem
|
157
|
+
```
|
158
|
+
s.version number from your gemspec file will provide the gem version, in this case, 1.0.0.
|
159
|
+
|
160
|
+
|
161
|
+
2. Install the plugin from the Logstash home:
|
162
|
+
|
163
|
+
```sh
|
164
|
+
# Logstash 2.3 and higher
|
165
|
+
bin/logstash-plugin install ~/workspace/logstash-output-opensearch/logstash-output-opensearch-1.0.0.gem
|
166
|
+
|
167
|
+
# Prior to Logstash 2.3
|
168
|
+
bin/plugin install ~/workspace/logstash-output-opensearch/logstash-output-opensearch-1.0.0.gem
|
169
|
+
```
|
170
|
+
|
171
|
+
After running this, you should see the following feedback from Logstash to test the installation:
|
172
|
+
```bash
|
173
|
+
validating ~/workspace/logstash-output-opensearch/logstash-output-opensearch-1.0.0.gem >= 0
|
174
|
+
Valid logstash plugin. Continuing...
|
175
|
+
Successfully installed 'logstash-output-opensearch' with version '1.0.0'
|
176
|
+
```
|
177
|
+
|
178
|
+
3. Start Logstash and test the plugin.
|
179
|
+
|
180
|
+
```bash
|
181
|
+
bin/logstash-plugin list
|
182
|
+
```
|
183
|
+
|
184
|
+
## Configuration for Logstash Output OpenSearch Plugin
|
185
|
+
|
186
|
+
To run the Logstash Output Opensearch plugin, add following configuration in your logstash.conf file.
|
187
|
+
|
188
|
+
```
|
189
|
+
output {
|
190
|
+
opensearch {
|
191
|
+
hosts => "https://hostname:port"
|
192
|
+
user => "admin"
|
193
|
+
password => "admin"
|
194
|
+
index => "logstash-logs-%{+YYYY.MM.dd}"
|
195
|
+
}
|
196
|
+
}
|
197
|
+
```
|
198
|
+
|
199
|
+
### Authentication
|
200
|
+
Authentication to a secure OpenSearch cluster is possible by using username/password.
|
201
|
+
|
202
|
+
### Authorization
|
203
|
+
|
204
|
+
Authorization to a secure OpenSearch cluster requires read permission at [index level](https://opensearch.org/docs/security-plugin/access-control/default-action-groups/#index-level).
|
205
|
+
|
206
|
+
## Submitting Changes
|
207
|
+
|
208
|
+
See [CONTRIBUTING](CONTRIBUTING.md).
|
data/Gemfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
#
|
3
|
+
# The OpenSearch Contributors require contributions made to
|
4
|
+
# this file be licensed under the Apache-2.0 license or a
|
5
|
+
# compatible open source license.
|
6
|
+
#
|
7
|
+
# Modifications Copyright OpenSearch Contributors. See
|
8
|
+
# GitHub history for details.
|
9
|
+
|
10
|
+
source 'https://rubygems.org'
|
11
|
+
|
12
|
+
gemspec
|
13
|
+
|
14
|
+
logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
|
15
|
+
use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
|
16
|
+
|
17
|
+
if Dir.exist?(logstash_path) && use_logstash_source
|
18
|
+
gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
|
19
|
+
gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
|
20
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
180
|
+
|
181
|
+
To apply the Apache License to your work, attach the following
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
+
replaced with your own identifying information. (Don't include
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
185
|
+
comment syntax for the file format. We also recommend that a
|
186
|
+
file or class name and description of purpose be included on the
|
187
|
+
same "printed page" as the copyright notice for easier
|
188
|
+
identification within third-party archives.
|
189
|
+
|
190
|
+
Copyright 2020 Elastic and contributors
|
191
|
+
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
+
you may not use this file except in compliance with the License.
|
194
|
+
You may obtain a copy of the License at
|
195
|
+
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
+
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
+
See the License for the specific language governing permissions and
|
202
|
+
limitations under the License.
|