sp-logstash-input-http 3.3.7-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,346 @@
1
+ :plugin: http
2
+ :type: input
3
+ :default_codec: plain
4
+
5
+ ///////////////////////////////////////////
6
+ START - GENERATED VARIABLES, DO NOT EDIT!
7
+ ///////////////////////////////////////////
8
+ :version: %VERSION%
9
+ :release_date: %RELEASE_DATE%
10
+ :changelog_url: %CHANGELOG_URL%
11
+ :include_path: ../../../../logstash/docs/include
12
+ ///////////////////////////////////////////
13
+ END - GENERATED VARIABLES, DO NOT EDIT!
14
+ ///////////////////////////////////////////
15
+
16
+ [id="plugins-{type}s-{plugin}"]
17
+
18
+ === Http input plugin
19
+
20
+ include::{include_path}/plugin_header.asciidoc[]
21
+
22
+ ==== Description
23
+
24
+ Using this input you can receive single or multiline events over http(s).
25
+ Applications can send an HTTP request to the endpoint started by this input and
26
+ Logstash will convert it into an event for subsequent processing. Users
27
+ can pass plain text, JSON, or any formatted data and use a corresponding codec with this
28
+ input. For Content-Type `application/json` the `json` codec is used, but for all other
29
+ data formats, `plain` codec is used.
30
+
31
+ This input can also be used to receive webhook requests to integrate with other services
32
+ and applications. By taking advantage of the vast plugin ecosystem available in Logstash
33
+ you can trigger actionable events right from your application.
34
+
35
+ ==== Blocking Behavior
36
+
37
+ The HTTP protocol doesn't deal well with long running requests. This plugin will either return
38
+ a 429 (busy) error when Logstash is backlogged, or it will time out the request.
39
+
40
+ If a 429 error is encountered clients should sleep, backing off exponentially with some random
41
+ jitter, then retry their request.
42
+
43
+ This plugin will block if the Logstash queue is blocked and there are available HTTP input threads.
44
+ This will cause most HTTP clients to time out. Sent events will still be processed in this case. This
45
+ behavior is not optimal and will be changed in a future release. In the future, this plugin will always
46
+ return a 429 if the queue is busy, and will not time out in the event of a busy queue.
47
+
48
+ ==== Security
49
+ This plugin supports standard HTTP basic authentication headers to identify the requester.
50
+ You can pass in a username, password combination while sending data to this input
51
+
52
+ You can also setup SSL and send data securely over https, with multiple options such as
53
+ validating the client's certificate.
54
+
55
+ [id="plugins-{type}s-{plugin}-codec-settings"]
56
+ ==== Codec settings
57
+ This plugin has two configuration options for codecs: `codec` and `additional_codecs`.
58
+
59
+ Values in `additional_codecs` are prioritized over those specified in the
60
+ `codec` option. That is, the default `codec` is applied only if no codec
61
+ for the request's content-type is found in the `additional_codecs` setting.
62
+
63
+ [id="plugins-{type}s-{plugin}-options"]
64
+ ==== Http Input Configuration Options
65
+
66
+ This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.
67
+
68
+ [cols="<,<,<",options="header",]
69
+ |=======================================================================
70
+ |Setting |Input type|Required
71
+ | <<plugins-{type}s-{plugin}-additional_codecs>> |<<hash,hash>>|No
72
+ | <<plugins-{type}s-{plugin}-cipher_suites>> |<<array,array>>|No
73
+ | <<plugins-{type}s-{plugin}-host>> |<<string,string>>|No
74
+ | <<plugins-{type}s-{plugin}-keystore>> |<<path,path>>|No
75
+ | <<plugins-{type}s-{plugin}-keystore_password>> |<<password,password>>|No
76
+ | <<plugins-{type}s-{plugin}-password>> |<<password,password>>|No
77
+ | <<plugins-{type}s-{plugin}-port>> |<<number,number>>|No
78
+ | <<plugins-{type}s-{plugin}-max_pending_requests>> |<<number,number>>|No
79
+ | <<plugins-{type}s-{plugin}-response_headers>> |<<hash,hash>>|No
80
+ | <<plugins-{type}s-{plugin}-response_code>> |<<number,number>>, one of `[200, 201, 202, 204]`|No
81
+ | <<plugins-{type}s-{plugin}-ssl>> |<<boolean,boolean>>|No
82
+ | <<plugins-{type}s-{plugin}-ssl_certificate>> |a valid filesystem path|No
83
+ | <<plugins-{type}s-{plugin}-ssl_certificate_authorities>> |<<array,array>>|No
84
+ | <<plugins-{type}s-{plugin}-ssl_handshake_timeout>> |<<number,number>>|No
85
+ | <<plugins-{type}s-{plugin}-ssl_key>> |a valid filesystem path|No
86
+ | <<plugins-{type}s-{plugin}-ssl_key_passphrase>> |<<password,password>>|No
87
+ | <<plugins-{type}s-{plugin}-ssl_verify_mode>> |<<string,string>>, one of `["none", "peer", "force_peer"]`|No
88
+ | <<plugins-{type}s-{plugin}-threads>> |<<number,number>>|No
89
+ | <<plugins-{type}s-{plugin}-tls_max_version>> |<<number,number>>|No
90
+ | <<plugins-{type}s-{plugin}-tls_min_version>> |<<number,number>>|No
91
+ | <<plugins-{type}s-{plugin}-user>> |<<string,string>>|No
92
+ | <<plugins-{type}s-{plugin}-verify_mode>> |<<string,string>>, one of `["none", "peer", "force_peer"]`|No
93
+ |=======================================================================
94
+
95
+ Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
96
+ input plugins.
97
+
98
+ &nbsp;
99
+
100
+ [id="plugins-{type}s-{plugin}-additional_codecs"]
101
+ ===== `additional_codecs`
102
+
103
+ * Value type is <<hash,hash>>
104
+ * Default value is `{"application/json"=>"json"}`
105
+
106
+ Apply specific codecs for specific content types.
107
+ The default codec will be applied only after this list is checked
108
+ and no codec for the request's content-type is found
109
+
110
+ [id="plugins-{type}s-{plugin}-cipher_suites"]
111
+ ===== `cipher_suites`
112
+
113
+ * Value type is <<array,array>>
114
+ * Default value is `java.lang.String[TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256]@459cfcca`
115
+
116
+ The list of ciphers suite to use, listed by priorities.
117
+
118
+ [id="plugins-{type}s-{plugin}-host"]
119
+ ===== `host`
120
+
121
+ * Value type is <<string,string>>
122
+ * Default value is `"0.0.0.0"`
123
+
124
+ The host or ip to bind
125
+
126
+ [id="plugins-{type}s-{plugin}-keystore"]
127
+ ===== `keystore`
128
+
129
+ * Value type is <<path,path>>
130
+ * There is no default value for this setting.
131
+ * This option is deprecated
132
+
133
+ The JKS keystore to validate the client's certificates
134
+
135
+ Note: This option is deprecated and it will be removed in the next major version of Logstash.
136
+ Use `ssl_certificate` and `ssl_key` instead.
137
+
138
+ [id="plugins-{type}s-{plugin}-keystore_password"]
139
+ ===== `keystore_password`
140
+
141
+ * Value type is <<password,password>>
142
+ * There is no default value for this setting.
143
+ * This option is deprecated
144
+
145
+ Set the truststore password
146
+
147
+ Note: This option is deprecated and it will be removed in the next major version of Logstash.
148
+ Use `ssl_certificate` and `ssl_key` instead.
149
+
150
+ [id="plugins-{type}s-{plugin}-password"]
151
+ ===== `password`
152
+
153
+ * Value type is <<password,password>>
154
+ * There is no default value for this setting.
155
+
156
+ Password for basic authorization
157
+
158
+ [id="plugins-{type}s-{plugin}-port"]
159
+ ===== `port`
160
+
161
+ * Value type is <<number,number>>
162
+ * Default value is `8080`
163
+
164
+ The TCP port to bind to
165
+
166
+ [id="plugins-{type}s-{plugin}-max_content_length"]
167
+ ===== `max_content_length`
168
+
169
+ * Value type is <<number,number>>
170
+ * Default value is 104857600
171
+
172
+ The max content of an HTTP request in bytes. It defaults to 100mb.
173
+
174
+ [id="plugins-{type}s-{plugin}-max_pending_requests"]
175
+ ===== `max_pending_requests`
176
+
177
+ * Value type is <<number,number>>
178
+ * Default value is 200
179
+
180
+ Maximum number of incoming requests to store in a temporary queue before being processed by worker threads.
181
+ If a request arrives and the queue is full a 429 response will be returned immediately.
182
+ This queue exists to deal with micro bursts of events and to improve overall throughput,
183
+ so it should be changed very carefully as it can lead to memory pressure and impact performance.
184
+ If you need to deal both periodic or unforeseen spikes in incoming requests consider enabling the
185
+ Persistent Queue for the logstash pipeline.
186
+
187
+ [id="plugins-{type}s-{plugin}-response_code"]
188
+ ===== `response_code`
189
+
190
+ * Value can be any of: 200, 201, 202, 204
191
+ * Default value is `200`
192
+
193
+ The HTTP return code if the request is processed successfully.
194
+
195
+ Other return codes may happen in the case of an error condition, such as
196
+ invalid credentials (401), internal errors (503) or backpressure (429).
197
+
198
+ If 204 (No Content) is set, the response body will not be sent in the response.
199
+
200
+ [id="plugins-{type}s-{plugin}-response_headers"]
201
+ ===== `response_headers`
202
+
203
+ * Value type is <<hash,hash>>
204
+ * Default value is `{"Content-Type"=>"text/plain"}`
205
+
206
+ specify a custom set of response headers
207
+
208
+ [id="plugins-{type}s-{plugin}-remote_host_target_field"]
209
+ ===== `remote_host_target_field`
210
+
211
+ * Value type is <<string,string>>
212
+ * Default value is `"host"`
213
+
214
+ specify a target field for the client host of the http request
215
+
216
+ [id="plugins-{type}s-{plugin}-request_headers_target_field"]
217
+ ===== `request_headers_target_field`
218
+
219
+ * Value type is <<string,string>>
220
+ * Default value is `"headers"`
221
+
222
+ specify target field for the client host of the http request
223
+
224
+ [id="plugins-{type}s-{plugin}-ssl"]
225
+ ===== `ssl`
226
+
227
+ * Value type is <<boolean,boolean>>
228
+ * Default value is `false`
229
+
230
+ Events are by default sent in plain text. You can
231
+ enable encryption by setting `ssl` to true and configuring
232
+ the `ssl_certificate` and `ssl_key` options.
233
+
234
+ [id="plugins-{type}s-{plugin}-ssl_certificate"]
235
+ ===== `ssl_certificate`
236
+
237
+ * Value type is <<path,path>>
238
+ * There is no default value for this setting.
239
+
240
+ SSL certificate to use.
241
+
242
+ [id="plugins-{type}s-{plugin}-ssl_certificate_authorities"]
243
+ ===== `ssl_certificate_authorities`
244
+
245
+ * Value type is <<array,array>>
246
+ * Default value is `[]`
247
+
248
+ Validate client certificates against these authorities.
249
+ You can define multiple files or paths. All the certificates will
250
+ be read and added to the trust store. You need to configure the `ssl_verify_mode`
251
+ to `peer` or `force_peer` to enable the verification.
252
+
253
+
254
+ [id="plugins-{type}s-{plugin}-ssl_handshake_timeout"]
255
+ ===== `ssl_handshake_timeout`
256
+
257
+ * Value type is <<number,number>>
258
+ * Default value is `10000`
259
+
260
+ Time in milliseconds for an incomplete ssl handshake to timeout
261
+
262
+ [id="plugins-{type}s-{plugin}-ssl_key"]
263
+ ===== `ssl_key`
264
+
265
+ * Value type is <<path,path>>
266
+ * There is no default value for this setting.
267
+
268
+ SSL key to use.
269
+ NOTE: This key need to be in the PKCS8 format, you can convert it with https://www.openssl.org/docs/man1.1.0/apps/pkcs8.html[OpenSSL]
270
+ for more information.
271
+
272
+ [id="plugins-{type}s-{plugin}-ssl_key_passphrase"]
273
+ ===== `ssl_key_passphrase`
274
+
275
+ * Value type is <<password,password>>
276
+ * There is no default value for this setting.
277
+
278
+ SSL key passphrase to use.
279
+
280
+ [id="plugins-{type}s-{plugin}-ssl_verify_mode"]
281
+ ===== `ssl_verify_mode`
282
+
283
+ * Value can be any of: `none`, `peer`, `force_peer`
284
+ * Default value is `"none"`
285
+
286
+ By default the server doesn't do any client verification.
287
+
288
+ `peer` will make the server ask the client to provide a certificate.
289
+ If the client provides a certificate, it will be validated.
290
+
291
+ `force_peer` will make the server ask the client to provide a certificate.
292
+ If the client doesn't provide a certificate, the connection will be closed.
293
+
294
+ This option needs to be used with `ssl_certificate_authorities` and a defined list of CAs.
295
+
296
+ [id="plugins-{type}s-{plugin}-threads"]
297
+ ===== `threads`
298
+
299
+ * Value type is <<number,number>>
300
+ * Default value is number of processors
301
+
302
+ Number of threads to use for both accepting connections and handling requests
303
+
304
+ [id="plugins-{type}s-{plugin}-tls_max_version"]
305
+ ===== `tls_max_version`
306
+
307
+ * Value type is <<number,number>>
308
+ * Default value is `1.2`
309
+
310
+ The maximum TLS version allowed for the encrypted connections. The value must be the one of the following:
311
+ 1.0 for TLS 1.0, 1.1 for TLS 1.1, 1.2 for TLS 1.2
312
+
313
+ [id="plugins-{type}s-{plugin}-tls_min_version"]
314
+ ===== `tls_min_version`
315
+
316
+ * Value type is <<number,number>>
317
+ * Default value is `1`
318
+
319
+ The minimum TLS version allowed for the encrypted connections. The value must be one of the following:
320
+ 1.0 for TLS 1.0, 1.1 for TLS 1.1, 1.2 for TLS 1.2
321
+
322
+ [id="plugins-{type}s-{plugin}-user"]
323
+ ===== `user`
324
+
325
+ * Value type is <<string,string>>
326
+ * There is no default value for this setting.
327
+
328
+ Username for basic authorization
329
+
330
+ [id="plugins-{type}s-{plugin}-verify_mode"]
331
+ ===== `verify_mode`
332
+
333
+ * Value can be any of: `none`, `peer`, `force_peer`
334
+ * Default value is `"none"`
335
+ * This option is deprecated
336
+
337
+ Set the client certificate verification method. Valid methods: none, peer, force_peer
338
+
339
+ Note: This option is deprecated and it will be removed in the next major version of Logstash.
340
+ Use `ssl_verify_mode` instead.
341
+
342
+
343
+ [id="plugins-{type}s-{plugin}-common-options"]
344
+ include::{include_path}/{type}.asciidoc[]
345
+
346
+ :default_codec!:
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+ require "logstash-input-http_jars"
3
+
4
+ module LogStash module Inputs class Http
5
+ class MessageHandler
6
+ include org.logstash.plugins.inputs.http.IMessageHandler
7
+
8
+ attr_reader :input
9
+
10
+ def initialize(input, default_codec, additional_codecs, auth_token)
11
+ @input = input
12
+ @default_codec = default_codec
13
+ @additional_codecs = additional_codecs
14
+ @auth_token = auth_token
15
+ end
16
+
17
+ def validates_token(token)
18
+ if @auth_token
19
+ @auth_token == token
20
+ else
21
+ true
22
+ end
23
+ end
24
+
25
+ def requires_token
26
+ !!@auth_token
27
+ end
28
+
29
+ def onNewMessage(remote_address, headers, body)
30
+ @input.decode_body(headers, remote_address, body, @default_codec, @additional_codecs)
31
+ end
32
+
33
+ def copy
34
+ MessageHandler.new(@input, @default_codec.clone, clone_additional_codecs(), @auth_token)
35
+ end
36
+
37
+ def clone_additional_codecs
38
+ clone_additional_codecs = {}
39
+ @additional_codecs.each do |content_type, codec|
40
+ clone_additional_codecs[content_type] = codec.clone
41
+ end
42
+ clone_additional_codecs
43
+ end
44
+
45
+ def response_headers
46
+ @input.response_headers
47
+ end
48
+ end
49
+ end; end; end
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+ module LogStash module Inputs class Http
3
+ class TLS
4
+ class TLSOption
5
+ include Comparable
6
+
7
+ attr_reader :name, :version
8
+ def initialize(name, version)
9
+ @name = name
10
+ @version = version
11
+ end
12
+
13
+ def <=>(other)
14
+ version <=> other.version
15
+ end
16
+ end
17
+
18
+ TLS_PROTOCOL_OPTIONS = [
19
+ TLSOption.new("TLSv1", 1),
20
+ TLSOption.new("TLSv1.1", 1.1),
21
+ TLSOption.new("TLSv1.2", 1.2)
22
+ ]
23
+
24
+ def self.min
25
+ TLS_PROTOCOL_OPTIONS.min
26
+ end
27
+
28
+ def self.max
29
+ TLS_PROTOCOL_OPTIONS.max
30
+ end
31
+
32
+ def self.get_supported(versions)
33
+ if versions.is_a?(Range)
34
+ TLS_PROTOCOL_OPTIONS.select { |tls| versions.cover?(tls.version) }
35
+ else
36
+ TLS_PROTOCOL_OPTIONS.select { |tls| versions == tls.version }
37
+ end
38
+ end
39
+ end
40
+ end; end; end