Skip to content

Commit e76686e

Browse files
authored
Version 0.2.0 (#7)
* Include Kusto SDK 1.0.0-BETA-01, include some tests, fix password bug * change logstash branch from 6.0 to 6.5 to make ci pass
1 parent 946394b commit e76686e

File tree

13 files changed

+270
-15
lines changed

13 files changed

+270
-15
lines changed

.travis.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
sudo: false
2+
language: ruby
3+
cache: bundler
4+
matrix:
5+
include:
6+
- rvm: jruby-9.1.13.0
7+
env: LOGSTASH_BRANCH=master
8+
- rvm: jruby-9.1.13.0
9+
env: LOGSTASH_BRANCH=6.x
10+
- rvm: jruby-9.1.13.0
11+
env: LOGSTASH_BRANCH=6.5
12+
fast_finish: true
13+
install: true
14+
script: ci/build.sh
15+
jdk: oraclejdk8
16+
deploy:
17+
provider: rubygems
18+
api_key: $rubygems_api_key
19+
on:
20+
tags: true

.vscode/tasks.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@
1111
"kind": "build",
1212
"isDefault": true
1313
}
14+
},
15+
{
16+
"label": "Run tests",
17+
"type": "shell",
18+
"command": "bundle exec rspec spec",
19+
"group": {
20+
"kind": "build",
21+
"isDefault": true
22+
}
1423
}
1524
]
1625
}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22
- Plugin created with the logstash plugin generator
33
## 0.1.6
44
- plugin published to the public. supports ingestion json events into a specific table-database (without dynamic routing currently)
5+
## 0.1.7
6+
- fixed app_key (password) bug, include 0.1.7 of the kusto-java-sdk to allow working through a proxy
7+
## 0.2.0
8+
- move to version 1.0.0-BETA-01 of azure-kusto-kava sdk

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Logstash Output Plugin for Azure Data Explorer (Kusto)
22

