logstash-output-stackify 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b2320f9ea79745878a8cbc29761a30f1b1c545d9566ae3a3ddc55b4fc218401
4
- data.tar.gz: 604531df1db73e71429b7e19f4bf319caa96742fd0f5f3f6a4b19dbea73345c6
3
+ metadata.gz: 2d53735b4035d55142125702ab144d9911c342e56978ba947cc542d204b35c9b
4
+ data.tar.gz: 3f2793baec04fa289103e4fa345eb780027166c0cb57d57db22efbea435ea21a
5
5
  SHA512:
6
- metadata.gz: 521ae011b795fbe0b6e430fa38bbb855703ac7b4f1a8c603a6adf720794669f3ed86353e9ba990706462cb326efca591e212e6496717b749e3c15190a062137e
7
- data.tar.gz: 458ec4060d1a30b0956cea9a1ee1d37f5c1cd32f4d90af730d7087470f52afe61568e3109e870f70c2c41aabd1f510c3ba352f7788b3692f87f8e910e3528226
6
+ metadata.gz: 8058d7db838a42892b6b952cff162bd0d3c761ea8451803105977824e51986b2c94c037bd2114bfedfa47b2701b11449445843e24a3ba8d966989062977cd03c
7
+ data.tar.gz: f86a936b37e833c08af6deff16dcaeb6ba6760bf690a5598bcc2968fabbed209a07dc4fe883bab4caf4da648f1b8b8a22a9826b2ff540ccc7757d5547fd39ab0
data/Gemfile CHANGED
@@ -1,3 +1,11 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
6
+ use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
7
+
8
+ if Dir.exist?(logstash_path) && use_logstash_source
9
+ gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
10
+ gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
11
+ end
data/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ Licensed under the Apache License, Version 2.0 (the "License");
2
+ you may not use this file except in compliance with the License.
3
+ You may obtain a copy of the License at
4
+
5
+ http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
data/README.md CHANGED
@@ -1,2 +1,31 @@
1
- # Logstash Plugin
2
- This is a plugin for Logstash
1
+
2
+ # Stackify Logstash Output Plugin
3
+
4
+ This is a plugin for [Logstash](https://github.com/elastic/logstash).
5
+
6
+ ## Usage
7
+
8
+ 1. Download `logstash-output-stackify-#.#.#.gem` file from https://rubygems.org/gems/logstash-output-stackify.
9
+
10
+ 2. Install
11
+ `bin/logstash-plugin install /path/to/logstash-output-stackify-#.#.#.gem`
12
+
13
+ 3. Add plugin to pipeline configuration:
14
+ ```
15
+ output {
16
+ stackify {
17
+ key => "[ACTIVATION KEY]"
18
+ }
19
+ }
20
+ ```
21
+
22
+ **Optional Configuration Options**:
23
+
24
+ * `default_env_name` - used if `env_name_field` is not defined - defaults to `Production`
25
+ * `default_app_name` - used if `app_name_field` is not defined - defaults to `Logstash`
26
+ * `env_name_field` - field to use for env name
27
+ * `server_name_field` - field to use for server name
28
+ * `app_name_field` - field to use for application name
29
+ * `level_field` - field to use for log level
30
+ * `message_field` - field to use for message - defaults to `message`
31
+
@@ -0,0 +1,28 @@
1
+
2
+ ## References
3
+
4
+ * Guide https://www.elastic.co/guide/en/logstash/5.6/_how_to_write_a_logstash_output_plugin.html
5
+
6
+ ## Install JRuby
7
+ ```
8
+ brew install jruby
9
+ jruby -S gem install bundle
10
+ ```
11
+
12
+ ## Build
13
+ ```
14
+
15
+ jruby -S bundle install
16
+ jruby -S bundle exec rspec
17
+ jruby -S gem build logstash-output-stackify.gemspec
18
+ ```
19
+
20
+ ## Install
21
+
22
+ ```
23
+ /logstash-5.6.16/bin/logstash-plugin install logstash-output-stackify-#.#.#.gem
24
+ /logstash-5.6.16/bin/logstash-plugin list
25
+ ```
26
+
27
+
28
+
@@ -8,32 +8,32 @@ require "net/https"
8
8
  require "logstash/outputs/base"
9
9
  require "logstash/namespace"
10
10
 
11
- # An example output that does nothing.
11
+ # Use logstash to ship logs to Stackify
12
12
  class LogStash::Outputs::Stackify < LogStash::Outputs::Base
13
13
  config_name "stackify"
14
14
 
15
- # activation key
15
+ # Your Stackify Activation Key
16
16
  config :key, :validate => :string, :required => true
17
17
 
18
- # default env_name
18
+ # Default Environment Name to associate to log events, used if env_name_field is not defined.
19
19
  config :default_env_name, :validate => :string, :required => false, :default => 'Production'
20
20
 
21
- # default app_name
21
+ # Default Application Name to associate to log events, used if server_name_field is not defined.
22
22
  config :default_app_name, :validate => :string, :required => false, :default => 'Logstash'
23
23
 
24
- # environment name field
24
+ # Event Field to use to populate event Environment Name.
25
25
  config :env_name_field, :validate => :string, :required => false, :default => nil
26
26
 
27
- # server name field
27
+ # Event Field to use to populate event Server name.
28
28
  config :server_name_field, :validate => :string, :required => false, :default => nil
29
29
 
30
- # application name field
30
+ # Event Field to use to populate event Application name.
31
31
  config :app_name_field, :validate => :string, :required => false, :default => nil
32
32
 
33
- # log level field
33
+ # Event Field to use to populate event level.
34
34
  config :level_field, :validate => :string, :required => false, :default => nil
35
35
 
36
- # event field to use for message
36
+ # Event Field to use to populate event message.
37
37
  config :message_field, :validate => :string, :required => false, :default => 'message'
38
38
 
39
39
  public
@@ -162,7 +162,6 @@ class LogStash::Outputs::Stackify < LogStash::Outputs::Base
162
162
  'X-Stackify-Key' => @key.to_s
163
163
  }
