logstash-input-courier 1.7 → 1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/inputs/courier.rb +59 -37
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7981989158bbbf5c236b66a14ccd472e78614599
|
4
|
+
data.tar.gz: fe9f9f20dca027e2f7c4bb585941e7d7136b8adc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23121ed9af2f33fd88809f076642e89e98240aff9283324e2a8e923ab805ca1627d0ca958a578b38b2c19c71038ad13568b25cdc2df282cc18b0f898b2a3f6db
|
7
|
+
data.tar.gz: 65d71d81c6cf395bfb1db87ccef473f636eb4ed2ae8a8b8f6b2f2bd21afd512f4738ece50445030bffeb889f5af6c7cc43800b1e639c205c13dde232a284ea2d
|
@@ -17,46 +17,55 @@
|
|
17
17
|
# See the License for the specific language governing permissions and
|
18
18
|
# limitations under the License.
|
19
19
|
|
20
|
+
require 'logstash/version'
|
21
|
+
require 'rubygems/version'
|
22
|
+
|
20
23
|
module LogStash
|
21
24
|
module Inputs
|
22
25
|
# Receive events over the Log Courier protocol
|
23
26
|
class Courier < LogStash::Inputs::Base
|
24
27
|
config_name 'courier'
|
25
28
|
|
29
|
+
# Compatibility with Logstash 1.4 requires milestone
|
30
|
+
if Gem::Version.new(LOGSTASH_VERSION) < Gem::Version.new('1.5.0')
|
31
|
+
milestone 2
|
32
|
+
end
|
33
|
+
|
26
34
|
default :codec, 'plain'
|
27
35
|
|
28
36
|
# The IP address to listen on
|
29
|
-
config :host, :
|
37
|
+
config :host, validate: :string, default: '0.0.0.0'
|
30
38
|
|
31
39
|
# The port to listen on
|
32
|
-
config :port, :
|
40
|
+
config :port, validate: :number, required: true
|
33
41
|
|
34
42
|
# The transport type to use
|
35
|
-
config :transport, :
|
43
|
+
config :transport, validate: :string, default: 'tls'
|
36
44
|
|
37
45
|
# SSL certificate to use
|
38
|
-
config :ssl_certificate, :
|
46
|
+
config :ssl_certificate, validate: :path
|
39
47
|
|
40
48
|
# SSL key to use
|
41
|
-
config :ssl_key, :
|
49
|
+
config :ssl_key, validate: :path
|
42
50
|
|
43
51
|
# SSL key passphrase to use
|
44
|
-
config :ssl_key_passphrase, :
|
52
|
+
config :ssl_key_passphrase, validate: :password
|
45
53
|
|
46
54
|
# Whether or not to verify client certificates
|
47
|
-
config :ssl_verify, :
|
55
|
+
config :ssl_verify, validate: :boolean, default: false
|
48
56
|
|
49
|
-
# When verifying client certificates, also trust those signed by the
|
50
|
-
|
57
|
+
# When verifying client certificates, also trust those signed by the
|
58
|
+
# system's default CA bundle
|
59
|
+
config :ssl_verify_default_ca, validate: :boolean, default: false
|
51
60
|
|
52
61
|
# CA certificate to use when verifying client certificates
|
53
|
-
config :ssl_verify_ca, :
|
62
|
+
config :ssl_verify_ca, validate: :path
|
54
63
|
|
55
64
|
# Curve secret key
|
56
|
-
config :curve_secret_key, :
|
65
|
+
config :curve_secret_key, validate: :string
|
57
66
|
|
58
67
|
# Max packet size
|
59
|
-
config :max_packet_size, :
|
68
|
+
config :max_packet_size, validate: :number
|
60
69
|
|
61
70
|
# The size of the internal queue for each peer
|
62
71
|
#
|
@@ -64,7 +73,7 @@ module LogStash
|
|
64
73
|
#
|
65
74
|
# This setting should max the max_pending_payloads Log Courier
|
66
75
|
# configuration
|
67
|
-
config :peer_recv_queue, :
|
76
|
+
config :peer_recv_queue, validate: :number
|
68
77
|
|
69
78
|
# Add additional fields to events that identity the peer
|
70
79
|
#
|
@@ -73,46 +82,59 @@ module LogStash
|
|
73
82
|
# "peer" identifies the source host and port
|
74
83
|
# "peer_ssl_cn" contains the client certificate hostname for TLS peers
|
75
84
|
# using client certificates
|
76
|
-
config :add_peer_fields, :
|
85
|
+
config :add_peer_fields, validate: :boolean
|
77
86
|
|
78
87
|
public
|
79
88
|
|
80
89
|
def register
|
81
|
-
@logger.info
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
address: @host,
|
86
|
-
port: @port,
|
87
|
-
transport: @transport,
|
88
|
-
ssl_certificate: @ssl_certificate,
|
89
|
-
ssl_key: @ssl_key,
|
90
|
-
ssl_key_passphrase: @ssl_key_passphrase,
|
91
|
-
ssl_verify: @ssl_verify,
|
92
|
-
ssl_verify_default_ca: @ssl_verify_default_ca,
|
93
|
-
ssl_verify_ca: @ssl_verify_ca,
|
94
|
-
curve_secret_key: @curve_secret_key,
|
95
|
-
}
|
96
|
-
|
97
|
-
# Honour the defaults in the LogCourier gem
|
98
|
-
options[:max_packet_size] = @max_packet_size unless @max_packet_size.nil?
|
99
|
-
options[:peer_recv_queue] = @peer_recv_queue unless @peer_recv_queue.nil?
|
100
|
-
options[:add_peer_fields] = @add_peer_fields unless @add_peer_fields.nil?
|
90
|
+
@logger.info(
|
91
|
+
'Starting courier input listener',
|
92
|
+
address: "#{@host}:#{@port}"
|
93
|
+
)
|
101
94
|
|
102
95
|
require 'log-courier/server'
|
103
96
|
@log_courier = LogCourier::Server.new options
|
104
97
|
end
|
105
98
|
|
106
|
-
public
|
107
|
-
|
108
99
|
def run(output_queue)
|
109
100
|
@log_courier.run do |event|
|
110
|
-
|
101
|
+
if event.key?('tags') && !event['tags'].is_a?(Array)
|
102
|
+
event['tags'] = [event['tags']]
|
103
|
+
end
|
111
104
|
event = LogStash::Event.new(event)
|
112
105
|
decorate event
|
113
106
|
output_queue << event
|
114
107
|
end
|
115
108
|
end
|
109
|
+
|
110
|
+
private
|
111
|
+
|
112
|
+
def options
|
113
|
+
result = {}
|
114
|
+
|
115
|
+
[
|
116
|
+
:logger, :address, :port, :transport, :ssl_certificate, :ssl_key,
|
117
|
+
:ssl_key_passphrase, :ssl_verify, :ssl_verify_default_ca,
|
118
|
+
:curve_secret_key
|
119
|
+
].each do |k|
|
120
|
+
result[k] = send(k)
|
121
|
+
end
|
122
|
+
|
123
|
+
add_override_options result
|
124
|
+
end
|
125
|
+
|
126
|
+
def add_override_options(result)
|
127
|
+
# Honour the defaults in the LogCourier gem
|
128
|
+
[:max_packet_size, :peer_recv_queue, :add_peer_fields].each do |k|
|
129
|
+
result[k] = send(k) unless send(k).nil?
|
130
|
+
end
|
131
|
+
result
|
132
|
+
end
|
133
|
+
|
134
|
+
def address
|
135
|
+
# TODO: Fix this naming inconsistency
|
136
|
+
@host
|
137
|
+
end
|
116
138
|
end
|
117
139
|
end
|
118
140
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-courier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.8'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Woods
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06
|
11
|
+
date: 2015-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-core
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.8'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.8'
|
41
41
|
description: Log Courier Input Logstash Plugin
|
42
42
|
email:
|
43
43
|
- devel@jasonwoods.me.uk
|