logstash-output-elasticsearch-test 10.3.0-x86_64-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +397 -0
  3. data/CONTRIBUTORS +33 -0
  4. data/Gemfile +15 -0
  5. data/LICENSE +13 -0
  6. data/NOTICE.TXT +5 -0
  7. data/README.md +106 -0
  8. data/docs/index.asciidoc +899 -0
  9. data/lib/logstash/outputs/elasticsearch/common.rb +441 -0
  10. data/lib/logstash/outputs/elasticsearch/common_configs.rb +167 -0
  11. data/lib/logstash/outputs/elasticsearch/default-ilm-policy.json +14 -0
  12. data/lib/logstash/outputs/elasticsearch/elasticsearch-template-es2x.json +95 -0
  13. data/lib/logstash/outputs/elasticsearch/elasticsearch-template-es5x.json +46 -0
  14. data/lib/logstash/outputs/elasticsearch/elasticsearch-template-es6x.json +45 -0
  15. data/lib/logstash/outputs/elasticsearch/elasticsearch-template-es7x.json +44 -0
  16. data/lib/logstash/outputs/elasticsearch/elasticsearch-template-es8x.json +44 -0
  17. data/lib/logstash/outputs/elasticsearch/http_client/manticore_adapter.rb +131 -0
  18. data/lib/logstash/outputs/elasticsearch/http_client/pool.rb +495 -0
  19. data/lib/logstash/outputs/elasticsearch/http_client.rb +432 -0
  20. data/lib/logstash/outputs/elasticsearch/http_client_builder.rb +159 -0
  21. data/lib/logstash/outputs/elasticsearch/ilm.rb +113 -0
  22. data/lib/logstash/outputs/elasticsearch/template_manager.rb +61 -0
  23. data/lib/logstash/outputs/elasticsearch.rb +263 -0
  24. data/logstash-output-elasticsearch.gemspec +33 -0
  25. data/spec/es_spec_helper.rb +189 -0
  26. data/spec/fixtures/_nodes/2x_1x.json +27 -0
  27. data/spec/fixtures/_nodes/5x_6x.json +81 -0
  28. data/spec/fixtures/_nodes/7x.json +92 -0
  29. data/spec/fixtures/htpasswd +2 -0
  30. data/spec/fixtures/nginx_reverse_proxy.conf +22 -0
  31. data/spec/fixtures/scripts/groovy/scripted_update.groovy +2 -0
  32. data/spec/fixtures/scripts/groovy/scripted_update_nested.groovy +2 -0
  33. data/spec/fixtures/scripts/groovy/scripted_upsert.groovy +2 -0
  34. data/spec/fixtures/scripts/painless/scripted_update.painless +2 -0
  35. data/spec/fixtures/scripts/painless/scripted_update_nested.painless +1 -0
  36. data/spec/fixtures/scripts/painless/scripted_upsert.painless +1 -0
  37. data/spec/fixtures/template-with-policy-es6x.json +48 -0
  38. data/spec/fixtures/template-with-policy-es7x.json +45 -0
  39. data/spec/fixtures/test_certs/ca/ca.crt +32 -0
  40. data/spec/fixtures/test_certs/ca/ca.key +51 -0
  41. data/spec/fixtures/test_certs/test.crt +36 -0
  42. data/spec/fixtures/test_certs/test.key +51 -0
  43. data/spec/integration/outputs/compressed_indexing_spec.rb +69 -0
  44. data/spec/integration/outputs/create_spec.rb +67 -0
  45. data/spec/integration/outputs/delete_spec.rb +65 -0
  46. data/spec/integration/outputs/groovy_update_spec.rb +150 -0
  47. data/spec/integration/outputs/ilm_spec.rb +531 -0
  48. data/spec/integration/outputs/index_spec.rb +178 -0
  49. data/spec/integration/outputs/index_version_spec.rb +102 -0
  50. data/spec/integration/outputs/ingest_pipeline_spec.rb +74 -0
  51. data/spec/integration/outputs/metrics_spec.rb +70 -0
  52. data/spec/integration/outputs/no_es_on_startup_spec.rb +58 -0
  53. data/spec/integration/outputs/painless_update_spec.rb +189 -0
  54. data/spec/integration/outputs/parent_spec.rb +102 -0
  55. data/spec/integration/outputs/retry_spec.rb +169 -0
  56. data/spec/integration/outputs/routing_spec.rb +61 -0
  57. data/spec/integration/outputs/sniffer_spec.rb +133 -0
  58. data/spec/integration/outputs/templates_5x_spec.rb +98 -0
  59. data/spec/integration/outputs/templates_spec.rb +98 -0
  60. data/spec/integration/outputs/update_spec.rb +116 -0
  61. data/spec/support/elasticsearch/api/actions/delete_ilm_policy.rb +19 -0
  62. data/spec/support/elasticsearch/api/actions/get_alias.rb +18 -0
  63. data/spec/support/elasticsearch/api/actions/get_ilm_policy.rb +18 -0
  64. data/spec/support/elasticsearch/api/actions/put_alias.rb +24 -0
  65. data/spec/support/elasticsearch/api/actions/put_ilm_policy.rb +25 -0
  66. data/spec/unit/http_client_builder_spec.rb +185 -0
  67. data/spec/unit/outputs/elasticsearch/http_client/manticore_adapter_spec.rb +149 -0
  68. data/spec/unit/outputs/elasticsearch/http_client/pool_spec.rb +274 -0
  69. data/spec/unit/outputs/elasticsearch/http_client_spec.rb +250 -0
  70. data/spec/unit/outputs/elasticsearch/template_manager_spec.rb +25 -0
  71. data/spec/unit/outputs/elasticsearch_proxy_spec.rb +72 -0
  72. data/spec/unit/outputs/elasticsearch_spec.rb +675 -0
  73. data/spec/unit/outputs/elasticsearch_ssl_spec.rb +82 -0
  74. data/spec/unit/outputs/error_whitelist_spec.rb +54 -0
  75. metadata +300 -0
