fluent-plugin-elasticsearch 4.0.8 → 4.1.1

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
  SHA256:
3
- metadata.gz: 1979708479afe32ade449552ade837bc9cfc8acff343cd248008abc579b794d3
4
- data.tar.gz: 6ed1a94f6e8553ca72fb75e319ee954f5a8a676ef4ccc0a6a65ca4d041c101c2
3
+ metadata.gz: 616365bcf32cc6d302718907d145639cbb4786b33cb8a837da24f3934cf7a837
4
+ data.tar.gz: 77df51b64aa07d12b57b82a093f4a5b8cbd1c1bf9c5c82384163118c050c68cf
5
5
  SHA512:
6
- metadata.gz: e9957264a1ade9aa7e3b7cac60157c0adc9d9b2cd9e6d3d72ce73ca480e6ee32415bb94ad83c95ee7419e6b02b6695c28c39e2696945906e35e25c43421f70ca
7
- data.tar.gz: 0efced0623b3312f1d767c82bb3ac9647e0082389bc6457052a4c74f5063a57ba21ff4effe881a18996c0a3f256ade017ec68b9df7423cb5c63869b3e49c1b07
6
+ metadata.gz: ae68cc2f0a2abbf7cf7a4c11a9bb5dac9a9e09ba9c053109748c671acd304198b45ad949782691a28eadb418e15bc66f1ef16897f810c5f0b5dd0ce04dd7913e
7
+ data.tar.gz: 484df0670840045d6c55bd1971142cf13a2a0c35cefc0ff96ada3259404d08529d97adbdd736bf9eaf99ad84c51d2124af1d0160c35042a736c875eef8aa5f3c
@@ -0,0 +1,12 @@
1
+ name: Autocloser
2
+ on: [issues]
3
+ jobs:
4
+ autoclose:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - name: Autoclose issues that did not follow issue template
8
+ uses: roots/issue-closer-action@v1.1
9
+ with:
10
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
11
+ issue-close-message: "@${issue.user.login} this issue was automatically closed because it did not follow the issue template."
12
+ issue-pattern: "(.*Problem.*)|(.*Expected Behavior or What you need to ask.*)|(.*Using Fluentd and ES plugin versions.*)"
data/History.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  ### [Unreleased]
4
4
 