164
164
 
165
-
166
165
  uri = URI.parse('https://api.stackify.com/Log/Save')
167
166
  https = Net::HTTP.new(uri.host, uri.port)
168
167
  https.use_ssl = true
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-stackify'
3
- s.version = '1.0.0'
3
+ s.version = '1.0.1'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "Sends logs to Stackify"
6
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -10,7 +10,8 @@ Gem::Specification.new do |s|
10
10
  s.require_paths = ["lib"]
11
11
 
12
12
  # Files
13
- s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
13
+ s.files = Dir["lib/**/*","spec/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "docs/**/*"]
14
+
14
15
  # Tests
15
16
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
16
17
 
@@ -18,8 +19,9 @@ Gem::Specification.new do |s|
18
19
  s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" }
19
20
 
20
21
  # Gem dependencies
21
- #
22
22
  s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
23
- s.add_runtime_dependency "logstash-codec-plain"
23
+
24
24
  s.add_development_dependency 'logstash-devutils'
25
+ s.add_development_dependency 'logstash-codec-plain'
26
+ s.add_development_dependency 'rake', '~> 12.2.1' # for JRuby 1.7, Ruby 1.9
25
27
  end
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+ require 'logstash/devutils/rspec/spec_helper'
3
+ require 'logstash/outputs/stackify'
4
+
5
+ def logger_for(plugin)
6
+ plugin.instance_variable_get('@logger')
7
+ end
8
+
9
+ describe 'outputs/stackify' do
10
+ let(:config) {{'key' => 'abcdef123456'}}
11
+
12
+ let(:output) do
13
+ LogStash::Outputs::Stackify.new(config).tap do |output|
14
+ output.register
15
+ end
16
+ end
17
+
18
+ let(:event) do
19
+ LogStash::Event.new(
20
+ 'message' => 'fantastic log entry',
21
+ 'source' => 'someapp',
22
+ 'type' => 'nginx',
23
+ '@timestamp' => LogStash::Timestamp.now)
24
+ end
25
+
26
+ context 'when initializing' do
27
+ subject {LogStash::Outputs::Stackify.new(config)}
28
+
29
+ it 'should register' do
30
+ expect {subject.register}.to_not raise_error
31
+ end
32
+
33
+ it 'should have default config values' do
34
+ expect(subject.default_env_name).to eq('Production')
35
+ expect(subject.default_app_name).to eq('Logstash')
36
+ expect(subject.message_field).to eq('message')
37
+ end
38
+ end
39
+
40
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-stackify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stackify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-02 00:00:00.000000000 Z
11
+ date: 2019-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -36,9 +36,9 @@ dependencies:
36
36
  - - ">="
37
37
  - !ruby/object:Gem::Version
38
38
  version: '0'
39
- name: logstash-codec-plain
39
+ name: logstash-devutils
40
40
  prerelease: false
41
- type: :runtime
41
+ type: :development
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - ">="
@@ -50,7 +50,7 @@ dependencies:
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: '0'
53
- name: logstash-devutils
53
+ name: logstash-codec-plain
54
54
  prerelease: false
55
55
  type: :development
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,6 +58,20 @@ dependencies:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: 12.2.1
67
+ name: rake
68
+ prerelease: false
69
+ type: :development
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: 12.2.1
61
75
  description: This gem is a Logstash plugin required to be installed on top of the
62
76
  Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
63
77
  gem is not a stand-alone program
@@ -67,9 +81,12 @@ extensions: []
67
81
  extra_rdoc_files: []
68
82
  files:
69
83
  - Gemfile
84
+ - LICENSE
70
85
  - README.md
86
+ - docs/DEVELOPMENT.md
71
87
  - lib/logstash/outputs/stackify.rb
72
88
  - logstash-output-stackify.gemspec
89
+ - spec/outputs/stackify_spec.rb
73
90
  homepage: https://www.stackify.com
74
91
  licenses:
75
92
  - Apache License (2.0)
@@ -96,4 +113,5 @@ rubygems_version: 2.7.6
96
113
  signing_key:
97
114
  specification_version: 4
98
115
  summary: Sends logs to Stackify
99
- test_files: []
116
+ test_files:
117
+ - spec/outputs/stackify_spec.rb