logstash-input-kinesis 1.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 39f76c083f83979183452b77aa688f68b3205715
4
+ data.tar.gz: 9f953db2fd1761396b64802444d92a791ddb84a7
5
+ SHA512:
6
+ metadata.gz: 2f7a691a7b5acf4c4f425b1e55fd0bb9535ea018ac0d01436af4fbbce9dc72174b17096c485f75b754b9f8bd9f53ac8f96e968f903d7d1fc98f1e744b94b1569
7
+ data.tar.gz: 033ba37be51948030ba19ebfc962d609667ee6fb1550005d2ed9f149704b15cae470818a79c2d91d484ff752d5b16f3e4af53cb36b888507829f2b16719fc2b5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in logstash-input-kinesis.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,14 @@
1
+ Copyright (c) 2015 Brian Palmer
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # Logstash AWS Kinesis Input Plugin
2
+
3
+ This is a plugin for [Logstash](https://github.com/elasticsearch/logstash).
4
+
5
+ ## Installation
6
+
7
+ This plugin requires Logstash 1.5, and can be installed by Logstash
8
+ itself.
9
+
10
+ ```sh
11
+ $(LOGSTASH_DIR)/bin/plugin install logstash-input-kinesis
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```
17
+ input {
18
+ kinesis {
19
+ kinesis_stream_name => "my-logging-stream"
20
+ codec => json { }
21
+ }
22
+ }
23
+ ```
24
+
25
+ At least `kinesis_stream_name` is requred.
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it ( https://github.com/codekitchen/logstash-input-kinesis/fork )
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,93 @@
1
+ # encoding: utf-8
2
+ require "logstash/inputs/base"
3
+ require "logstash/errors"
4
+ require "logstash/environment"
5
+ require "logstash/namespace"
6
+
7
+ require "logstash/inputs/kinesis/version"
8
+ require 'logstash-input-kinesis_jars'
9
+
10
+ class LogStash::Inputs::Kinesis < LogStash::Inputs::Base
11
+ KCL = com.amazonaws.services.kinesis.clientlibrary.lib.worker
12
+
13
+ config_name 'kinesis'
14
+ milestone 1
15
+
16
+ # The application name used for the dynamodb coordination table. Must be
17
+ # unique for this kinesis stream.
18
+ config :application_name, :validate => :string, :default => "logstash"
19
+
20
+ # The kinesis stream name.
21
+ config :kinesis_stream_name, :validate => :string, :required => true
22
+
23
+ def register
24
+ # the INFO log level is extremely noisy in KCL
25
+ org.apache.commons.logging::LogFactory.getLog("com.amazonaws.services.kinesis").
26
+ logger.setLevel(java.util.logging::Level::WARNING)
27
+
28
+ worker_id = java.util::UUID.randomUUID.to_s
29
+ creds = com.amazonaws.auth::DefaultAWSCredentialsProviderChain.new()
30
+ @config = KCL::KinesisClientLibConfiguration.new(
31
+ @application_name,
32
+ @kinesis_stream_name,
33
+ creds,
34
+ worker_id).withInitialPositionInStream(KCL::InitialPositionInStream::TRIM_HORIZON)
35
+ end
36
+
37
+ def run(output_queue)
38
+ worker_factory = WorkerFactory.new(@codec, output_queue, method(:decorate))
39
+ @worker = KCL::Worker.new(
40
+ worker_factory,
41
+ @config,
42
+ com.amazonaws.services.kinesis.metrics.impl::NullMetricsFactory.new)
43
+ @worker.run()
44
+ end
45
+
46
+ def teardown
47
+ @worker.shutdown if @worker
48
+ end
49
+
50
+ class WorkerFactory
51
+ include com.amazonaws.services.kinesis.clientlibrary.interfaces::IRecordProcessorFactory
52
+ def initialize(codec, output_queue, decorator)
53
+ @codec = codec
54
+ @output_queue = output_queue
55
+ @decorator = decorator
56
+ end
57
+
58
+ def createProcessor
59
+ Worker.new(@codec.clone, @output_queue, @decorator)
60
+ end
61
+ end
62
+
63
+ class Worker
64
+ include com.amazonaws.services.kinesis.clientlibrary.interfaces::IRecordProcessor
65
+
66
+ def initialize(*args)
67
+ # nasty hack, because this is the name of a method on IRecordProcessor, but also ruby's constructor
68
+ if !@constructed
69
+ @codec, @output_queue, @decorator = args
70
+ @constructed = true
71
+ else
72
+ _shard_id, _ = args
73
+ @decoder = java.nio.charset::Charset.forName("UTF-8").newDecoder()
74
+ end
75
+ end
76
+
77
+ def processRecords(records, checkpointer)
78
+ records.each { |record| process_record(record) }
79
+ checkpointer.checkpoint()
80
+ end
81
+
82
+ def shutdown(checkpointer, reason)
83
+ end
84
+
85
+ def process_record(record)
86
+ raw = @decoder.decode(record.getData).to_s
87
+ @codec.decode(raw) do |event|
88
+ @decorator.call(event)
89
+ @output_queue << event
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,7 @@
1
+ module Logstash
2
+ module Input
3
+ module Kinesis
4
+ VERSION = "1.0.0"
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logstash-input-kinesis
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: java
6
+ authors:
7
+ - Brian Palmer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - '='
17
+ - !ruby/object:Gem::Version
18
+ version: 0.1.7
19
+ name: jar-dependencies
20
+ prerelease: false
21
+ type: :runtime
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.7
27
+ - !ruby/object:Gem::Dependency
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - '='
31
+ - !ruby/object:Gem::Version
32
+ version: 3.1.1.0.8
33
+ name: ruby-maven
34
+ prerelease: false
35
+ type: :runtime
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 3.1.1.0.8
41
+ - !ruby/object:Gem::Dependency
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '='
45
+ - !ruby/object:Gem::Version
46
+ version: 1.0.7
47
+ name: maven-tools
48
+ prerelease: false
49
+ type: :runtime
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.7
55
+ - !ruby/object:Gem::Dependency
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ version: '1.7'
61
+ name: bundler
62
+ prerelease: false
63
+ type: :development
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.7'
69
+ - !ruby/object:Gem::Dependency
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ~>
73
+ - !ruby/object:Gem::Version
74
+ version: '10.0'
75
+ name: rake
76
+ prerelease: false
77
+ type: :development
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ description: This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program
84
+ email:
85
+ - brian@codekitchen.net
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - Gemfile
91
+ - LICENSE.txt
92
+ - README.md
93
+ - Rakefile
94
+ - lib/logstash/inputs/kinesis.rb
95
+ - lib/logstash/inputs/kinesis/version.rb
96
+ homepage: https://github.com/codekitchen/logstash-input-kinesis
97
+ licenses:
98
+ - Apache License (2.0)
99
+ metadata:
100
+ logstash_plugin: 'true'
101
+ logstash_group: input
102
+ post_install_message:
103
+ rdoc_options: []
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ requirements:
117
+ - jar 'com.amazonaws:amazon-kinesis-client', '1.2.1'
118
+ rubyforge_project:
119
+ rubygems_version: 2.1.9
120
+ signing_key:
121
+ specification_version: 4
122
+ summary: Logstash plugin for Kinesis input
123
+ test_files: []