fluent-plugin-elasticsearch 4.1.2 → 4.2.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 367f610faf1266994e676a07ca2fc391bf0951036f356fd4a95a6a7d7cce1b61
4
- data.tar.gz: 56fc5e47f6dd8e63df03f6190fc0f3dfff2e1fae548b38cc9cdb328f75246ade
3
+ metadata.gz: d54b3f207af54f6fb5d3119f2d6d649478e25471fda03c56e00f9206ae72914e
4
+ data.tar.gz: 82eea8ed3938919f6860582698ce1253214531c806c132723e8845adfb45e2e0
5
5
  SHA512:
6
- metadata.gz: 812b336dcf870a4dbb2ecfbc87304b8c6b6cfafb561d2cf6eece11f35e29e9aa484ab8365fa9245a578c51ec540fcaf09925dc68668820ce3ab7c71041720dd2
7
- data.tar.gz: da2c1b8bbbdd364ff5a3df1214a54151a7e9e809230b12e75e06b42a0eb7df790124898cd6c137c82edede8c94f5e8adc9d7eea05134bff0a084d1de11b5269e
6
+ metadata.gz: c4fd2785f716d97cb8c44845c51f933f7d0ee69fe3e2911f85bf621d043015e815639350e363ce42866b224905fc20ae12b3666d302e5f1f07937f047123b20d
7
+ data.tar.gz: 15d34dc457c5a98b77f2142b271d3f4ef5f611e38caeb4f225f12dcfc2c3771dea0153bae3ebe99a83cc71c6e414d67e39fea1d2fa1fa430049f90839c677578
@@ -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,30 @@
2
2
 
3
3
  ### [Unreleased]
4
4
 