5
+ ### 4.1.1
6
+ - Correct ILM explain on logstash_format case (#786)
7
+
8
+ ### 4.1.0
9
+ - Implement Fallback selector and configurable selector class (#782)
10
+
11
+ ### 4.0.11
12
+ - Add custom and time placeholders combination testcase for ILM (#781)
13
+ - Really support ILM on `logstash_format` enabled environment (#779)
14
+
15
+ ### 4.0.10
16
+ - filter_elasticsearch_genid: Use entire record as hash seed (#777)
17
+ - Suppress type in meta with suppress_type_name parameter (#774)
18
+ - filter\_elasticsearch\_genid: Add hash generation mechanism from events (#773)
19
+ - Clean up error text (#772)
20
+ - Use GitHub Actions badges instead of Travis' (#760)
21
+ - Add issue auto closer workflow (#759)
22
+ - Document required permissions (#757)
23
+
24
+ ### 4.0.9
25
+ - Add possibility to configure multiple ILM policies (#753)
26
+ - Document required permissions (#757)
27
+
5
28
  ### 4.0.8
6
29
  - Handle compressable connection usable state (#743)
7
30
  - Use newer tls protocol versions (#739)
@@ -0,0 +1,116 @@
1
+ ## Index
2
+
3
+ * [Usage](#usage)
4
+ * [Configuration](#configuration)
5
+ + [hash_id_key](#hash_id_key)
6
+ + [include_tag_in_seed](#include_tag_in_seed)
7
+ + [include_time_in_seed](#include_time_in_seed)
8
+ + [use_record_as_seed](#use_record_as_seed)
9
+ + [use_entire_record](#use_entire_record)
10
+ + [record_keys](#record_keys)
11
+ + [separator](#separator)
12
+ + [hash_type](#hash_type)
13
+ * [Advanced Usage](#advanced-usage)
14
+
15
+ ## Usage
16
+
17
+ In your Fluentd configuration, use `@type elasticsearch_genid`. Additional configuration is optional, default values would look like this:
18
+
19
+ ```
20
+ <source>
21
+ @type elasticsearch_genid
22
+ hash_id_key _hash
23
+ include_tag_in_seed false
24
+ include_time_in_seed false
25
+ use_record_as_seed false
26
+ use_entire_record false
27
+ record_keys []
28
+ separator _
29
+ hash_type md5
30
+ </match>
31
+ ```
32
+
33
+ ## Configuration
34
+
35
+ ### hash_id_key
36
+
37
+ ```
38
+ hash_id_key _id
39
+ ```
40
+
41
+ You can specify generated hash storing key.
42
+
43
+ ### include_tag_in_seed
44
+
45
+ ```
46
+ include_tag_in_seed true
47
+ ```
48
+
49
+ You can specify to use tag for hash generation seed.
50
+
51
+ ### include_time_in_seed
52
+
53
+ ```
54
+ include_time_in_seed true
55
+ ```
56
+
57
+ You can specify to use time for hash generation seed.
58
+
59
+ ### use_record_as_seed
60
+
61
+ ```
62
+ use_record_as_seed true
63
+ ```
64
+
65
+ You can specify to use record in events for hash generation seed. This parameter should be used with [record_keys](#record_keys) parameter in practice.
66
+
67
+ ### record_keys
68
+
69
+ ```
70
+ record_keys request_id,pipeline_id
71
+ ```
72
+
73
+ You can specify keys which are record in events for hash generation seed. This parameter should be used with [use_record_as_seed](#use_record_as_seed) parameter in practice.
74
+
75
+ ### use_entire_record
76
+
77
+ ```
78
+ use_entire_record true
79
+ ```
80
+
81
+ You can specify to use entire record in events for hash generation seed.
82
+
83
+
84
+ ### separator
85
+
86
+ ```
87
+ separator |
88
+ ```
89
+
90
+ You can specify separator charactor to creating seed for hash generation.
91
+
92
+ ### hash_type
93
+
94
+ ```
95
+ hash_type sha1
96
+ ```
97
+
98
+ You can specify hash algorithm.
99
+
100
+ ## Advanced Usage
101
+
102
+ Elasticsearch GenID plugin can handle record contents differing with the following parameters:
103
+
104
+ ```aconf
105
+ <filter the.awesome.your.routing.tag>
106
+ @type elasticsearch_genid
107
+ use_entire_record true
108
+ hash_type sha1
109
+ hash_id_key _hash
110
+ separator _
111
+ inc_time_as_key true
112
+ inc_tag_as_key true
113
+ </filter>
114
+ ```
115
+
116
+ The above configuration can handle tag, time, and record differing and generate different base64 encoded hash per record.
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # Fluent::Plugin::Elasticsearch, a plugin for [Fluentd](http://fluentd.org)
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/fluent-plugin-elasticsearch.png)](http://badge.fury.io/rb/fluent-plugin-elasticsearch)
4
- [![Build Status](https://travis-ci.org/uken/fluent-plugin-elasticsearch.png?branch=master)](https://travis-ci.org/uken/fluent-plugin-elasticsearch)
4
+ ![Testing on Windows](https://github.com/uken/fluent-plugin-elasticsearch/workflows/Testing%20on%20Windows/badge.svg?branch=master)
5
+ ![Testing on macOS](https://github.com/uken/fluent-plugin-elasticsearch/workflows/Testing%20on%20macOS/badge.svg?branch=master)
6
+ ![Testing on Ubuntu](https://github.com/uken/fluent-plugin-elasticsearch/workflows/Testing%20on%20Ubuntu/badge.svg?branch=master)
5
7
  [![Coverage Status](https://coveralls.io/repos/uken/fluent-plugin-elasticsearch/badge.png)](https://coveralls.io/r/uken/fluent-plugin-elasticsearch)
6
8
  [![Code Climate](https://codeclimate.com/github/uken/fluent-plugin-elasticsearch.png)](https://codeclimate.com/github/uken/fluent-plugin-elasticsearch)
7
9
 
@@ -31,6 +33,7 @@ Current maintainers: @cosmo0920
31
33
  + [time_key_exclude_timestamp](#time_key_exclude_timestamp)
32
34
  + [include_timestamp](#include_timestamp)
33
35
  + [utc_index](#utc_index)
36
+ + [suppress_type_name](#suppress_type_name)
34
37
  + [target_index_key](#target_index_key)
35
38
  + [target_type_key](#target_type_key)
36
39
  + [template_name](#template_name)
@@ -75,6 +78,7 @@ Current maintainers: @cosmo0920
75
78
  + [Hash flattening](#hash-flattening)
76
79
  + [Generate Hash ID](#generate-hash-id)
77
80
  + [sniffer_class_name](#sniffer-class-name)
81
+ + [selector_class_name](#selector-class-name)
78
82
  + [reload_after](#reload-after)
79
83
  + [validate_client_version](#validate-client-version)
80
84
  + [unrecoverable_error_types](#unrecoverable-error-types)
@@ -93,9 +97,12 @@ Current maintainers: @cosmo0920
93
97
  + [enable_ilm](#enable_ilm)
94
98
  + [ilm_policy_id](#ilm_policy_id)
95
99
  + [ilm_policy](#ilm_policy)
100
+ + [ilm_policies](#ilm_policies)
96
101
  + [ilm_policy_overwrite](#ilm_policy_overwrite)
97
102
  + [truncate_caches_interval](#truncate_caches_interval)
98
103
  * [Configuration - Elasticsearch Input](#configuration---elasticsearch-input)
104
+ * [Configuration - Elasticsearch Filter GenID](#configuration---elasticsearch-filter-genid)
105
+ * [Elasticsearch permissions](#elasticsearch-permissions)
99
106
  * [Troubleshooting](#troubleshooting)
100
107
  + [Cannot send events to elasticsearch](#cannot-send-events-to-elasticsearch)
101
108
  + [Cannot see detailed failure log](#cannot-see-detailed-failure-log)
@@ -349,6 +356,20 @@ utc_index true
349
356
 
350
357
  By default, the records inserted into index `logstash-YYMMDD` with UTC (Coordinated Universal Time). This option allows to use local time if you describe utc_index to false.
351
358
 
359
+ ### suppress_type_name
360
+
361
+ In Elasticsearch 7.x, Elasticsearch cluster complains the following types removal warnings:
362
+
363
+ ```json
364
+ {"type": "deprecation", "timestamp": "2020-07-03T08:02:20,830Z", "level": "WARN", "component": "o.e.d.a.b.BulkRequestParser", "cluster.name": "docker-cluster", "node.name": "70dd5c6b94c3", "message": "[types removal] Specifying types in bulk requests is deprecated.", "cluster.uuid": "NoJJmtzfTtSzSMv0peG8Wg", "node.id": "VQ-PteHmTVam2Pnbg7xWHw" }
365
+ ```
366
+
367
+ This can be suppressed with:
368
+
369
+ ```
370
+ suppress_type_name true
371
+ ```
372
+
352
373
  ### target_index_key
353
374
 
354
375
  Tell this plugin to find the index name to write to in the record under this key in preference to other mechanisms. Key can be specified as path to nested record using dot ('.') as a separator.
@@ -458,6 +479,8 @@ deflector_alias test-current
458
479
 
459
480
  If [rollover_index](#rollover_index) is set, then this parameter will be in effect otherwise ignored.
460
481
 
482
+ **NOTE:** Since 4.1.1, `deflector_alias` is prohibited to use with `enable_ilm`.
483
+
461
484
  ### index_prefix
462
485
 
463
486
  This parameter is marked as obsoleted.
@@ -969,7 +992,7 @@ reload_after 100
969
992
 
970
993
  #### Tips
971
994
 
972
- The included sniffer class does not required `out_elasticsearch`.
995
+ The included sniffer class is not required `out_elasticsearch`.
973
996
  You should tell Fluentd where the sniffer class exists.
974
997
 
975
998
  If you use td-agent, you must put the following lines into `TD_AGENT_DEFAULT` file:
@@ -983,7 +1006,39 @@ If you use Fluentd directly, you must pass the following lines as Fluentd comman
983
1006
 
984
1007
  ```
985
1008
  sniffer=$(td-agent-gem contents fluent-plugin-elasticsearch|grep elasticsearch_simple_sniffer.rb)
986
- $ fluentd -r $sniffer" [AND YOUR OTHER OPTIONS]
1009
+ $ fluentd -r $sniffer [AND YOUR OTHER OPTIONS]
1010
+ ```
1011
+
1012
+ ### Selector Class Name
1013
+
1014
+ The default selector used by the `Elasticsearch::Transport` class works well when Fluentd should behave round robin and random selector cases. This doesn't work well when Fluentd should behave fallbacking from exhausted ES cluster to normal ES cluster.
1015
+ The parameter `selector_class_name` gives you the ability to provide your own Selector class to implement whatever selection nodes logic you require.
1016
+
1017
+ The below configuration is using plugin built-in `ElasticseatchFallbackSelector`:
1018
+
1019
+ ```
1020
+ hosts exhausted-host:9201,normal-host:9200
1021
+ selector_class_name "Fluent::Plugin::ElasticseatchFallbackSelector"
1022
+ ```
1023
+
1024
+ #### Tips
1025
+
1026
+ The included selector class is required in `out_elasticsearch` by default.
1027
+ But, your custom selector class is not required in `out_elasticsearch`.
1028
+ You should tell Fluentd where the selector class exists.
1029
+
1030
+ If you use td-agent, you must put the following lines into `TD_AGENT_DEFAULT` file:
1031
+
1032
+ ```
1033
+ selector=/path/to/your_awesome_selector.rb
1034
+ TD_AGENT_OPTIONS="--use-v1-config -r $selector"
1035
+ ```
1036
+
1037
+ If you use Fluentd directly, you must pass the following lines as Fluentd command line option:
1038
+
1039
+ ```
1040
+ selector=/path/to/your_awesome_selector.rb
1041
+ $ fluentd -r $selector [AND YOUR OTHER OPTIONS]
987
1042
  ```
988
1043
 
989
1044
  ### Reload After
@@ -1213,6 +1268,14 @@ Default value is `{}`.
1213
1268
 
1214
1269
  **NOTE:** This parameter requests to install elasticsearch-xpack gem.
1215
1270
 
1271
+ ## ilm_policies
1272
+
1273
+ A hash in the format `{"ilm_policy_id1":{ <ILM policy 1 hash> }, "ilm_policy_id2": { <ILM policy 2 hash> }}`.
1274
+
1275
+ Default value is `{}`.
1276
+
1277
+ **NOTE:** This parameter requests to install elasticsearch-xpack gem.
1278
+
1216
1279
  ## ilm_policy_overwrite
1217
1280
 
1218
1281
  Specify whether overwriting ilm policy or not.
@@ -1233,6 +1296,36 @@ Default value is `nil`.
1233
1296
 
1234
1297
  See [Elasticsearch Input plugin document](README.ElasticsearchInput.md)
1235
1298
 
1299
+ ## Configuration - Elasticsearch Filter GenID
1300
+
1301
+ See [Elasticsearch Filter GenID document](README.ElasticsearchGenID.md)
1302
+
1303
+ ## Elasticsearch permissions
1304
+
1305
+ If the target Elasticsearch requires authentication, a user holding the necessary permissions needs to be provided.
1306
+
1307
+ The set of required permissions are the following:
1308
+
1309
+ ```json
1310
+ "cluster": ["manage_index_templates", "monitor", "manage_ilm"],
1311
+ "indices": [
1312
+ {
1313
+ "names": [ "*" ],
1314
+ "privileges": ["write","create","delete","create_index","manage","manage_ilm"]
1315
+ }
1316
+ ]
1317
+ ```
1318
+
1319
+ These permissions can be narrowed down by:
1320
+
1321
+ - Setting a more specific pattern for indices under the `names` field
1322
+ - Removing the `manage_index_templates` cluster permission when not using the feature within your plugin configuration
1323
+ - Removing the `manage_ilm` cluster permission and the `manage` and `manage_ilm` indices privileges when not using ilm
1324
+ features in the plugin configuration
1325
+
1326
+ The list of privileges along with their description can be found in
1327
+ [security privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-privileges.html).
1328
+
1236
1329
  ## Troubleshooting
1237
1330
 
1238
1331
  ### Cannot send events to Elasticsearch
@@ -1662,7 +1755,7 @@ ILM target index alias is created with `index_name` or an index which is calcula
1662
1755
 
1663
1756
  From Elasticsearch plugin v4.0.0, ILM target index will be calculated from `index_name` (normal mode) or `logstash_prefix` (using with `logstash_format`as true).
1664
1757
 
1665
- When using `deflector_alias` parameter, Elasticsearch plugin will create ILM target indices alias with `deflector_alias` instead of `index_name` or an index which is calculated from `logstash_prefix`. This behavior should be kept due to backward ILM feature compatibility.
1758
+ **NOTE:** Before Elasticsearch plugin v4.1.0, using `deflector_alias` parameter when ILM is enabled is permitted and handled, but, in the later releases such that 4.1.1 or later, it cannot use with when ILM is enabled.
1666
1759
 
1667
1760
  And also, ILM feature users should specify their Elasticsearch template for ILM enabled indices.
1668
1761
  Because ILM settings are injected into their Elasticsearch templates.
@@ -1675,7 +1768,13 @@ It usually should be used with default value which is `default`.
1675
1768
 
1676
1769
  Then, ILM parameters are used in alias index like as:
1677
1770
 
1678
- `<index_name/logstash_prefix><index_separator><application_name>-000001`.
1771
+ ##### Simple `index_name` case:
1772
+
1773
+ `<index_name><index_separator><application_name>-000001`.
1774
+
1775
+ ##### `logstash_format` as `true` case:
1776
+
1777
+ `<logstash_prefix><logstash_prefix_separator><application_name><logstash_prefix_separator><logstash_dateformat>-000001`.
1679
1778
 
1680
1779
  #### Example ILM settings
1681
1780
 
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'fluent-plugin-elasticsearch'
6
- s.version = '4.0.8'
6
+ s.version = '4.1.1'
7
7
  s.authors = ['diogo', 'pitr', 'Hiroshi Hatake']
8
8
  s.email = ['pitr.vern@gmail.com', 'me@diogoterror.com', 'cosmo0920.wp@gmail.com']
9
9
  s.description = %q{Elasticsearch output plugin for Fluent event collector}
@@ -0,0 +1,9 @@
1
+ require 'elasticsearch/transport/transport/connections/selector'
2
+
3
+ class Fluent::Plugin::ElasticseatchFallbackSelector
4
+ include Elasticsearch::Transport::Transport::Connections::Selector::Base
5
+
6
+ def select(options={})
7
+ connections.first
8
+ end
9
+ end
@@ -65,11 +65,12 @@ module Fluent::ElasticsearchIndexTemplate
65
65
  end
66
66
  end
67
67
 
68
- def template_install(name, template_file, overwrite, enable_ilm = false, deflector_alias_name = nil, ilm_policy_id = nil, host = nil)
68
+ def template_install(name, template_file, overwrite, enable_ilm = false, deflector_alias_name = nil, ilm_policy_id = nil, host = nil, target_index = nil)
69
69
  inject_template_name = get_template_name(enable_ilm, name, deflector_alias_name)
70
70
  if overwrite
71
71
  template_put(inject_template_name,
72
72
  enable_ilm ? inject_ilm_settings_to_template(deflector_alias_name,
73
+ target_index,
73
74
  ilm_policy_id,
74
75
  get_template(template_file)) :
75
76
  get_template(template_file), host)
@@ -80,6 +81,7 @@ module Fluent::ElasticsearchIndexTemplate
80
81
  if !template_exists?(inject_template_name, host)
81
82
  template_put(inject_template_name,
82
83
  enable_ilm ? inject_ilm_settings_to_template(deflector_alias_name,
84
+ target_index,
83
85
  ilm_policy_id,
84
86
  get_template(template_file)) :
85
87
  get_template(template_file), host)
@@ -89,10 +91,12 @@ module Fluent::ElasticsearchIndexTemplate
89
91
  end
90
92
  end
91
93
 
92
- def template_custom_install(template_name, template_file, overwrite, customize_template, enable_ilm, deflector_alias_name, ilm_policy_id, host)
94
+ def template_custom_install(template_name, template_file, overwrite, customize_template, enable_ilm, deflector_alias_name, ilm_policy_id, host, target_index)
93
95
  template_custom_name = get_template_name(enable_ilm, template_name, deflector_alias_name)
94
96
  custom_template = if enable_ilm
95
- inject_ilm_settings_to_template(deflector_alias_name, ilm_policy_id,
97
+ inject_ilm_settings_to_template(deflector_alias_name,
98
+ target_index,
99
+ ilm_policy_id,
96
100
  get_custom_template(template_file,
97
101
  customize_template))
98
102
  else
@@ -115,26 +119,30 @@ module Fluent::ElasticsearchIndexTemplate
115
119
  enable_ilm ? deflector_alias_name : template_name
116
120
  end
117
121
 
118
- def inject_ilm_settings_to_template(deflector_alias_name, ilm_policy_id, template)
122
+ def inject_ilm_settings_to_template(deflector_alias, target_index, ilm_policy_id, template)
119
123
  log.debug("Overwriting index patterns when Index Lifecycle Management is enabled.")
120
124
  template.delete('template') if template.include?('template')
121
- template['index_patterns'] = "#{deflector_alias_name}-*"
122
- template['order'] = template['order'] ? template['order'] + deflector_alias_name.split('-').length : 50 + deflector_alias_name.split('-').length
125
+ template['index_patterns'] = "#{target_index}-*"
126
+ template['order'] = template['order'] ? template['order'] + target_index.split('-').length : 50 + target_index.split('-').length
123
127
  if template['settings'] && (template['settings']['index.lifecycle.name'] || template['settings']['index.lifecycle.rollover_alias'])
124
128
  log.debug("Overwriting index lifecycle name and rollover alias when Index Lifecycle Management is enabled.")
125
129
  end
126
- template['settings'].update({ 'index.lifecycle.name' => ilm_policy_id, 'index.lifecycle.rollover_alias' => deflector_alias_name})
130
+ template['settings'].update({ 'index.lifecycle.name' => ilm_policy_id, 'index.lifecycle.rollover_alias' => deflector_alias})
127
131
  template
128
132
  end
129
133
 
130
- def create_rollover_alias(index_prefix, rollover_index, deflector_alias_name, app_name, index_date_pattern, index_separator, enable_ilm, ilm_policy_id, ilm_policy, ilm_policy_overwrite, host)
134
+ def create_rollover_alias(target_index, rollover_index, deflector_alias_name, app_name, index_date_pattern, index_separator, enable_ilm, ilm_policy_id, ilm_policy, ilm_policy_overwrite, host)
131
135
  # ILM request to create alias.
132
136
  if rollover_index || enable_ilm
133
137
  if !client.indices.exists_alias(:name => deflector_alias_name)
134
- if index_date_pattern.empty?
135
- index_name_temp='<'+index_prefix.downcase+index_separator+app_name.downcase+'-000001>'
138
+ if @logstash_format
139
+ index_name_temp = '<'+target_index+'-000001>'
136
140
  else
137
- index_name_temp='<'+index_prefix.downcase+index_separator+app_name.downcase+'-{'+index_date_pattern+'}-000001>'
141
+ if index_date_pattern.empty?
142
+ index_name_temp = '<'+target_index.downcase+index_separator+app_name.downcase+'-000001>'
143
+ else
144
+ index_name_temp = '<'+target_index.downcase+index_separator+app_name.downcase+'-{'+index_date_pattern+'}-000001>'
145
+ end
138
146
  end
139
147
  indexcreation(index_name_temp, host)
140
148
  body = rollover_alias_payload(deflector_alias_name)