Skip to content

Commit

Permalink
Upgrade java version to 3.1.1 (#39)
Browse files Browse the repository at this point in the history
* Upgrade java version to 3.1.1
  • Loading branch information
AsafMah authored Jun 1, 2022
1 parent 647b41e commit 7d1adb8
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 39 deletions.
54 changes: 26 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,51 +12,49 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
logstash-version: ['6.7', '6.8', '7.0', '7.x', 'default' ]
logstash: [
{ version: '7.17.4', url: "https://artifacts.elastic.co/downloads/logstash/logstash-7.17.4-linux-x86_64.tar.gz" , main: 'true' },
{ version: '6.8.23', url: "https://artifacts.elastic.co/downloads/logstash/logstash-6.8.23.tar.gz" , main: 'false' },
{ version: '8.2.2', url: "https://artifacts.elastic.co/downloads/logstash/logstash-8.2.2-linux-x86_64.tar.gz" , main: 'false' }
]
env:
LOGSTASH_SOURCE: 1
LOGSTASH_PATH: ..//logstash
LOGSTASH_PATH: /home/runner/logstash
JRUBY_HOME: /home/runner/logstash/vendor/jruby
steps:
- if: matrix.logstash-version != 'default'
name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- uses: ruby/setup-ruby@v1
with:
ruby-version: jruby
bundler-cache: true
- if: matrix.logstash-version != 'default'
name: Checkout logstash ${{ matrix.logstash-version }}
uses: actions/checkout@v2
with:
repository: "elastic/logstash"
ref: ${{ matrix.logstash-version }}
path: logstash
- if: matrix.logstash-version != 'default'
name: Build logstash
run: ./gradlew assemble
working-directory: logstash
- name: Build logstash
run: |
echo "Getting logstash version ${{matrix.logstash.version}}"
wget -O logstash.tar.gz ${{matrix.logstash.url}}
tar -xf logstash.tar.gz
mv logstash*/ logstash
working-directory: /home/runner
- name: Set Path
run: |
echo "$LOGSTASH_PATH/bin" >> $GITHUB_PATH
echo "$LOGSTASH_PATH/vendor/jruby/bin" >> $GITHUB_PATH
- name: Install bundler
run: jruby -S gem install bundler
- name: Checkout code
uses: actions/checkout@v2
with:
path: 'kusto'
- run: bundle install
- run: ruby -S bundle install
working-directory: 'kusto'
- name: Test
run: bundle exec rake spec_junit
run: ruby -S bundle exec rake spec_junit
working-directory: 'kusto'
- run: gem build *.gemspec
- run: ruby -S gem build *.gemspec
working-directory: 'kusto'
- run: mv *.gem logstash-kusto.gem
working-directory: 'kusto'
- if: matrix.logstash-version == 'default'
- if: matrix.logstash.main == 'true'
name: Upload gem
uses: actions/upload-artifact@v2
with:
name: logstash-kusto.gem
path: 'kusto/logstash-kusto.gem'
- if: matrix.logstash-version == 'default'
- if: matrix.logstash.main == 'true'
name: Publish Unit Test Results
uses: EnricoMi/[email protected]
with:
Expand Down Expand Up @@ -98,4 +96,4 @@ jobs:
APP_ID: ${{ secrets.APP_ID }}
APP_KEY: ${{ secrets.APP_KEY }}
TENANT_ID: ${{ secrets.TENANT_ID }}
TEST_DATABASE: ${{ secrets.TEST_DATABASE }}
TEST_DATABASE: ${{ secrets.TEST_DATABASE }}
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ if Dir.exist?(logstash_path) && use_logstash_source
gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
else
puts "using default logstash"
gem 'logstash-core'
gem 'logstash-core-plugin-api'
end

gem "rspec"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ More information about configuring Logstash can be found in the [logstash config
- JRuby 9.2 or higher, defined with openjdk 8 64bit
- Logstash, defined with openjdk 8 64bit

*It is reccomened to use the bundled jdk and jruby with logstash to avoid compatibility issues.*

To fully build the gem, run:

```shell
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ end

RSpec::Core::RakeTask.new(:spec_junit) do |t|
t.rspec_opts = '--format RspecJunitFormatter --out rspec.xml'
end
end
8 changes: 4 additions & 4 deletions lib/logstash/outputs/kusto/ingestor.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8

require 'logstash/outputs/base'
require 'logstash/outputs/base'
require 'logstash/namespace'
require 'logstash/errors'

Expand Down Expand Up @@ -34,13 +34,13 @@ def initialize(ingest_url, app_id, app_key, app_tenant, database, table, json_ma
# Unfortunately there's no way to avoid using the gem/plugin name directly...
name_for_tracing = "logstash-output-kusto:#{Gem.loaded_specs['logstash-output-kusto']&.version || "unknown"}"
@logger.debug("Client name for tracing: #{name_for_tracing}")
kusto_connection_string.setClientVersionForTracing(name_for_tracing)
kusto_connection_string.setClientVersionForTracing(name_for_tracing)

@kusto_client = kusto_java.ingest.IngestClientFactory.createClient(kusto_connection_string)

@ingestion_properties = kusto_java.ingest.IngestionProperties.new(database, table)
@ingestion_properties.setIngestionMapping(json_mapping, kusto_java.ingest.IngestionMapping::IngestionMappingKind::Json)
@ingestion_properties.setDataFormat(kusto_java.ingest.IngestionProperties::DATA_FORMAT::json)
@ingestion_properties.setIngestionMapping(json_mapping, kusto_java.ingest.IngestionMapping::IngestionMappingKind::JSON)
@ingestion_properties.setDataFormat(kusto_java.ingest.IngestionProperties::DataFormat::JSON)
@delete_local = delete_local

@logger.debug('Kusto resources are ready.')
Expand Down
5 changes: 3 additions & 2 deletions logstash-output-kusto.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'logstash-output-kusto' #WATCH OUT: we hardcoded usage of this name in one of the classes.
s.version = '1.0.3'
s.version = '1.0.4'
s.licenses = ['Apache-2.0']
s.summary = 'Writes events to Azure Data Explorer (Kusto)'
s.description = 'This is a logstash output plugin used to write events to an Azure Data Explorer (a.k.a Kusto)'
Expand Down Expand Up @@ -28,8 +28,9 @@ Gem::Specification.new do |s|
s.add_development_dependency 'flores'
s.add_development_dependency 'logstash-input-generator'
s.add_development_dependency 'ruby-maven', '~> 3.3.11'
s.add_development_dependency 'rspec_junit_formatter'

# Jar dependencies
s.requirements << "jar 'com.microsoft.azure.kusto, kusto-ingest, 2.8.2"
s.requirements << "jar 'com.microsoft.azure.kusto, kusto-ingest, 3.1.1'"
s.add_runtime_dependency 'jar-dependencies'
end
5 changes: 2 additions & 3 deletions spec/outputs/kusto_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# encoding: utf-8
require 'logstash/devutils/rspec/spec_helper'
require 'logstash/outputs/kusto'
require 'logstash/codecs/plain'
require 'logstash/event'
Expand All @@ -10,7 +9,7 @@
"ingest_url" => "https://ingest-sdkse2etest.eastus.kusto.windows.net/",
"app_id" => "myid",
"app_key" => "mykey",
"app_tenant" => "mytenant",
"app_tenant" => "mytenant",
"database" => "mydatabase",
"table" => "mytable",
"json_mapping" => "mymapping"
Expand Down Expand Up @@ -50,5 +49,5 @@
end

end

end
2 changes: 1 addition & 1 deletion spec/spec_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
$stdout = STDOUT
$stderr = STDERR
end
end
end

0 comments on commit 7d1adb8

Please sign in to comment.