# Не отрабатывает смена имени индекса

**URL:** <https://discuss.elastic.co/t/topic/185985>\
**Category:** Вопросы на русском языке\
**Created:** [June 17, 2019, 2:23am UTC](https://discuss.elastic.co/t/topic/185985 "2019-06-17T02:23:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PashaMak](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@PashaMak](https://discuss.elastic.co/u/PashaMak)\
**Post date:** [June 17, 2019, 2:23am UTC](https://discuss.elastic.co/t/topic/185985/1 "2019-06-17T02:23:56Z")

</div>

Добрый день.  
Установил эластик версии 7.0.0.  
В настройках прописал имя нового индекса:

```auto
#==================== Elasticsearch template ==========================

# загружать шаблон индекса в эластик, если шаблон есть он не перезаписывается
setup.template.enabled: true
# имя шаблона искомого в эластике для разбора индекса
setup.template.name: "onectj"
# паттерн шаблона 
setup.template.pattern: "onectj-*"

setup.template.json.enabled: false
setup.template.json.path: "${path.config}\\onectj.json"
setup.template.json.name: "onectj"

# загрузить шаблон filebeat в elastic
#setup.template.overwrite: true

#-------------------------- Elasticsearch output ------------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["localhost:9200"]
  # имя индекса, если нет то создается новый
  index: "onectj-%{+yyyy.MM.dd}"
  # разобъем на индексы по типам сообщений
  indices:
    - index: "onectj-scall-%{+yyyy.MM.dd}"
      when.contains:
        message: "SCALL"
    - index: "onectj-call-%{+yyyy.MM.dd}"
      when.contains:
        message: "CALL"
    - index: "onectj-conn-%{+yyyy.MM.dd}"
      when.contains:
        message: "CONN"
    - index: "onectj-excp-%{+yyyy.MM.dd}"
      when.contains:
        message: "EXCP"
    - index: "onectj-hasp-%{+yyyy.MM.dd}"
      when.contains:
        message: "HASP"

  timeout: 60

  pipeline: "onectj_pipeline"

#==============================================

```

Но создается основной индекс filebeat-7.0.0-2019.06.17-000001 по другой маске, почему?  
При этом по индексам созданным по условиям все создается корректно и применяется шаблон.

 ![%D0%9D%D0%B5%20%D1%81%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D0%B0%D0%BB%D0%B0%20%D1%81%D0%BC%D0%B5%D0%BD%D0%B0%20%D0%B8%D0%BC%D0%B5%D0%BD%D0%B8%20%D0%B8%D0%BD%D0%B4%D0%B5%D0%BA%D1%81%D0%B0](https://us1.discourse-cdn.com/elastic/original/3X/f/1/f1024638db384f5c34276f6d8928378124e16776.png)

Интересно еще что по индексу filebeat\* отрабатывает разбор сообщения но поля не индексируются, будто он создается по другому шаблону.

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [June 17, 2019, 11:16am UTC](https://discuss.elastic.co/t/topic/185985/2 "2019-06-17T11:16:00Z")

</div>

А в логах строчка вот такого типа не появляется?

```auto
$ grep ILM < filebeat 130 ↵
2019-06-17T07:09:31.354-0400	INFO	[index-management]	idxmgmt/std.go:165	Set output.elasticsearch.index to 'filebeat-7.1.1' as ILM is enabled.

```

Если да - то скорее всего вот это [https://github.com/elastic/beats/issues/11866](https://github.com/elastic/beats/issues/11866)

---

<div class="post-metadata">

**Author:** ![PashaMak](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@PashaMak](https://discuss.elastic.co/u/PashaMak)\
**Post date:** [June 18, 2019, 2:19am UTC](https://discuss.elastic.co/t/topic/185985/3 "2019-06-18T02:19:51Z")

</div>

Спасибо, помогло.  
В логах сообщения

| 2019-06-17T09:45:09.184+0700 | INFO | [index-management] | idxmgmt/std.go:223 | Auto ILM enable success. |
| --- | --- | --- | --- | --- |
| 2019-06-17T09:45:09.184+0700 | DEBUG | [elasticsearch] | elasticsearch/client.go:752 | GET [http://localhost:9200/\_ilm/policy/filebeat-7.0.0](http://localhost:9200/_ilm/policy/filebeat-7.0.0) |
| 2019-06-17T09:45:09.184+0700 | INFO | [index-management.ilm] | ilm/std.go:134 | do not generate ilm policy: exists=true, overwrite=false |
| 2019-06-17T09:45:09.184+0700 | INFO | [index-management] | idxmgmt/std.go:238 | ILM policy successfully loaded. |
| 2019-06-17T09:45:09.184+0700 | INFO | [index-management] | idxmgmt/std.go:361 | Set setup.template.name to '{filebeat-7.0.0 {now/d}-000001}' as ILM is enabled. |
| 2019-06-17T09:45:09.184+0700 | INFO | [index-management] | idxmgmt/std.go:366 | Set setup.template.pattern to 'filebeat-7.0.0-\*' as ILM is enabled. |
| 2019-06-17T09:45:09.184+0700 | INFO | [index-management] | idxmgmt/std.go:400 | Set settings.index.lifecycle.rollover\_alias in template to {filebeat-7.0.0 {now/d}-000001} as ILM is enabled. |
| 2019-06-17T09:45:09.184+0700 | INFO | [index-management] | idxmgmt/std.go:404 | Set settings.index.lifecycle.name in template to {filebeat-7.0.0 map[policy:{"phases":{"hot":{"actions":{"rollover":{"max\_age":"30d","max\_size":"50gb"}}}}}]} as ILM is enabled. |

Оказывается политика управления жизненным циклом индекса по умолчанию подставляет свои обозначения, чтобы брались настройки надо либо ее отключить либо доработать.

Для отключения добавил секцию

```
#============================== Setup ILM =====================================

# Configure Index Lifecycle Management Index Lifecycle Management creates a
# write alias and adds additional settings to the template.
# The elasticsearch.output.index setting will be replaced with the write alias
# if ILM is enabled.
# Enabled ILM support. Valid values are true, false, and auto. The beat will
# detect availabilty of Index Lifecycle Management in Elasticsearch and enable
# or disable ILM support.

# изменение имени индекса по умолчанию будет игнорироваться
# если включена ILM (управление жизненным циклом индекса)
# filebeat 7.0+
setup.ilm.enabled: false

```

Более подробно о политике можно узнать по ссылке [https://www.elastic.co/guide/en/beats/filebeat/7.0/ilm.html#setup-ilm-overwrite-option](https://www.elastic.co/guide/en/beats/filebeat/7.0/ilm.html#setup-ilm-overwrite-option)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 16, 2019, 2:19am UTC](https://discuss.elastic.co/t/topic/185985/4 "2019-07-16T02:19:55Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