@@ -0,0 +1,92 @@
1
+ {
2
+ "_nodes" : {
3
+ "total" : 3,
4
+ "successful" : 3,
5
+ "failed" : 0
6
+ },
7
+ "cluster_name" : "elasticsearch",
8
+ "nodes" : {
9
+ "kVPTh7ZvSgWmTRMy-4YExQ" : {
10
+ "name" : "kVPTh7Z",
11
+ "transport_address" : "127.0.0.1:9300",
12
+ "host" : "dev-master",
13
+ "ip" : "127.0.0.1",
14
+ "version" : "7.0.0",
15
+ "build_flavor" : "default",
16
+ "build_type" : "tar",
17
+ "build_hash" : "b0e7036",
18
+ "roles" : [
19
+ "master"
20
+ ],
21
+ "attributes" : {
22
+ "ml.machine_memory" : "17179869184",
23
+ "xpack.installed" : "true",
24
+ "ml.max_open_jobs" : "20",
25
+ "ml.enabled" : "true"
26
+ },
27
+ "http" : {
28
+ "bound_address" : [
29
+ "127.0.0.1:9200",
30
+ "[::1]:9200"
31
+ ],
32
+ "publish_address" : "dev-master/127.0.0.1:9200",
33
+ "max_content_length_in_bytes" : 104857600
34
+ }
35
+ },
36
+ "J47OFlfpSHGFwRJSF2hbcg" : {
37
+ "name" : "J47OFlf",
38
+ "transport_address" : "127.0.0.1:9301",
39
+ "host" : "dev-masterdata",
40
+ "ip" : "127.0.0.1",
41
+ "version" : "7.0.0",
42
+ "build_flavor" : "default",
43
+ "build_type" : "tar",
44
+ "build_hash" : "b0e7036",
45
+ "roles" : [
46
+ "master",
47
+ "data"
48
+ ],
49
+ "attributes" : {
50
+ "ml.machine_memory" : "17179869184",
51
+ "ml.max_open_jobs" : "20",
52
+ "xpack.installed" : "true",
53
+ "ml.enabled" : "true"
54
+ },
55
+ "http" : {
56
+ "bound_address" : [
57
+ "127.0.0.1:9201",
58
+ "[::1]:9201"
59
+ ],
60
+ "publish_address" : "dev-masterdata/127.0.0.1:9201",
61
+ "max_content_length_in_bytes" : 104857600
62
+ }
63
+ },
64
+ "pDYE99f0QmutVb8gvsf-yw" : {
65
+ "name" : "pDYE99f",
66
+ "transport_address" : "127.0.0.1:9302",
67
+ "host" : "dev-data",
68
+ "ip" : "127.0.0.1",
69
+ "version" : "7.0.0",
70
+ "build_flavor" : "default",
71
+ "build_type" : "tar",
72
+ "build_hash" : "b0e7036",
73
+ "roles" : [
74
+ "data"
75
+ ],
76
+ "attributes" : {
77
+ "ml.machine_memory" : "17179869184",
78
+ "ml.max_open_jobs" : "20",
79
+ "xpack.installed" : "true",
80
+ "ml.enabled" : "true"
81
+ },
82
+ "http" : {
83
+ "bound_address" : [
84
+ "127.0.0.1:9202",
85
+ "[::1]:9202"
86
+ ],
87
+ "publish_address" : "dev-data/127.0.0.1:9202",
88
+ "max_content_length_in_bytes" : 104857600
89
+ }
90
+ }
91
+ }
92
+ }
@@ -0,0 +1,2 @@
1
+ fancyuser:$apr1$Eq3/Qh40$MRzg6mccKUVmx8HJvlqkK1
2
+ simpleuser:$apr1$hQQ4QWmo$ECyA1DFO3iCRs07zVXqAq1
@@ -0,0 +1,22 @@
1
+ worker_processes 1;
2
+ daemon off; # run in foreground
3
+
4
+ events {
5
+ worker_connections 1024;
6
+ }
7
+
8
+ http {
9
+ server {
10
+ listen 9900 default_server;
11
+ ssl on;
12
+ ssl_certificate server.crt;
13
+ ssl_certificate_key server.key;
14
+ client_max_body_size 200m;
15
+
16
+ location / {
17
+ proxy_pass http://localhost:9200;
18
+ auth_basic "Restricted Content";
19
+ auth_basic_user_file htpasswd;
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,2 @@
1
+ ctx._source.counter += event["count"]
2
+
@@ -0,0 +1,2 @@
1
+ ctx._source.counter += event["data"]["count"]
2
+
@@ -0,0 +1,2 @@
1
+ ctx._source.counter = event["counter"]
2
+
@@ -0,0 +1,2 @@
1
+ ctx._source.counter += params.event.count
2
+
@@ -0,0 +1 @@
1
+ ctx._source.counter += params.event.data.count
@@ -0,0 +1 @@
1
+ ctx._source.counter = params.event.counter
@@ -0,0 +1,48 @@
1
+ {
2
+ "template" : "overwrite-*",
3
+ "version" : 60001,
4
+ "settings" : {
5
+ "index.refresh_interval" : "1s",
6
+ "number_of_shards": 1,
7
+ "index.lifecycle.name": "overwrite-policy",
8
+ "index.lifecycle.rollover_alias": "overwrite"
9
+ },
10
+ "mappings" : {
11
+ "_default_" : {
12
+ "dynamic_templates" : [ {
13
+ "message_field" : {
14
+ "path_match" : "message",
15
+ "match_mapping_type" : "string",
16
+ "mapping" : {
17
+ "type" : "text",
18
+ "norms" : false
19
+ }
20
+ }
21
+ }, {
22
+ "string_fields" : {
23
+ "match" : "*",
24
+ "match_mapping_type" : "string",
25
+ "mapping" : {
26
+ "type" : "text", "norms" : false,
27
+ "fields" : {
28
+ "keyword" : { "type": "keyword", "ignore_above": 256 }
29
+ }
30
+ }
31
+ }
32
+ } ],
33
+ "properties" : {
34
+ "@timestamp": { "type": "date"},
35
+ "@version": { "type": "keyword"},
36
+ "geoip" : {
37
+ "dynamic": true,
38
+ "properties" : {
39
+ "ip": { "type": "ip" },
40
+ "location" : { "type" : "geo_point" },
41
+ "latitude" : { "type" : "half_float" },
42
+ "longitude" : { "type" : "half_float" }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "index_patterns" : "overwrite-*",
3
+ "version" : 60001,
4
+ "settings" : {
5
+ "index.refresh_interval" : "1s",
6
+ "number_of_shards": 1
7
+ },
8
+ "mappings" : {
9
+ "dynamic_templates" : [ {
10
+ "message_field" : {
11
+ "path_match" : "message",
12
+ "match_mapping_type" : "string",
13
+ "mapping" : {
14
+ "type" : "text",
15
+ "norms" : false
16
+ }
17
+ }
18
+ }, {
19
+ "string_fields" : {
20
+ "match" : "*",
21
+ "match_mapping_type" : "string",
22
+ "mapping" : {
23
+ "type" : "text", "norms" : false,
24
+ "fields" : {
25
+ "keyword" : { "type": "keyword", "ignore_above": 256 }
26
+ }
27
+ }
28
+ }
29
+ } ],
30
+ "properties" : {
31
+ "@timestamp": { "type": "date"},
32
+ "@version": { "type": "keyword"},
33
+ "geoip" : {
34
+ "dynamic": true,
35
+ "properties" : {
36
+ "ip": { "type": "ip" },
37
+ "location" : { "type" : "geo_point" },
38
+ "latitude" : { "type" : "half_float" },
39
+ "longitude" : { "type" : "half_float" }
40
+ }
41
+ }
42
+ }
43
+ }
44
+
45
+ }
@@ -0,0 +1,32 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIFeTCCA2GgAwIBAgIUU+VHJ91JsLLA1GJYC+UchNfw3hEwDQYJKoZIhvcNAQEL
3
+ BQAwTDELMAkGA1UEBhMCUFQxCzAJBgNVBAgMAk5BMQ8wDQYDVQQHDAZMaXNib24x
4
+ DjAMBgNVBAoMBU15TGFiMQ8wDQYDVQQDDAZSb290Q0EwHhcNMTkwNzE1MTMxMTI5
5
+ WhcNMjQwNzE0MTMxMTI5WjBMMQswCQYDVQQGEwJQVDELMAkGA1UECAwCTkExDzAN
6
+ BgNVBAcMBkxpc2JvbjEOMAwGA1UECgwFTXlMYWIxDzANBgNVBAMMBlJvb3RDQTCC
7
+ AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMtTMqAWuH17b9XqPa5L3HNq
8
+ gnZ958+gvcOt7Q/sOEvcDQJg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D1nuhGMOgbiHZkdx3eug05wfhnYvWljA+
49
+ r/4xcq7TmKSoJqkb0OcOkhqjeZWleA6xRtEvHPGRzbEM67FVsVTxr/N9BX5tS9zu
50
+ YLCNI3tTNsDV0Ac+4rl46rghQ/n2TNSEpwvA/pjytsdPXLOpoapWirrsEiXf
51
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1,69 @@
1
+ require_relative "../../../spec/es_spec_helper"
2
+ require "logstash/outputs/elasticsearch"
3
+ require "stringio"
4
+
5
+ RSpec::Matchers.define :a_valid_gzip_encoded_string do
6
+ match { |data|
7
+ expect { Zlib::GzipReader.new(StringIO.new(data)).read }.not_to raise_error
8
+ }
9
+ end
10
+
11
+ if ESHelper.es_version_satisfies?(">= 5")
12
+ describe "indexing with http_compression turned on", :integration => true do
13
+ let(:event) { LogStash::Event.new("message" => "Hello World!", "type" => type) }
14
+ let(:index) { 10.times.collect { rand(10).to_s }.join("") }
15
+ let(:type) { ESHelper.es_version_satisfies?("< 7") ? "doc" : "_doc" }
16
+ let(:event_count) { 10000 + rand(500) }
17
+ let(:events) { event_count.times.map { event }.to_a }
18
+ let(:config) {
19
+ {
20
+ "hosts" => get_host_port,
21
+ "index" => index,
22
+ "http_compression" => true
23
+ }
24
+ }
25
+ subject { LogStash::Outputs::ElasticSearch.new(config) }
26
+
27
+ let(:es_url) { "http://#{get_host_port}" }
28
+ let(:index_url) {"#{es_url}/#{index}"}
29
+ let(:http_client_options) { {} }
30
+ let(:http_client) do
31
+ Manticore::Client.new(http_client_options)
32
+ end
33
+
34
+ before do
35
+ subject.register
36
+ subject.multi_receive([])
37
+ end
38
+
39
+ shared_examples "an indexer" do
40
+ it "ships events" do
41
+ subject.multi_receive(events)
42
+
43
+ http_client.post("#{es_url}/_refresh").call
44
+
45
+ response = http_client.get("#{index_url}/_count?q=*")
46
+ result = LogStash::Json.load(response.body)
47
+ cur_count = result["count"]
48
+ expect(cur_count).to eq(event_count)
49
+
50
+ response = http_client.get("#{index_url}/_search?q=*&size=1000")
51
+ result = LogStash::Json.load(response.body)
52
+ result["hits"]["hits"].each do |doc|
53
+ expect(doc["_type"]).to eq(type) if ESHelper.es_version_satisfies?(">= 6", "< 8")
54
+ expect(doc).not_to include("_type") if ESHelper.es_version_satisfies?(">= 8")
55
+ expect(doc["_index"]).to eq(index)
56
+ end
57
+ end
58
+ end
59
+
60
+ it "sets the correct content-encoding header and body is compressed" do
61
+ expect(subject.client.pool.adapter.client).to receive(:send).
62
+ with(anything, anything, {:headers=>{"Content-Encoding"=>"gzip", "Content-Type"=>"application/json"}, :body => a_valid_gzip_encoded_string}).
63
+ and_call_original
64
+ subject.multi_receive(events)
65
+ end
66
+
67
+ it_behaves_like("an indexer")
68
+ end
69
+ end
@@ -0,0 +1,67 @@
1
+ require_relative "../../../spec/es_spec_helper"
2
+
3
+ describe "client create actions", :integration => true do
4
+ require "logstash/outputs/elasticsearch"
5
+
6
+ def get_es_output(action, id, version=nil, version_type=nil)
7
+ settings = {
8
+ "manage_template" => true,
9
+ "index" => "logstash-create",
10
+ "template_overwrite" => true,
11
+ "hosts" => get_host_port(),
12
+ "action" => action
13
+ }
14
+ settings['document_id'] = id
15
+ settings['version'] = version if version
16
+ settings['version_type'] = version_type if version_type
17
+ LogStash::Outputs::ElasticSearch.new(settings)
18
+ end
19
+
20
+ before :each do
21
+ @es = get_client
22
+ # Delete all templates first.
23
+ # Clean ES of data before we start.
24
+ @es.indices.delete_template(:name => "*")
25
+ # This can fail if there are no indexes, ignore failure.
26
+ @es.indices.delete(:index => "*") rescue nil
27
+ end
28
+
29
+ context "when action => create" do
30
+ it "should create new documents with or without id" do
31
+ subject = get_es_output("create", "id123")
32
+ subject.register
33
+ subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
34
+ @es.indices.refresh
35
+ # Wait or fail until everything's indexed.
36
+ Stud::try(3.times) do
37
+ r = @es.search
38
+ expect(r).to have_hits(1)
39
+ end
40
+ end
41
+
42
+ it "should allow default (internal) version" do
43
+ subject = get_es_output("create", "id123", 43)
44
+ subject.register
45
+ end
46
+
47
+ it "should allow internal version" do
48
+ subject = get_es_output("create", "id123", 43, "internal")
49
+ subject.register
50
+ end
51
+
52
+ it "should not allow external version" do
53
+ subject = get_es_output("create", "id123", 43, "external")
54
+ expect { subject.register }.to raise_error(LogStash::ConfigurationError)
55
+ end
56
+
57
+ it "should not allow external_gt version" do
58
+ subject = get_es_output("create", "id123", 43, "external_gt")
59
+ expect { subject.register }.to raise_error(LogStash::ConfigurationError)
60
+ end
61
+
62
+ it "should not allow external_gte version" do
63
+ subject = get_es_output("create", "id123", 43, "external_gte")
64
+ expect { subject.register }.to raise_error(LogStash::ConfigurationError)
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,65 @@
1
+ require_relative "../../../spec/es_spec_helper"
2
+ require "logstash/outputs/elasticsearch"
3
+
4
+
5
+ if ESHelper.es_version_satisfies?(">= 2")
6
+ describe "Versioned delete", :integration => true do
7
+ require "logstash/outputs/elasticsearch"
8
+
9
+ let(:es) { get_client }
10
+
11
+ before :each do
12
+ # Delete all templates first.
13
+ # Clean ES of data before we start.
14
+ es.indices.delete_template(:name => "*")
15
+ # This can fail if there are no indexes, ignore failure.
16
+ es.indices.delete(:index => "*") rescue nil
17
+ es.indices.refresh
18
+ end
19
+
20
+ context "when delete only" do
21
+ subject { LogStash::Outputs::ElasticSearch.new(settings) }
22
+
23
+ before do
24
+ subject.register
25
+ end
26
+
27
+ let(:settings) do
28
+ {
29
+ "manage_template" => true,
30
+ "index" => "logstash-delete",
31
+ "template_overwrite" => true,
32
+ "hosts" => get_host_port(),
33
+ "document_id" => "%{my_id}",
34
+ "version" => "%{my_version}",
35
+ "version_type" => "external",
36
+ "action" => "%{my_action}"
37
+ }
38
+ end
39
+
40
+ it "should ignore non-monotonic external version updates" do
41
+ id = "ev2"
42
+ subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "index", "message" => "foo", "my_version" => 99)])
43
+ r = es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true)
44
+ expect(r['_version']).to eq(99)
45
+ expect(r['_source']['message']).to eq('foo')
46
+
47
+ subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "delete", "message" => "foo", "my_version" => 98)])
48
+ r2 = es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true)
49
+ expect(r2['_version']).to eq(99)
50
+ expect(r2['_source']['message']).to eq('foo')
51
+ end
52
+
53
+ it "should commit monotonic external version updates" do
54
+ id = "ev3"
55
+ subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "index", "message" => "foo", "my_version" => 99)])
56
+ r = es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true)
57
+ expect(r['_version']).to eq(99)
58
+ expect(r['_source']['message']).to eq('foo')
59
+
60
+ subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "delete", "message" => "foo", "my_version" => 100)])
61
+ expect { es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true) }.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
62
+ end
63
+ end
64
+ end
65
+ end