-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Logstash plugin * include_labels * include_labels * Removes binary. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * Improve documentation and remove the push path. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * Move to cmd. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * Add more precision for jruby. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * Update docs/clients/logstash/README.md * p Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * ignore Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * remove ignore file/ Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * More precision for installing jruby Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * Rename without Grafana Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * A lot of refactoring and testing. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * change delay logic * Fully tested version. Now testing/writing docs and charts. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * Forgot to save merge. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * working version. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * Makefile + easier docker build. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * adds ci to build logstash image. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * Fix build for logstash. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * Adds example with helm charts. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * Fix target to send 10 logs with logstash. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * Improved documentation. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * add missing helm add repo for external repo Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * Review comment. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * Fixes loki service in Promtail. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * Update loki-stack version Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> Co-authored-by: Cyril Tovena <cyril.tovena@gmail.com>
- Loading branch information
1 parent
99604a5
commit 4c60907
Showing
23 changed files
with
1,285 additions
and
4 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
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
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
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
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 | ||
.ruby-version | ||
.bundle | ||
logstash | ||
path | ||
!lib | ||
.rakeTasks |
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,24 @@ | ||
FROM logstash:7.6.2 | ||
|
||
USER logstash | ||
ENV PATH /usr/share/logstash/vendor/jruby/bin:/usr/share/logstash/vendor/bundle/jruby/2.5.0/bin:$PATH | ||
ENV LOGSTASH_PATH="/usr/share/logstash" | ||
ENV GEM_PATH /usr/share/logstash/vendor/bundle/jruby/2.5.0 | ||
ENV GEM_HOME /usr/share/logstash/vendor/bundle/jruby/2.5.0 | ||
|
||
RUN gem install bundler:2.1.4 | ||
|
||
COPY --chown=logstash:logstash ./cmd/logstash/ /home/logstash/ | ||
WORKDIR /home/logstash/ | ||
|
||
|
||
RUN bundle install --path=/usr/share/logstash/vendor/bundle && \ | ||
bundle exec rake vendor && \ | ||
bundle exec rspec | ||
|
||
RUN cat logstash-output-loki.gemspec | grep s.version | awk '{print $3}' | cut -d "'" -f 2 > VERSION | ||
|
||
RUN gem build logstash-output-loki.gemspec && \ | ||
PLUGIN_VERSION=$(cat VERSION); /usr/share/logstash/bin/logstash-plugin install logstash-output-loki-${PLUGIN_VERSION}.gem | ||
|
||
EXPOSE 5044 |
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,14 @@ | ||
source 'https://rubygems.org' | ||
|
||
gemspec | ||
|
||
logstash_path = ENV["LOGSTASH_PATH"] || "./logstash" | ||
|
||
if Dir.exist?(logstash_path) | ||
gem 'logstash-core', :path => "#{logstash_path}/logstash-core" | ||
gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api" | ||
else | ||
raise 'missing logstash vendoring' | ||
end | ||
|
||
gem "webmock", "~> 3.8" |
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,74 @@ | ||
# Contributing to Loki Logstash Output Plugin | ||
|
||
For information about hwo to use this plugin see this [documentation](../../docs/clients/logstash/README.md). | ||
|
||
## Install dependencies | ||
|
||
First you need to setup JRuby environment to build this plugin. Refer https://github.com/rbenv/rbenv for setting up your rbenv environment. | ||
|
||
After setting up `rbenv`. Install JRuby | ||
|
||
```bash | ||
rbenv install jruby-9.2.10.0 | ||
rbenv local jruby-9.2.10.0 | ||
``` | ||
|
||
Check that the environment is configured | ||
|
||
```bash | ||
ruby --version | ||
jruby 9.2.10 | ||
``` | ||
|
||
You should use make sure you are running jruby and not ruby. If the command below still shows ruby and not jruby, check that PATH contains `$HOME/.rbenv/shims` and `$HOME/.rbenv/bin`. Also verify that you have this in your bash profile: | ||
|
||
```bash | ||
export PATH="$HOME/.rbenv/bin:$PATH" | ||
eval "$(rbenv init -)" | ||
``` | ||
|
||
Then install bundler | ||
`gem install bundler:2.1.4` | ||
|
||
Follow those instructions to [install logstash](https://www.elastic.co/guide/en/logstash/current/installing-logstash.html) before moving to the next section. | ||
|
||
## Install dependencies and Build plugin | ||
|
||
### Install required packages | ||
|
||
```bash | ||
git clone git@github.com:elastic/logstash.git | ||
cd logstash | ||
git checkout tags/v7.6.2 | ||
export LOGSTASH_PATH=`pwd` | ||
export GEM_PATH=$LOGSTASH_PATH/vendor/bundle/jruby/2.5.0 | ||
export GEM_HOME=$LOGSTASH_PATH/vendor/bundle/jruby/2.5.0 | ||
./gradlew assemble | ||
cd .. | ||
ruby -S bundle install | ||
ruby -S bundle exec rake vendor | ||
``` | ||
|
||
### Build the plugin | ||
|
||
`gem build logstash-output-loki.gemspec` | ||
|
||
### Test | ||
|
||
`ruby -S bundle exec rspec` | ||
|
||
Alternatively if you don't want to install JRuby. Enter inside logstash-loki container. | ||
|
||
```bash | ||
docker build -t logstash-loki ./ | ||
docker run -v `pwd`/spec:/home/logstash/spec -it --rm --entrypoint /bin/sh logstash-loki | ||
bundle exec rspec | ||
``` | ||
|
||
## Install plugin to local logstash | ||
|
||
`bin/logstash-plugin install --no-verify --local logstash-output-loki-1.0.0.gem` | ||
|
||
## Send sample event and check plugin is working | ||
|
||
`bin/logstash -f loki.conf` |
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 @@ | ||
require "logstash/devutils/rake" |
Oops, something went wrong.