logstash-output-qingstor 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/outputs/qingstor.rb +12 -5
- data/logstash-output-qingstor.gemspec +3 -3
- data/spec/outputs/qingstor_spec.rb +10 -0
- data/spec/outputs/spec_helper.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37cd55d01157b2c5608f05cdbcb180bf4481f211
|
4
|
+
data.tar.gz: b2a6a86bde35c314a081d2fbe5c2e7659441727c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 808e7a27ec343e15a36733cfa59c77377f19e1948f126b5299f492fdcdc0715cba6d7050529868d5d8349c2a7991a73e95a9f4826107c50c8fa43857de02d5a6
|
7
|
+
data.tar.gz: 3b7c31af1054c5c267d9e1eb4a555eb342e84d0cc3eb6cc42265a6c17f71167dc63522e5e69a9cebac0d1f9e2fd85a884aacee678ba2c9336804c641b4dd79ab
|
@@ -41,6 +41,12 @@ class LogStash::Outputs::Qingstor < LogStash::Outputs::Base
|
|
41
41
|
# The key to access your QingStor
|
42
42
|
config :secret_access_key, :validate => :string, :required => true
|
43
43
|
|
44
|
+
# If specified, it would redirect to this host address.
|
45
|
+
config :host, :validate => :string, :default => nil
|
46
|
+
|
47
|
+
# It specifies the host port, please coordinate with config 'host'.
|
48
|
+
config :port, :validate => :number, :default => 443
|
49
|
+
|
44
50
|
# The name of the qingstor bucket
|
45
51
|
config :bucket, :validate => :string, :required => true
|
46
52
|
|
@@ -65,10 +71,10 @@ class LogStash::Outputs::Qingstor < LogStash::Outputs::Base
|
|
65
71
|
config :rotation_strategy, :validate => ["size_and_time", "size", "time"], :default => "size_and_time"
|
66
72
|
|
67
73
|
# Define the size requirement for each file to upload to qingstor. In byte.
|
68
|
-
config :
|
74
|
+
config :file_size, :validate => :number, :default => 1024 * 1024 * 5
|
69
75
|
|
70
76
|
# Define the time interval for each file to upload to qingstor. In minutes.
|
71
|
-
config :
|
77
|
+
config :file_time, :validate => :number, :default => 15
|
72
78
|
|
73
79
|
# Specify maximum number of workers to use to upload the files to Qingstor
|
74
80
|
config :upload_workers_count, :validate => :number, :default => (Concurrent.processor_count * 0.5).ceil
|
@@ -138,11 +144,11 @@ class LogStash::Outputs::Qingstor < LogStash::Outputs::Base
|
|
138
144
|
def rotation_strategy
|
139
145
|
case @rotation_strategy
|
140
146
|
when "size"
|
141
|
-
SizeRotationPolicy.new(@
|
147
|
+
SizeRotationPolicy.new(@file_size)
|
142
148
|
when "time"
|
143
|
-
TimeRotationPolicy.new(@
|
149
|
+
TimeRotationPolicy.new(@file_time)
|
144
150
|
when "size_and_time"
|
145
|
-
SizeAndTimeRotationPolicy.new(@
|
151
|
+
SizeAndTimeRotationPolicy.new(@file_size, @file_time)
|
146
152
|
end
|
147
153
|
end
|
148
154
|
|
@@ -173,6 +179,7 @@ class LogStash::Outputs::Qingstor < LogStash::Outputs::Base
|
|
173
179
|
|
174
180
|
def get_bucket
|
175
181
|
@qs_config = QingStor::SDK::Config.init @access_key_id, @secret_access_key
|
182
|
+
@qs_config.update({ host: @host, port: @port }) unless @host.nil?
|
176
183
|
@qs_service = QingStor::SDK::Service.new @qs_config
|
177
184
|
@qs_service.bucket @bucket, @region
|
178
185
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-qingstor'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.1'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = 'logstash output plugin for qingstor'
|
6
|
-
s.description = '
|
6
|
+
s.description = 'Collect the outcomes of logstash into Qingstor'
|
7
7
|
s.homepage = 'https://github.com/tacinight/logstash-output-qingstor'
|
8
8
|
s.authors = ['Evan Zhao']
|
9
9
|
s.email = 'tacingiht@gmail.com'
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
# Gem dependencies
|
21
21
|
s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
|
22
22
|
s.add_runtime_dependency "logstash-codec-plain"
|
23
|
-
s.add_runtime_dependency "qingstor-sdk", "
|
23
|
+
s.add_runtime_dependency "qingstor-sdk", ">=1.9.2"
|
24
24
|
s.add_runtime_dependency "concurrent-ruby"
|
25
25
|
|
26
26
|
s.add_development_dependency "stud", "~> 0.0.22"
|
@@ -47,4 +47,14 @@ describe LogStash::Outputs::Qingstor do
|
|
47
47
|
expect(list_remote_file.size).to eq(2)
|
48
48
|
end
|
49
49
|
|
50
|
+
it "redirect to the specified host without specified port" do
|
51
|
+
new_options = options.merge({"host" => "qingstor.dev", "port" => 444})
|
52
|
+
expect{fetch_event(new_options, events_and_encoded)}.to raise_error(Net::HTTP::Persistent::Error)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "redirect to the specified host without specified port" do
|
56
|
+
new_options = options.merge({"host" => "qingstor.dev", "port" => 444})
|
57
|
+
expect{fetch_event(new_options, events_and_encoded)}.to raise_error(Net::HTTP::Persistent::Error)
|
58
|
+
end
|
59
|
+
|
50
60
|
end
|
data/spec/outputs/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-qingstor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Zhao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -41,7 +41,7 @@ dependencies:
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 1.9.2
|
47
47
|
name: qingstor-sdk
|
@@ -49,7 +49,7 @@ dependencies:
|
|
49
49
|
type: :runtime
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.9.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
description:
|
97
|
+
description: Collect the outcomes of logstash into Qingstor
|
98
98
|
email: tacingiht@gmail.com
|
99
99
|
executables: []
|
100
100
|
extensions: []
|