5
+ ### 4.2.2
6
+ - Remove unnecessary nil check (#826)
7
+ - Fix ILM rollover index template pattern to apply index_separator (#825)
8
+ - Fix ILM rollover alias creation when a placeholder is used in index_name (#823)
9
+ - Add a note about the pitfalls of per-date indexes used with ILM (#822)
10
+
11
+ ### 4.2.1
12
+ - Update a broken link (#821)
13
+ - Include chunk_id in records (#820)
14
+ - Fix a failing testcase (#818)
15
+
16
+ ### 4.2.0
17
+ - ci: Add Ruby 2.7 jobs (#812)
18
+ - Support Elasticsearch new style template (#810)
19
+
20
+ ### 4.1.4
21
+ - ElasticsearchGenID update docs for hash_type (#809)
22
+ - Handle api key header (#808)
23
+ - index_template: Handle error object entirely on index creation failure (#807)
24
+
25
+ ### 4.1.3
26
+ - Load multiple templates even if template_name and template_file given (#799)
27
+ - Handle elasticsearch-ruby 7.9.0 using HTTP method changes (#795)
28
+
5
29
  ### 4.1.2
6
30
  - Use Hash#dig instead of Hash#[] on retrieving version information from Elasticsearch info API (#793)
7
31
 
@@ -26,7 +26,7 @@ In your Fluentd configuration, use `@type elasticsearch_genid`. Additional confi
26
26
  use_entire_record false
27
27
  record_keys []
28
28
  separator _
29
- hash_type md5
29
+ hash_type sha1
30
30
  </match>
31
31
  ```
32
32
 
@@ -95,7 +95,7 @@ You can specify separator charactor to creating seed for hash generation.
95
95
  hash_type sha1
96
96
  ```
97
97
 
98
- You can specify hash algorithm.
98
+ You can specify hash algorithm. Support algorithms `md5`, `sha1`, `sha256`, `sha512`. Default: `sha1`
99
99
 
100
100
  ## Advanced Usage
101
101
 
data/README.md CHANGED
@@ -85,6 +85,7 @@ Current maintainers: @cosmo0920
85
85
  + [verify_es version at startup](#verify_es_version_at_startup)
86
86
  + [default_elasticsearch_version](#default_elasticsearch_version)
87
87
  + [custom_headers](#custom_headers)
88
+ + [api_key](#api_key)
88
89
  + [Not seeing a config you need?](#not-seeing-a-config-you-need)
89
90
  + [Dynamic configuration](#dynamic-configuration)
90
91
  + [Placeholders](#placeholders)
@@ -100,6 +101,10 @@ Current maintainers: @cosmo0920
100
101
  + [ilm_policies](#ilm_policies)
101
102
  + [ilm_policy_overwrite](#ilm_policy_overwrite)
102
103
  + [truncate_caches_interval](#truncate_caches_interval)
104
+ + [use_legacy_template](#use_legacy_template)
105
+ + [metadata section](#metadata-section)
106
+ + [include_chunk_id](#include_chunk_id)
107
+ + [chunk_id_key](#chunk_id_key)
103
108
  * [Configuration - Elasticsearch Input](#configuration---elasticsearch-input)
104
109
  * [Configuration - Elasticsearch Filter GenID](#configuration---elasticsearch-filter-genid)
105
110
  * [Elasticsearch permissions](#elasticsearch-permissions)
@@ -431,7 +436,7 @@ Specify index templates in form of hash. Can contain multiple templates.
431
436
  templates { "template_name_1": "path_to_template_1_file", "template_name_2": "path_to_template_2_file"}
432
437
  ```
433
438
 
434
- If `template_file` and `template_name` are set, then this parameter will be ignored.
439
+ **Note:** Before ES plugin v4.1.2, if `template_file` and `template_name` are set, then this parameter will be ignored. In 4.1.3 or later, `template_file` and `template_name` can work with `templates`.
435
440
 
436
441
  ### customize_template
437
442
 
@@ -919,7 +924,7 @@ Starting with version 0.8.0, this gem uses excon, which supports proxy with envi
919
924
 
920
925
  ### Buffer options
921
926
 
922
- `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:
927
+ `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:
923
928
 
924
929
  ```
925
930
  buffer_type memory
@@ -1106,6 +1111,14 @@ This parameter adds additional headers to request. The default value is `{}`.
1106
1111
  custom_headers {"token":"secret"}
1107
1112
  ```
1108
1113
 
1114
+ ### api_key
1115
+
1116
+ This parameter adds authentication header. The default value is `nil`.
1117
+
1118
+ ```
1119
+ api_key "ElasticsearchAPIKEY"
1120
+ ```
1121
+
1109
1122
  ### Not seeing a config you need?
1110
1123
 
1111
1124
  We try to keep the scope of this plugin small and not add too many configuration options. If you think an option would be useful to others, feel free to open an issue or contribute a Pull Request.
@@ -1294,6 +1307,63 @@ If it is set, timer for clearing `alias_indexes` and `template_names` caches wil
1294
1307
 
1295
1308
  Default value is `nil`.
1296
1309
 
1310
+ ## use_legacy_template
1311
+
1312
+ Use legacy template or not.
1313
+
1314
+ Elasticsearch 7.8 or later supports the brand new composable templates.
1315
+
1316
+ For Elasticsearch 7.7 or older, users should specify this parameter as `false`.
1317
+
1318
+ 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).
1319
+
1320
+ 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.
1321
+
1322
+ ## <metadata\> section
1323
+
1324
+ Users can specify whether including `chunk_id` information into records or not:
1325
+
1326
+ ```aconf
1327
+ <match your.awesome.routing.tag>
1328
+ @type elasticsearch
1329
+ # Other configurations.
1330
+ <metadata>
1331
+ include_chunk_id true
1332
+ # chunk_id_key chunk_id # Default value is "chunk_id".
1333
+ </metadata>
1334
+ </match>
1335
+ ```
1336
+
1337
+ ### include_chunk_id
1338
+
1339
+ Whether including `chunk_id` for not. Default value is `false`.
1340
+
1341
+ ```aconf
1342
+ <match your.awesome.routing.tag>
1343
+ @type elasticsearch
1344
+ # Other configurations.
1345
+ <metadata>
1346
+ include_chunk_id true
1347
+ </metadata>
1348
+ </match>
1349
+ ```
1350
+
1351
+
1352
+ ### chunk_id_key
1353
+
1354
+ Specify `chunk_id_key` to store `chunk_id` information into records. Default value is `chunk_id`.
1355
+
1356
+ ```aconf
1357
+ <match your.awesome.routing.tag>
1358
+ @type elasticsearch
1359
+ # Other configurations.
1360
+ <metadata>
1361
+ include_chunk_id
1362
+ chunk_id_key chunk_hex
1363
+ </metadata>
1364
+ </match>
1365
+ ```
1366
+
1297
1367
  ## Configuration - Elasticsearch Input
1298
1368
 
1299
1369
  See [Elasticsearch Input plugin document](README.ElasticsearchInput.md)
@@ -1811,6 +1881,16 @@ template_name your-fluentd-template
1811
1881
  template_file /path/to/fluentd-template.json
1812
1882
  ```
1813
1883
 
1884
+ 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
1885
+ maintain a separate active write index for each day.
1886
+
1887
+ 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
1888
+ 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
1889
+ system, such as curator, to actually delete the old indexes.
1890
+
1891
+ 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
1892
+ curator to actually delete old indexes.
1893
+
1814
1894
  #### Fixed ILM indices
1815
1895
 
1816
1896
  Also, users can use fixed ILM indices configuration.
@@ -1926,4 +2006,7 @@ Install dev dependencies:
1926
2006
  $ gem install bundler
1927
2007
  $ bundle install
1928
2008
  $ bundle exec rake test
2009
+ # To just run the test you are working on:
2010
+ $ bundle exec rake test TEST=test/plugin/test_out_elasticsearch.rb TESTOPTS='--verbose --name=test_custom_template_with_rollover_index_create_and_custom_ilm'
2011
+
1929
2012
  ```
@@ -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.2'
6
+ s.version = '4.2.2'
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,7 +22,11 @@ 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
@@ -52,7 +56,11 @@ module Fluent::ElasticsearchIndexTemplate
52
56
  end
53
57
 
54
58
  def template_put(name, template, host = nil)
55
- client(host).indices.put_template(:name => name, :body => template)
59
+ if @use_legacy_template
60
+ client(host).indices.put_template(:name => name, :body => template)
61
+ else
62
+ client(host).indices.put_index_template(:name => name, :body => template)
63
+ end
56
64
  end
57
65
 
58
66
  def indexcreation(index_name, host = nil)
@@ -61,18 +69,19 @@ module Fluent::ElasticsearchIndexTemplate
61
69
  if e.message =~ /"already exists"/ || e.message =~ /resource_already_exists_exception/
62
70
  log.debug("Index #{index_name} already exists")
63
71
  else
64
- log.error("Error while index creation - #{index_name}: #{e.inspect}")
72
+ log.error("Error while index creation - #{index_name}", error: e)
65
73
  end
66
74
  end
67
75
 
68
- def template_install(name, template_file, overwrite, enable_ilm = false, deflector_alias_name = nil, ilm_policy_id = nil, host = nil, target_index = nil)
76
+ 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
77
  inject_template_name = get_template_name(enable_ilm, name, deflector_alias_name)
70
78
  if overwrite
71
79
  template_put(inject_template_name,
72
80
  enable_ilm ? inject_ilm_settings_to_template(deflector_alias_name,
73
81
  target_index,
74
82
  ilm_policy_id,
75
- get_template(template_file)) :
83
+ get_template(template_file),
84
+ index_separator) :
76
85
  get_template(template_file), host)
77
86
 
78
87
  log.debug("Template '#{inject_template_name}' overwritten with #{template_file}.")
@@ -83,7 +92,8 @@ module Fluent::ElasticsearchIndexTemplate
83
92
  enable_ilm ? inject_ilm_settings_to_template(deflector_alias_name,
84
93
  target_index,
85
94
  ilm_policy_id,
86
- get_template(template_file)) :
95
+ get_template(template_file),
96
+ index_separator) :
87
97
  get_template(template_file), host)
88
98
  log.info("Template configured, but no template installed. Installed '#{inject_template_name}' from #{template_file}.")
89
99
  else
@@ -91,14 +101,15 @@ module Fluent::ElasticsearchIndexTemplate
91
101
  end
92
102
  end
93
103
 
94
- def template_custom_install(template_name, template_file, overwrite, customize_template, enable_ilm, deflector_alias_name, ilm_policy_id, host, target_index)
104
+ 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
105
  template_custom_name = get_template_name(enable_ilm, template_name, deflector_alias_name)
96
106
  custom_template = if enable_ilm
97
107
  inject_ilm_settings_to_template(deflector_alias_name,
98
108
  target_index,
99
109
  ilm_policy_id,
100
110
  get_custom_template(template_file,
101
- customize_template))
111
+ customize_template),
112
+ index_separator)
102
113
  else
103
114
  get_custom_template(template_file, customize_template)
104
115
  end
@@ -119,15 +130,31 @@ module Fluent::ElasticsearchIndexTemplate
119
130
  enable_ilm ? deflector_alias_name : template_name
120
131
  end
121
132
 
122
- def inject_ilm_settings_to_template(deflector_alias, target_index, ilm_policy_id, template)
133
+ def inject_ilm_settings_to_template(deflector_alias, target_index, ilm_policy_id, template, index_separator)
123
134
  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.")
135
+ template['index_patterns'] = "#{target_index}#{index_separator}*"
136
+ if @use_legacy_template
137
+ template.delete('template') if template.include?('template')
138
+ # Prepare settings Hash
139
+ if !template.key?('settings')
140
+ template['settings'] = {}
141
+ end
142
+ if template['settings'] && (template['settings']['index.lifecycle.name'] || template['settings']['index.lifecycle.rollover_alias'])
143
+ log.debug("Overwriting index lifecycle name and rollover alias when Index Lifecycle Management is enabled.")
144
+ end
145
+ template['settings'].update({ 'index.lifecycle.name' => ilm_policy_id, 'index.lifecycle.rollover_alias' => deflector_alias})
146
+ template['order'] = template['order'] ? template['order'] + target_index.count(index_separator) + 1 : 51 + target_index.count(index_separator)
147
+ else
148
+ # Prepare template.settings Hash
149
+ if !template['template'].key?('settings')
150
+ template['template']['settings'] = {}
151
+ end
152
+ if template['template']['settings'] && (template['template']['settings']['index.lifecycle.name'] || template['template']['settings']['index.lifecycle.rollover_alias'])
153
+ log.debug("Overwriting index lifecycle name and rollover alias when Index Lifecycle Management is enabled.")
154
+ end
155
+ template['template']['settings'].update({ 'index.lifecycle.name' => ilm_policy_id, 'index.lifecycle.rollover_alias' => deflector_alias})
156
+ template['priority'] = template['priority'] ? template['priority'] + target_index.count(index_separator) + 1 : 101 + target_index.count(index_separator)
129
157
  end
130
- template['settings'].update({ 'index.lifecycle.name' => ilm_policy_id, 'index.lifecycle.rollover_alias' => deflector_alias})
131
158
  template
132
159
  end
133
160
 
@@ -8,6 +8,7 @@ rescue LoadError
8
8
  end
9
9
  require 'json'
10
10
  require 'uri'
11
+ require 'base64'
11
12
  begin
12
13
  require 'strptime'
13
14
  rescue LoadError
@@ -17,6 +18,7 @@ require 'fluent/plugin/output'
17
18
  require 'fluent/event'
18
19
  require 'fluent/error'
19
20
  require 'fluent/time'
21
+ require 'fluent/unique_id'
20
22
  require 'fluent/log-ext'
21
23
  require 'zlib'
22
24
  require_relative 'elasticsearch_constants'
@@ -57,6 +59,7 @@ module Fluent::Plugin
57
59
  attr_reader :template_names
58
60
  attr_reader :ssl_version_options
59
61
  attr_reader :compressable_connection
62
+ attr_reader :api_key_header
60
63
 
61
64
  helpers :event_emitter, :compat_parameters, :record_accessor, :timer
62
65
 
@@ -155,6 +158,7 @@ EOC
155
158
  config_param :default_elasticsearch_version, :integer, :default => DEFAULT_ELASTICSEARCH_VERSION
156
159
  config_param :log_es_400_reason, :bool, :default => false
157
160
  config_param :custom_headers, :hash, :default => {}
161
+ config_param :api_key, :string, :default => nil, :secret => true
158
162
  config_param :suppress_doc_wrap, :bool, :default => false
159
163
  config_param :ignore_exceptions, :array, :default => [], value_type: :string, :desc => "Ignorable exception list"
160
164
  config_param :exception_backup, :bool, :default => true, :desc => "Chunk backup flag when ignore exception occured"
@@ -166,6 +170,12 @@ EOC
166
170
  config_param :ilm_policies, :hash, :default => {}
167
171
  config_param :ilm_policy_overwrite, :bool, :default => false
168
172
  config_param :truncate_caches_interval, :time, :default => nil
173
+ config_param :use_legacy_template, :bool, :default => true
174
+
175
+ config_section :metadata, param_name: :metainfo, multi: false do
176
+ config_param :include_chunk_id, :bool, :default => false
177
+ config_param :chunk_id_key, :string, :default => "chunk_id".freeze
178
+ end
169
179
 
170
180
  config_section :buffer do
171
181
  config_set_default :@type, DEFAULT_BUFFER_TYPE
@@ -212,6 +222,8 @@ EOC
212
222
  @remove_keys_on_update = @remove_keys_on_update.split ','
213
223
  end
214
224
 
225
+ @api_key_header = setup_api_key
226
+
215
227
  raise Fluent::ConfigError, "'max_retry_putting_template' must be greater than or equal to zero." if @max_retry_putting_template < 0
216
228
  raise Fluent::ConfigError, "'max_retry_get_es_version' must be greater than or equal to zero." if @max_retry_get_es_version < 0
217
229
 
@@ -247,7 +259,8 @@ EOC
247
259
  template_installation_actual(@deflector_alias ? @deflector_alias : @index_name, @template_name, @customize_template, @application_name, @index_name, @ilm_policy_id)
248
260
  end
249
261
  verify_ilm_working if @enable_ilm
250
- elsif @templates
262
+ end
263
+ if @templates
251
264
  retry_operate(@max_retry_putting_template, @fail_on_putting_template_retry_exceed) do
252
265
  templates_hash_install(@templates, @template_overwrite)
253
266
  end
@@ -397,6 +410,12 @@ EOC
397
410
  end
398
411
  end
399
412
 
413
+ def setup_api_key
414
+ return {} unless @api_key
415
+
416
+ { "Authorization" => "ApiKey " + Base64.strict_encode64(@api_key) }
417
+ end
418
+
400
419
  def dry_run?
401
420
  if Fluent::Engine.respond_to?(:dry_run_mode)
402
421
  Fluent::Engine.dry_run_mode
@@ -557,7 +576,10 @@ EOC
557
576
  else
558
577
  {}
559
578
  end
560
- headers = { 'Content-Type' => @content_type.to_s }.merge(@custom_headers).merge(gzip_headers)
579
+ headers = { 'Content-Type' => @content_type.to_s }
580
+ .merge(@custom_headers)
581
+ .merge(@api_key_header)
582
+ .merge(gzip_headers)
561
583
  ssl_options = { verify: @ssl_verify, ca_file: @ca_file}.merge(@ssl_version_options)
562
584
 
563
585
  transport = Elasticsearch::Transport::Transport::HTTP::Faraday.new(connection_options.merge(
@@ -755,6 +777,15 @@ EOC
755
777
  true
756
778
  end
757
779
 
780
+ def inject_chunk_id_to_record_if_needed(record, chunk_id)
781
+ if @metainfo&.include_chunk_id
782
+ record[@metainfo.chunk_id_key] = chunk_id
783
+ record
784
+ else
785
+ record
786
+ end
787
+ end
788
+
758
789
  def write(chunk)
759
790
  bulk_message_count = Hash.new { |h,k| h[k] = 0 }
760
791
  bulk_message = Hash.new { |h,k| h[k] = '' }
@@ -762,6 +793,7 @@ EOC
762
793
  meta = {}
763
794
 
764
795
  tag = chunk.metadata.tag
796
+ chunk_id = dump_unique_id_hex(chunk.unique_id)
765
797
  extracted_values = expand_placeholders(chunk)
766
798
  host = if @hosts
767
799
  extract_placeholders(@hosts, chunk)
@@ -771,6 +803,9 @@ EOC
771
803
 
772
804
  chunk.msgpack_each do |time, record|
773
805
  next unless record.is_a? Hash
806
+
807
+ record = inject_chunk_id_to_record_if_needed(record, chunk_id)
808
+
774
809
  begin
775
810
  meta, header, record = process_message(tag, meta, header, time, record, extracted_values)
776
811
  info = if @include_index_in_url
@@ -947,22 +982,24 @@ EOC
947
982
 
948
983
  def template_installation_actual(deflector_alias, template_name, customize_template, application_name, target_index, ilm_policy_id, host=nil)
949
984
  if template_name && @template_file
950
- if !@logstash_format && @alias_indexes.include?(deflector_alias)
951
- log.debug("Index alias #{deflector_alias} already exists (cached)")
952
- elsif !@logstash_format && @template_names.include?(template_name)
953
- log.debug("Template name #{template_name} already exists (cached)")
985
+ if !@logstash_format && (deflector_alias.nil? || (@alias_indexes.include? deflector_alias)) && (@template_names.include? template_name)
986
+ if deflector_alias
987
+ log.debug("Index alias #{deflector_alias} and template #{template_name} already exist (cached)")
988
+ else
989
+ log.debug("Template #{template_name} already exists (cached)")
990
+ end
954
991
  else
955
992
  retry_operate(@max_retry_putting_template, @fail_on_putting_template_retry_exceed) do
956
993
  if customize_template
957
- template_custom_install(template_name, @template_file, @template_overwrite, customize_template, @enable_ilm, deflector_alias, ilm_policy_id, host, target_index)
994
+ template_custom_install(template_name, @template_file, @template_overwrite, customize_template, @enable_ilm, deflector_alias, ilm_policy_id, host, target_index, @index_separator)
958
995
  else
959
- template_install(template_name, @template_file, @template_overwrite, @enable_ilm, deflector_alias, ilm_policy_id, host, target_index)
996
+ template_install(template_name, @template_file, @template_overwrite, @enable_ilm, deflector_alias, ilm_policy_id, host, target_index, @index_separator)
960
997
  end
961
998
  ilm_policy = @ilm_policies[ilm_policy_id] || {}
962
999
  create_rollover_alias(target_index, @rollover_index, deflector_alias, application_name, @index_date_pattern, @index_separator, @enable_ilm, ilm_policy_id, ilm_policy, @ilm_policy_overwrite, host)
963
1000
  end
964
1001
  @alias_indexes << deflector_alias unless deflector_alias.nil?
965
- @template_names << template_name unless template_name.nil?
1002
+ @template_names << template_name
966
1003
  end
967
1004
  end
968
1005
  end