Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update logstash dependency in logstash-output-loki plugin #4930

Merged
merged 1 commit into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions clients/cmd/logstash/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM logstash:7.9.3
FROM logstash:7.16.1

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 PATH /usr/share/logstash/vendor/jruby/bin:/usr/share/logstash/vendor/bundle/jruby/2.5.0/bin:/usr/share/logstash/jdk/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

Expand All @@ -11,8 +11,9 @@ RUN gem install bundler:2.1.4
COPY --chown=logstash:logstash ./clients/cmd/logstash/ /home/logstash/
WORKDIR /home/logstash/


RUN bundle install --path=/usr/share/logstash/vendor/bundle && \
RUN bundle config set --local path /usr/share/logstash/vendor/bundle && \
bundle install && \
bundle update && \
bundle exec rake vendor && \
bundle exec rspec

Expand Down
34 changes: 23 additions & 11 deletions clients/cmd/logstash/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
```

Then install bundler
`gem install bundler:2.1.4`
Then install bundler:

```bash
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.

Expand All @@ -41,36 +44,45 @@ Follow those instructions to [install logstash](https://www.elastic.co/guide/en/
```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
git checkout tags/v7.16.1
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 config set --local path "$LOGSTASH_PATH/vendor/bundle"
ruby -S bundle install
ruby -S bundle exec rake vendor
```

### Build the plugin

`gem build logstash-output-loki.gemspec`
```bash
gem build logstash-output-loki.gemspec
```

### Test

`ruby -S bundle exec rspec`
```bash
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
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`
```bash
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`
```bash
bin/logstash -f loki.conf
```
2 changes: 1 addition & 1 deletion clients/cmd/logstash/logstash-output-loki.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ Gem::Specification.new do |s|
# Gem dependencies
#
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
s.add_runtime_dependency "logstash-codec-plain", "3.0.6"
s.add_runtime_dependency "logstash-codec-plain", "3.1.0"
s.add_development_dependency 'logstash-devutils', "2.0.2"
end