3-
[![Travis Build Status](https://travis-ci.org/Azure/logstash-output-kusto.svg)](https://travis-ci.org/Azure/logstash-output-kusto)
3+
master: [![Build Status](https://travis-ci.org/Azure/logstash-output-kusto.svg)](https://travis-ci.org/Azure/logstash-output-kusto)
4+
dev: [![Build Status](https://travis-ci.org/Azure/logstash-output-kusto.svg?branch=dev)](https://travis-ci.org/Azure/logstash-output-kusto)
45

56
This is a plugin for [Logstash](https://github.com/elastic/logstash).
67

ci/build.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
# version: 1
3+
########################################################
4+
#
5+
# AUTOMATICALLY GENERATED! DO NOT EDIT
6+
#
7+
########################################################
8+
set -e
9+
10+
echo "Starting build process in: `pwd`"
11+
source ./ci/setup.sh
12+
13+
if [[ -f "ci/run.sh" ]]; then
14+
echo "Running custom build script in: `pwd`/ci/run.sh"
15+
source ./ci/run.sh
16+
else
17+
echo "Running default build scripts in: `pwd`/ci/build.sh"
18+
bundle install
19+
bundle exec rake vendor
20+
bundle exec rspec spec
21+
fi

ci/setup.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
# version: 1
3+
########################################################
4+
#
5+
# AUTOMATICALLY GENERATED! DO NOT EDIT
6+
#
7+
########################################################
8+
set -e
9+
if [ "$LOGSTASH_BRANCH" ]; then
10+
echo "Building plugin using Logstash source"
11+
BASE_DIR=`pwd`
12+
echo "Checking out branch: $LOGSTASH_BRANCH"
13+
git clone -b $LOGSTASH_BRANCH https://github.com/elastic/logstash.git ../../logstash --depth 1
14+
printf "Checked out Logstash revision: %s\n" "$(git -C ../../logstash rev-parse HEAD)"
15+
cd ../../logstash
16+
echo "Building plugins with Logstash version:"
17+
cat versions.yml
18+
echo "---"
19+
# We need to build the jars for that specific version
20+
echo "Running gradle assemble in: `pwd`"
21+
./gradlew assemble
22+
cd $BASE_DIR
23+
export LOGSTASH_SOURCE=1
24+
else
25+
echo "Building plugin using released gems on rubygems"
26+
fi

lib/logstash/outputs/kusto.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
require 'logstash/outputs/kusto/interval'
99

1010
##
11-
# This plugin send messages to Azure Kusto in batches.
11+
# This plugin sends messages to Azure Kusto in batches.
1212
#
1313
class LogStash::Outputs::Kusto < LogStash::Outputs::Base
1414
config_name 'kusto'
@@ -152,9 +152,14 @@ def register
152152
private
153153
def validate_path
154154
if (root_directory =~ FIELD_REF) != nil
155-
@logger.error('File: The starting part of the path should not be dynamic.', path: @path)
155+
@logger.error('The starting part of the path should not be dynamic.', path: @path)
156156
raise LogStash::ConfigurationError.new('The starting part of the path should not be dynamic.')
157157
end
158+
159+
if !path_with_field_ref?
160+
@logger.error('Path should include some time related fields to allow for file rotation.', path: @path)
161+
raise LogStash::ConfigurationError.new('Path should include some time related fields to allow for file rotation.')
162+
end
158163
end
159164

160165
private

lib/logstash/outputs/kusto/ingestor.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class LogStash::Outputs::Kusto < LogStash::Outputs::Base
99
# This handles the overall logic and communication with Kusto
1010
#
1111
class Ingestor
12-
require 'kusto/KustoClient-0.1.6.jar'
12+
require 'kusto/kusto-ingest-1.0.0-BETA-01-jar-with-dependencies.jar'
1313

1414
RETRY_DELAY_SECONDS = 3
1515
DEFAULT_THREADPOOL = Concurrent::ThreadPoolExecutor.new(
@@ -29,11 +29,11 @@ def initialize(ingest_url, app_id, app_key, app_tenant, database, table, mapping
2929

3030
@logger.debug('Preparing Kusto resources.')
3131

32-
kusto_connection_string = Java::KustoConnectionStringBuilder.createWithAadApplicationCredentials(ingest_url, app_id, app_key, app_tenant)
32+
kusto_connection_string = Java::com.microsoft.azure.kusto.data.ConnectionStringBuilder.createWithAadApplicationCredentials(ingest_url, app_id, app_key.value, app_tenant)
3333

34-
@kusto_client = Java::KustoIngestClient.new(kusto_connection_string)
34+
@kusto_client = Java::com.microsoft.azure.kusto.ingest.IngestClientFactory.createClient(kusto_connection_string)
3535

36-
@ingestion_properties = Java::KustoIngestionProperties.new(database, table)
36+
@ingestion_properties = Java::com.microsoft.azure.kusto.ingest.IngestionProperties.new(database, table)
3737
@ingestion_properties.setJsonMappingName(mapping)
3838

3939
@delete_local = delete_local
@@ -48,12 +48,12 @@ def validate_config(database, table, mapping)
4848
end
4949

5050
if table =~ FIELD_REF
51-
@logger.error('table config value should not be dynamic.', database)
51+
@logger.error('table config value should not be dynamic.', table)
5252
raise LogStash::ConfigurationError.new('table config value should not be dynamic.')
5353
end
5454

5555
if mapping =~ FIELD_REF
56-
@logger.error('mapping config value should not be dynamic.', database)
56+
@logger.error('mapping config value should not be dynamic.', mapping)
5757
raise LogStash::ConfigurationError.new('mapping config value should not be dynamic.')
5858
end
5959
end
@@ -90,7 +90,8 @@ def upload(path, delete_on_success)
9090
# local_ingestion_properties.addJsonMappingName(mapping)
9191
# end
9292

93-
@kusto_client.ingestFromSingleFile(path, @ingestion_properties)
93+
file_source_info = Java::com.microsoft.azure.kusto.ingest.source.FileSourceInfo.new(path, 0); # 0 - let the sdk figure out the size of the file
94+
@kusto_client.ingestFromFile(file_source_info, @ingestion_properties)
9495

9596
File.delete(path) if delete_on_success
9697

logstash-output-kusto.gemspec

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
Gem::Specification.new do |s|
22
s.name = 'logstash-output-kusto'
3-
s.version = '0.1.6'
3+
s.version = '0.2.0'
44
s.licenses = ['Apache-2.0']
5-
s.summary = 'Writes events to Azure KustoDB'
6-
s.description = 'This is a logstash output plugin used to write events to an Azure KustoDB instance'
7-
s.homepage = 'https://github.com/Azure/azure-diagnostics-tools/tree/master/Logstash'
5+
s.summary = 'Writes events to Azure Data Explorer (Kusto)'
6+
s.description = 'This is a logstash output plugin used to write events to an Azure Data Explorer (a.k.a Kusto)'
7+
s.homepage = 'https://github.com/Azure/logstash-output-kusto'
88
s.authors = ['Tamir Kamara']
9-
s.email = 'tamir.kamara@microsoft.com'
9+
s.email = 'nugetkusto@microsoft.com'
1010
s.require_paths = ['lib']
1111

1212
# Files

0 commit comments

Comments
 (0)