fluent-plugin-elasticsearch 4.1.4 → 4.3.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: c7923225803a37c0076c7cb4c4d6e94c1ec9ccf120ce4067b45db8c0fc19f17f
4
- data.tar.gz: f1ce4098fb1e4e563e00aae9fe8d30b2bc9cfcb08100616f0ff00b3dfa210667
3
+ metadata.gz: 1cd81dcd51b189a0197c440aee9211661cd277c668ecf84474540393d77e47f0
4
+ data.tar.gz: c8b22ada3eaa16f7423e04c804130f35a12c15de34565272a7048dda78fc0d83
5
5
  SHA512:
6
- metadata.gz: '0579350a7eba583c7c4784f5500d9faa6df4e398b4b0d0e4aacf230502751a39fb9591d189217c869a82f6da689ffb435445aea7bd5920332787e787170b37d7'
7
- data.tar.gz: 8d150716862d82b313a31b104842b368aac3f945bece0a11074bf43a25830c91e6b5ee0556a23e93fdc2159ab20185e08847b4c94bb10033fe7b259741b332b6
6
+ metadata.gz: 0564d3b40b180c425c68323dbaf7498e7483e4832a76262c8378ffdcb8bb4591e62b77a53a6a0c232ba418d397a2d74447d24b77441aca26a38aee02e0f389d2
7
+ data.tar.gz: f0274d59d1a6411ab320d93f3840325b1379f417f50c716ecba75ea0eda31392d75c1f41efcb958c825745ada6aaa3f6810da96aae4bfde7f11e6e03602242aa
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Create a report to help us improve. If you have questions about ES plugin on kubernetes, please direct these to https://discuss.kubernetes.io/ before sumbit kubernetes related issue.
4
+
5
+ ---
6
+
7
+ (check apply)
8
+ - [ ] read [the contribution guideline](https://github.com/uken/fluent-plugin-elasticsearch/blob/master/CONTRIBUTING.md)
9
+ - [ ] (optional) already reported 3rd party upstream repository or mailing list if you use k8s addon or helm charts.
10
+
11
+ #### Problem
12
+
13
+ ...
14
+
15
+ #### Steps to replicate
16
+
17
+ Either clone and modify https://gist.github.com/pitr/9a518e840db58f435911
18
+
19
+ **OR**
20
+
21
+ Provide example config and message
22
+
23
+ #### Expected Behavior or What you need to ask
24
+
25
+ ...
26
+
27
+ #### Using Fluentd and ES plugin versions
28
+
29
+ * OS version
30
+ * Bare Metal or within Docker or Kubernetes or others?
31
+ * Fluentd v0.12 or v0.14/v1.0
32
+ * paste result of ``fluentd --version`` or ``td-agent --version``
33
+ * ES plugin 3.x.y/2.x.y or 1.x.y
34
+ * paste boot log of fluentd or td-agent
35
+ * paste result of ``fluent-gem list``, ``td-agent-gem list`` or your Gemfile.lock
36
+ * ES version (optional)
37
+ * ES template(s) (optional)
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+
5
+ ---
6
+
7
+ (check apply)
8
+ - [ ] read [the contribution guideline](https://github.com/uken/fluent-plugin-elasticsearch/blob/master/CONTRIBUTING.md)
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+
12
+ <!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
13
+
14
+ **Describe the solution you'd like**
15
+
16
+ <!-- A clear and concise description of what you want to happen. -->
17
+
18
+ **Describe alternatives you've considered**
19
+
20
+ <!-- A clear and concise description of any alternative solutions or features you've considered. -->
21
+
22
+ **Additional context**
23
+
24
+ <!-- Add any other context or screenshots about the feature request here. -->
@@ -9,4 +9,4 @@ jobs:
9
9
  with:
10
10
  repo-token: ${{ secrets.GITHUB_TOKEN }}
11
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.*)"
12
+ issue-pattern: "(.*Problem.*)|(.*Expected Behavior or What you need to ask.*)|(.*Using Fluentd and ES plugin versions.*)|(.*Is your feature request related to a problem? Please describe.*)|(.*Describe the solution you'd like.*)|(.*Describe alternatives you've considered.*)"
@@ -8,7 +8,7 @@ jobs:
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- ruby: [ '2.4', '2.5', '2.6' ]
11
+ ruby: [ '2.4', '2.5', '2.6', '2.7' ]
12
12
  os:
13
13
  - ubuntu-latest
14
14
  name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
@@ -8,7 +8,7 @@ jobs:
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- ruby: [ '2.4', '2.5', '2.6' ]
11
+ ruby: [ '2.4', '2.5', '2.6', '2.7' ]
12
12
  os:
13
13
  - macOS-latest
14
14
  name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
@@ -8,7 +8,7 @@ jobs:
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- ruby: [ '2.4', '2.5', '2.6' ]
11
+ ruby: [ '2.4', '2.5', '2.6', '2.7' ]
12
12
  os:
13
13
  - windows-latest
14
14
  name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
data/History.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  ### [Unreleased]
4
4
 
5
+ ### 4.3.1
6
+ - Unsplit huge records by default (#851)
7
+
8
+ ### 4.3.0
9
+ - Add cloud_id & cloud_auth settings (#850)
10
+ - Fix failing tests on es6 client (#848)
11
+ - feat: retry on transport errors (#846)
12
+ - fix typo (#838)
13
+ - Remove unnecessary nil check (#826)
14
+
15
+ ### 4.2.2
16
+ - Remove unnecessary nil check (#826)
17
+ - Fix ILM rollover index template pattern to apply index_separator (#825)
18
+ - Fix ILM rollover alias creation when a placeholder is used in index_name (#823)
19
+ - Add a note about the pitfalls of per-date indexes used with ILM (#822)
20
+
21
+ ### 4.2.1
22
+ - Update a broken link (#821)
23
+ - Include chunk_id in records (#820)
24
+ - Fix a failing testcase (#818)
25
+
26
+ ### 4.2.0
27
+ - ci: Add Ruby 2.7 jobs (#812)
28
+ - Support Elasticsearch new style template (#810)
29
+
5
30
  ### 4.1.4
6
31
  - ElasticsearchGenID update docs for hash_type (#809)
7
32
  - Handle api key header (#808)
@@ -17,7 +17,7 @@
17
17
  In your Fluentd configuration, use `@type elasticsearch_genid`. Additional configuration is optional, default values would look like this:
18
18
 
19
19
  ```
20
- <source>
20
+ <filter>
21
21
  @type elasticsearch_genid
22
22
  hash_id_key _hash
23
23
  include_tag_in_seed false
@@ -27,7 +27,7 @@ In your Fluentd configuration, use `@type elasticsearch_genid`. Additional confi
27
27
  record_keys []
28
28
  separator _
29
29
  hash_type sha1
30
- </match>
30
+ </filter>
31
31
  ```
32
32
 
33
33
  ## Configuration
data/README.md CHANGED
@@ -19,6 +19,8 @@ Current maintainers: @cosmo0920
19
19
  * [Configuration](#configuration)
20
20
  + [host](#host)
21
21
  + [port](#port)
22
+ + [cloud_id](#cloud_id)
23
+ + [cloud_auth](#cloud_auth)
22
24
  + [emit_error_for_missing_id](#emit_error_for_missing_id)
23
25
  + [hosts](#hosts)
24
26
  + [user, password, path, scheme, ssl_verify](#user-password-path-scheme-ssl_verify)
@@ -101,6 +103,10 @@ Current maintainers: @cosmo0920
101
103
  + [ilm_policies](#ilm_policies)
102
104
  + [ilm_policy_overwrite](#ilm_policy_overwrite)
103
105
  + [truncate_caches_interval](#truncate_caches_interval)
106
+ + [use_legacy_template](#use_legacy_template)
107
+ + [metadata section](#metadata-section)
108
+ + [include_chunk_id](#include_chunk_id)
109
+ + [chunk_id_key](#chunk_id_key)
104
110
  * [Configuration - Elasticsearch Input](#configuration---elasticsearch-input)
105
111
  * [Configuration - Elasticsearch Filter GenID](#configuration---elasticsearch-filter-genid)
106
112
  * [Elasticsearch permissions](#elasticsearch-permissions)
@@ -183,6 +189,26 @@ port 9201 # defaults to 9200
183
189
 
184
190
  You can specify Elasticsearch port by this parameter.
185
191
 
192
+ ### cloud_id
193
+
194
+ ```
195
+ cloud_id test-dep:ZXVyb3BlLXdlc3QxLmdjcC5jbG91ZC5lcy5pbyRiYZTA1Ng==
196
+ ```
197
+
198
+ You can specify Elasticsearch cloud_id by this parameter.
199
+
200
+ If you specify `cloud_id` option then `cloud_auth` option is required.
201
+ If you specify `cloud_id` option, `host`, `port`, `user` and `password` options are ignored.
202
+
203
+ ### cloud_auth
204
+
205
+ ```
206
+ cloud_auth 'elastic:slkjdaooewkd87iqQ2O8EQYV'
207
+ ```
208
+
209
+ You can specify Elasticsearch cloud_auth by this parameter.
210
+
211
+
186
212
  ### emit_error_for_missing_id
187
213
 
188
214
  ```
@@ -497,7 +523,7 @@ Specify the application name for the rollover index to be created.
497
523
  application_name default # defaults to "default"
498
524
  ```
499
525
 
500
- If [enable_ilm](#enable_ilm is set, then this parameter will be in effect otherwise ignored.
526
+ If [enable_ilm](#enable_ilm) is set, then this parameter will be in effect otherwise ignored.
501
527
 
502
528
  ### template_overwrite
503
529
 
@@ -920,7 +946,7 @@ Starting with version 0.8.0, this gem uses excon, which supports proxy with envi
920
946
 
921
947
  ### Buffer options
922
948
 
923
- `fluentd-plugin-elasticsearch` extends [Fluentd's builtin Output plugin](https://docs.fluentd.org/v0.14/articles/output-plugin-overview) and use `compat_parameters` plugin helper. It adds the following options:
949
+ `fluentd-plugin-elasticsearch` extends [Fluentd's builtin Output plugin](https://docs.fluentd.org/output#overview) and use `compat_parameters` plugin helper. It adds the following options:
924
950
 
925
951
  ```
926
952
  buffer_type memory
@@ -1139,6 +1165,8 @@ And yet another option is described in Dynamic Configuration section.
1139
1165
 
1140
1166
  ### Dynamic configuration
1141
1167
 
1168
+ **NOTE**: *`out_elasticsearch_dynamic` will be planned to be marked as deprecated.* Please don't use the new Fluentd configuration. This plugin is maintained for backward compatibility.
1169
+
1142
1170
  If you want configurations to depend on information in messages, you can use `elasticsearch_dynamic`. This is an experimental variation of the Elasticsearch plugin allows configuration values to be specified in ways such as the below:
1143
1171
 
1144
1172
  ```
@@ -1251,7 +1279,7 @@ Default value is `true`.
1251
1279
 
1252
1280
  Configure `bulk_message` request splitting threshold size.
1253
1281
 
1254
- Default value is `20MB`. (20 * 1024 * 1024)
1282
+ Default value is `-1`(unlimited).
1255
1283
 
1256
1284
  If you specify this size as negative number, `bulk_message` request splitting feature will be disabled.
1257
1285
 
@@ -1303,6 +1331,63 @@ If it is set, timer for clearing `alias_indexes` and `template_names` caches wil
1303
1331
 
1304
1332
  Default value is `nil`.
1305
1333
 
1334
+ ## use_legacy_template
1335
+
1336
+ Use legacy template or not.
1337
+
1338
+ Elasticsearch 7.8 or later supports the brand new composable templates.
1339
+
1340
+ For Elasticsearch 7.7 or older, users should specify this parameter as `false`.
1341
+
1342
+ Composable template documentation is [Put Index Template API | Elasticsearch Reference](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-templates.html) and legacy template documentation is [Index Templates | Elasticsearch Reference](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates-v1.html).
1343
+
1344
+ Please confirm that whether the using Elasticsearch cluster(s) support the composable template feature or not when turn on the brand new feature with this parameter.
1345
+
1346
+ ## <metadata\> section
1347
+
1348
+ Users can specify whether including `chunk_id` information into records or not:
1349
+
1350
+ ```aconf
1351
+ <match your.awesome.routing.tag>
1352
+ @type elasticsearch
1353
+ # Other configurations.
1354
+ <metadata>
1355
+ include_chunk_id true
1356
+ # chunk_id_key chunk_id # Default value is "chunk_id".
1357
+ </metadata>
1358
+ </match>
1359
+ ```
1360
+
1361
+ ### include_chunk_id
1362
+
1363
+ Whether including `chunk_id` for not. Default value is `false`.
1364
+
1365
+ ```aconf
1366
+ <match your.awesome.routing.tag>
1367
+ @type elasticsearch
1368
+ # Other configurations.
1369
+ <metadata>
1370
+ include_chunk_id true
1371
+ </metadata>
1372
+ </match>
1373
+ ```
1374
+
1375
+
1376
+ ### chunk_id_key
1377
+
1378
+ Specify `chunk_id_key` to store `chunk_id` information into records. Default value is `chunk_id`.
1379
+
1380
+ ```aconf
1381
+ <match your.awesome.routing.tag>
1382
+ @type elasticsearch
1383
+ # Other configurations.
1384
+ <metadata>
1385
+ include_chunk_id
1386
+ chunk_id_key chunk_hex
1387
+ </metadata>
1388
+ </match>
1389
+ ```
1390
+
1306
1391
  ## Configuration - Elasticsearch Input
1307
1392
 
1308
1393
  See [Elasticsearch Input plugin document](README.ElasticsearchInput.md)
@@ -1820,6 +1905,16 @@ template_name your-fluentd-template
1820
1905
  template_file /path/to/fluentd-template.json
1821
1906
  ```
1822
1907
 
1908
+ Note that if you create a new set of indexes every day, the elasticsearch ILM policy system will treat each day separately and will always
1909
+ maintain a separate active write index for each day.
1910
+
1911
+ If you have a rollover based on max_age, it will continue to roll the indexes for prior dates even if no new documents are indexed. If you want
1912
+ to delete indexes after a period of time, the ILM policy will never delete the current write index regardless of its age, so you would need a separate
1913
+ system, such as curator, to actually delete the old indexes.
1914
+
1915
+ For this reason, if you put the date into the index names with ILM you should only rollover based on size or number of documents and may need to use
1916
+ curator to actually delete old indexes.
1917
+
1823
1918
  #### Fixed ILM indices
1824
1919
 
1825
1920
  Also, users can use fixed ILM indices configuration.
@@ -1935,4 +2030,7 @@ Install dev dependencies:
1935
2030
  $ gem install bundler
1936
2031
  $ bundle install
1937
2032
  $ bundle exec rake test
2033
+ # To just run the test you are working on:
2034
+ $ bundle exec rake test TEST=test/plugin/test_out_elasticsearch.rb TESTOPTS='--verbose --name=test_custom_template_with_rollover_index_create_and_custom_ilm'
2035
+
1938
2036
  ```
@@ -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.1.4'
6
+ s.version = '4.3.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}
@@ -22,18 +22,23 @@ module Fluent::ElasticsearchIndexTemplate
22
22
  end
23
23
 
24
24
  def template_exists?(name, host = nil)
25
- client(host).indices.get_template(:name => name)
25
+ if @use_legacy_template
26
+ client(host).indices.get_template(:name => name)
27
+ else
28
+ client(host).indices.get_index_template(:name => name)
29
+ end
26
30
  return true
27
31
  rescue Elasticsearch::Transport::Transport::Errors::NotFound
28
32
  return false
29
33
  end
30
34
 
31
- def retry_operate(max_retries, fail_on_retry_exceed = true)
35
+ def retry_operate(max_retries, fail_on_retry_exceed = true, catch_trasport_exceptions = true)
32
36
  return unless block_given?
33
37
  retries = 0
38
+ transport_errors = Elasticsearch::Transport::Transport::Errors.constants.map{ |c| Elasticsearch::Transport::Transport::Errors.const_get c } if catch_trasport_exceptions
34
39
  begin
35
40
  yield
36
- rescue *client.transport.host_unreachable_exceptions, Timeout::Error => e
41
+ rescue *client.transport.host_unreachable_exceptions, *transport_errors, Timeout::Error => e
37
42
  @_es = nil
38
43
  @_es_info = nil
39
44
  if retries < max_retries
@@ -52,7 +57,11 @@ module Fluent::ElasticsearchIndexTemplate
52
57
  end
53
58
 
54
59
  def template_put(name, template, host = nil)
55
- client(host).indices.put_template(:name => name, :body => template)
60
+ if @use_legacy_template
61
+ client(host).indices.put_template(:name => name, :body => template)
62
+ else
63
+ client(host).indices.put_index_template(:name => name, :body => template)
64
+ end
56
65
  end
57
66
 
58
67
  def indexcreation(index_name, host = nil)
@@ -65,14 +74,15 @@ module Fluent::ElasticsearchIndexTemplate
65
74
  end
66
75
  end
67
76
 
68
- def template_install(name, template_file, overwrite, enable_ilm = false, deflector_alias_name = nil, ilm_policy_id = nil, host = nil, target_index = nil)
77
+ def template_install(name, template_file, overwrite, enable_ilm = false, deflector_alias_name = nil, ilm_policy_id = nil, host = nil, target_index = nil, index_separator = '-')
69
78
  inject_template_name = get_template_name(enable_ilm, name, deflector_alias_name)
70
79
  if overwrite
71
80
  template_put(inject_template_name,
72
81
  enable_ilm ? inject_ilm_settings_to_template(deflector_alias_name,
73
82
  target_index,
74
83
  ilm_policy_id,
75
- get_template(template_file)) :
84
+ get_template(template_file),
85
+ index_separator) :
76
86
  get_template(template_file), host)
77
87
 
78
88
  log.debug("Template '#{inject_template_name}' overwritten with #{template_file}.")
@@ -83,7 +93,8 @@ module Fluent::ElasticsearchIndexTemplate
83
93
  enable_ilm ? inject_ilm_settings_to_template(deflector_alias_name,
84
94
  target_index,
85
95
  ilm_policy_id,
86
- get_template(template_file)) :
96
+ get_template(template_file),
97
+ index_separator) :
87
98
  get_template(template_file), host)
88
99
  log.info("Template configured, but no template installed. Installed '#{inject_template_name}' from #{template_file}.")
89
100
  else
@@ -91,14 +102,15 @@ module Fluent::ElasticsearchIndexTemplate
91
102
  end
92
103
  end
93
104
 
94
- def template_custom_install(template_name, template_file, overwrite, customize_template, enable_ilm, deflector_alias_name, ilm_policy_id, host, target_index)
105
+ def template_custom_install(template_name, template_file, overwrite, customize_template, enable_ilm, deflector_alias_name, ilm_policy_id, host, target_index, index_separator)
95
106
  template_custom_name = get_template_name(enable_ilm, template_name, deflector_alias_name)
96
107
  custom_template = if enable_ilm
97
108
  inject_ilm_settings_to_template(deflector_alias_name,
98
109
  target_index,
99
110
  ilm_policy_id,
100
111
  get_custom_template(template_file,
101
- customize_template))
112
+ customize_template),
113
+ index_separator)
102
114
  else
103
115
  get_custom_template(template_file, customize_template)
104
116
  end
@@ -119,15 +131,31 @@ module Fluent::ElasticsearchIndexTemplate
119
131
  enable_ilm ? deflector_alias_name : template_name
120
132
  end
121
133
 
122
- def inject_ilm_settings_to_template(deflector_alias, target_index, ilm_policy_id, template)
134
+ def inject_ilm_settings_to_template(deflector_alias, target_index, ilm_policy_id, template, index_separator)
123
135
  log.debug("Overwriting index patterns when Index Lifecycle Management is enabled.")
124
- template.delete('template') if template.include?('template')
125
- template['index_patterns'] = "#{target_index}-*"
126
- template['order'] = template['order'] ? template['order'] + target_index.split('-').length : 50 + target_index.split('-').length
127
- if template['settings'] && (template['settings']['index.lifecycle.name'] || template['settings']['index.lifecycle.rollover_alias'])
128
- log.debug("Overwriting index lifecycle name and rollover alias when Index Lifecycle Management is enabled.")
136
+ template['index_patterns'] = "#{target_index}#{index_separator}*"
137
+ if @use_legacy_template
138
+ template.delete('template') if template.include?('template')
139
+ # Prepare settings Hash
140
+ if !template.key?('settings')
141
+ template['settings'] = {}
142
+ end
143
+ if template['settings'] && (template['settings']['index.lifecycle.name'] || template['settings']['index.lifecycle.rollover_alias'])
144
+ log.debug("Overwriting index lifecycle name and rollover alias when Index Lifecycle Management is enabled.")
145
+ end
146
+ template['settings'].update({ 'index.lifecycle.name' => ilm_policy_id, 'index.lifecycle.rollover_alias' => deflector_alias})
147
+ template['order'] = template['order'] ? template['order'] + target_index.count(index_separator) + 1 : 51 + target_index.count(index_separator)
148
+ else
149
+ # Prepare template.settings Hash
150
+ if !template['template'].key?('settings')
151
+ template['template']['settings'] = {}
152
+ end
153
+ if template['template']['settings'] && (template['template']['settings']['index.lifecycle.name'] || template['template']['settings']['index.lifecycle.rollover_alias'])
154
+ log.debug("Overwriting index lifecycle name and rollover alias when Index Lifecycle Management is enabled.")
155
+ end
156
+ template['template']['settings'].update({ 'index.lifecycle.name' => ilm_policy_id, 'index.lifecycle.rollover_alias' => deflector_alias})
157
+ template['priority'] = template['priority'] ? template['priority'] + target_index.count(index_separator) + 1 : 101 + target_index.count(index_separator)
129
158
  end
130
- template['settings'].update({ 'index.lifecycle.name' => ilm_policy_id, 'index.lifecycle.rollover_alias' => deflector_alias})
131
159
  template
132
160
  end
133
161