Родитель
647b41e16f
Коммит
7d1adb8aa8
|
@ -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/publish-unit-test-result-action@v1.6
|
||||
with:
|
||||
|
@ -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
Gemfile
2
Gemfile
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
2
Rakefile
2
Rakefile
|
@ -14,4 +14,4 @@ end
|
|||
|
||||
RSpec::Core::RakeTask.new(:spec_junit) do |t|
|
||||
t.rspec_opts = '--format RspecJunitFormatter --out rspec.xml'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'logstash/outputs/base'
|
||||
require 'logstash/outputs/base'
|
||||
require 'logstash/namespace'
|
||||
require 'logstash/errors'
|
||||
|
||||
|
@ -34,13 +34,13 @@ class LogStash::Outputs::Kusto < LogStash::Outputs::Base
|
|||
# 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.')
|
||||
|
|
|
@ -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)'
|
||||
|
@ -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
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# encoding: utf-8
|
||||
require 'logstash/devutils/rspec/spec_helper'
|
||||
require 'logstash/outputs/kusto'
|
||||
require 'logstash/codecs/plain'
|
||||
require 'logstash/event'
|
||||
|
@ -10,7 +9,7 @@ describe LogStash::Outputs::Kusto do
|
|||
"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"
|
||||
|
@ -50,5 +49,5 @@ describe LogStash::Outputs::Kusto do
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -18,4 +18,4 @@ RSpec.configure do |config|
|
|||
$stdout = STDOUT
|
||||
$stderr = STDERR
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче