logstash-output-elasticsearch 7.3.3-java → 7.3.4-java
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc1a672b60b3243dd69f875a60dc888fe4cbf341
|
4
|
+
data.tar.gz: 79e351f418538c857cca719ecbacb650c8e00c00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5beaf4ed4b27fdd2724a0d53dd615f926cee4a08ab1289a11bd4db96a8fa4b8e815fd441e64fbdd2885fcd0aeb57eabd18324f8b08a4cd271747bba46ba910c
|
7
|
+
data.tar.gz: 49f4e418557d0b1af16fc23026d8fcc15b97efab6ed08dd1d7bfe9e880eb78adc1ee99382d9ed84a4c314b9841b071c137176924a84e3125faad1053755c9aae
|
data/CHANGELOG.md
CHANGED
@@ -66,7 +66,7 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
|
|
66
66
|
|
67
67
|
request_uri = format_url(url, path)
|
68
68
|
|
69
|
-
resp = @manticore.send(method.downcase, request_uri
|
69
|
+
resp = @manticore.send(method.downcase, request_uri, params)
|
70
70
|
|
71
71
|
# Manticore returns lazy responses by default
|
72
72
|
# We want to block for our usage, this will wait for the repsonse
|
@@ -83,30 +83,30 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
|
|
83
83
|
resp
|
84
84
|
end
|
85
85
|
|
86
|
-
def format_url(url,
|
86
|
+
def format_url(url, path_and_query=nil)
|
87
87
|
request_uri = url.clone
|
88
|
-
|
89
|
-
if path
|
90
|
-
# Combine the paths using the minimal # of /s
|
91
|
-
# First, we make sure the path is relative so URI.join does
|
92
|
-
# the right thing
|
93
|
-
relative_path = path && path.start_with?("/") ? path[1..-1] : path
|
94
|
-
|
95
|
-
if !request_uri.path
|
96
|
-
request_uri.path = path
|
97
|
-
else
|
98
|
-
request_uri.path = "#{request_uri.path}/#{relative_path}"
|
99
|
-
end
|
100
|
-
else
|
101
|
-
request_uri = request_uri.clone
|
102
|
-
end
|
103
|
-
|
88
|
+
|
104
89
|
# We excise auth info from the URL in case manticore itself tries to stick
|
105
90
|
# sensitive data in a thrown exception or log data
|
106
91
|
request_uri.user = nil
|
107
92
|
request_uri.password = nil
|
108
93
|
|
109
|
-
request_uri
|
94
|
+
return request_uri.to_s if path_and_query.nil?
|
95
|
+
|
96
|
+
parsed_path_and_query = java.net.URI.new(path_and_query)
|
97
|
+
|
98
|
+
query = request_uri.query
|
99
|
+
parsed_query = parsed_path_and_query.query
|
100
|
+
|
101
|
+
new_query_parts = [request_uri.query, parsed_path_and_query.query].select do |part|
|
102
|
+
part && !part.empty? # Skip empty nil and ""
|
103
|
+
end
|
104
|
+
|
105
|
+
request_uri.query = new_query_parts.join("&") unless new_query_parts.empty?
|
106
|
+
|
107
|
+
request_uri.path = "#{request_uri.path}/#{parsed_path_and_query.path}".gsub(/\/{2,}/, "/")
|
108
|
+
|
109
|
+
request_uri.to_s
|
110
110
|
end
|
111
111
|
|
112
112
|
def close
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-elasticsearch'
|
3
|
-
s.version = '7.3.
|
3
|
+
s.version = '7.3.4'
|
4
4
|
s.licenses = ['apache-2.0']
|
5
5
|
s.summary = "Logstash Output to Elasticsearch"
|
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"
|
@@ -50,24 +50,46 @@ describe LogStash::Outputs::ElasticSearch::HttpClient::ManticoreAdapter do
|
|
50
50
|
subject { described_class.new(double("logger"), {}) }
|
51
51
|
|
52
52
|
it "should add the path argument to the uri's path" do
|
53
|
-
expect(subject.format_url(url, path).path).to eq("/path
|
53
|
+
expect(java.net.URI.new(subject.format_url(url, path)).path).to eq("/path/_bulk")
|
54
54
|
end
|
55
55
|
|
56
56
|
context "when uri contains query parameters" do
|
57
57
|
let(:query_params) { "query=value&key=value2" }
|
58
58
|
let(:url) { ::LogStash::Util::SafeURI.new("http://localhost:9200/path/?#{query_params}") }
|
59
|
+
let(:formatted) { java.net.URI.new(subject.format_url(url, path))}
|
59
60
|
|
60
61
|
it "should retain query_params after format" do
|
61
|
-
expect(
|
62
|
+
expect(formatted.query).to eq(query_params)
|
63
|
+
end
|
64
|
+
|
65
|
+
context "and the path contains query parameters" do
|
66
|
+
let(:path) { "/special_path?specialParam=123" }
|
67
|
+
|
68
|
+
it "should join the query correctly" do
|
69
|
+
expect(formatted.query).to eq(query_params + "&specialParam=123")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context "when the path contains query parameters" do
|
75
|
+
let(:path) { "/special_bulk?pathParam=1"}
|
76
|
+
let(:formatted) { java.net.URI.new(subject.format_url(url, path)) }
|
77
|
+
|
78
|
+
it "should add the path correctly" do
|
79
|
+
expect(formatted.path).to eq("#{url.path}special_bulk")
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should add the query parameters correctly" do
|
83
|
+
expect(formatted.query).to eq("pathParam=1")
|
62
84
|
end
|
63
85
|
end
|
64
86
|
|
65
87
|
context "when uri contains credentials" do
|
66
88
|
let(:url) { ::LogStash::Util::SafeURI.new("http://myuser:mypass@localhost:9200") }
|
89
|
+
let(:formatted) { java.net.URI.new(subject.format_url(url, path)) }
|
67
90
|
|
68
91
|
it "should remove credentials after format" do
|
69
|
-
expect(
|
70
|
-
expect(subject.format_url(url, path).password).to be_nil
|
92
|
+
expect(formatted.user_info).to be_nil
|
71
93
|
end
|
72
94
|
end
|
73
95
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.3.
|
4
|
+
version: 7.3.4
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|