# Heartbeatのインデックス名を任意に指定する方法

**URL:** <https://discuss.elastic.co/t/heartbeat/219557>\
**Category:** 日本語による質問・議論はこちら\
**Created:** [February 17, 2020, 3:03am UTC](https://discuss.elastic.co/t/heartbeat/219557 "2020-02-17T03:03:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![t-nakata](https://avatars.discourse-cdn.com/v4/letter/t/8491ac/32.png) [@t-nakata](https://discuss.elastic.co/u/t-nakata)\
**Post date:** [February 17, 2020, 3:03am UTC](https://discuss.elastic.co/t/heartbeat/219557/1 "2020-02-17T03:03:50Z")

</div>

heartbeatからElasticsearchに送信したデータを、任意の名前でインデックス登録したいです。  
以下の設定をheartbeat.ymlに設定したのですが、デフォルトのheartbeat-7.5.0-2020.02.02-000003のような名前で入ってしまいます。  
考えられる原因を教えて頂けないでしょうか

#==================== Elasticsearch template setting ==========================

setup.template.name: "heartbeat-soctest"  
setup.template.pattern: "heartbeat-fb-\*"

#-------------------------- Elasticsearch output ------------------------------  
index: "heartbeat-fb-%{+yyyy.MM.dd}"  
setup.ilm.enabled: true  
setup.ilm.rollover\_alias: "heartbeat-fb"  
setup.ilm.policy\_name: "heartbeat-soctest"

---

<div class="post-metadata">

**Author:** ![tsgkdt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsgkdt/32/39151_2.png) [@tsgkdt](https://discuss.elastic.co/u/tsgkdt)\
**Post date:** [February 17, 2020, 4:12am UTC](https://discuss.elastic.co/t/heartbeat/219557/2 "2020-02-17T04:12:48Z")

</div>

こんにちわ

こちらで、新規環境で同じように設定し試したところ指定されたIndex名でデータが入っていました。

お見受けしたところ、000003のようなIndexが作成されていることから  
古い設定やデータが残っていてその影響がある、といったことはありませんでしょうか？  
一度、空のElasticsearch環境にHeartbeatを接続してみる、ということを試してみると良いかもしれません。

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/0/20f15590bd88c315b9f278fd4b3b3341680e29da.png)

使用したheartbeatの変更部分は以下の通りです。

```auto
#================================ General =====================================

setup.template.name: "heartbeat-soctest"
setup.template.pattern: "heartbeat-fb-*"

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

setup.ilm.enabled: auto
setup.ilm.rollover_alias: "heartbeat-fb"
setup.ilm.policy_name: "heartbeat-soctest"

#================================ Outputs =====================================

# Configure what output to use when sending the data collected by the beat.

#-------------------------- Elasticsearch output ------------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["localhost:9200"]
  index: "heartbeat-fb-%{+yyyy.MM.dd}"

```

---

<div class="post-metadata">

**Author:** ![tsgkdt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsgkdt/32/39151_2.png) [@tsgkdt](https://discuss.elastic.co/u/tsgkdt)\
**Post date:** [February 18, 2020, 3:14am UTC](https://discuss.elastic.co/t/heartbeat/219557/3 "2020-02-18T03:14:25Z")

</div>

何らかの理由があってindex名を変えたい、とのことだと思いますが、１つだけ補足させてください。

heartbeatで入れたデータは[Uptime](https://www.elastic.co/jp/uptime-monitoring)で可視化できるようになっていますが、Index名を変えるとUptimeで見るIndex先も変更してあげる必要があります。

> **[Ingest uptime data with Heartbeat | Elastic Observability \[8.11\] | Elastic](https://www.elastic.co/guide/en/observability/current/ingest-uptime.html)**

> - The Uptime UI requires a `heartbeat-8*` index pattern. If you have configured a different index pattern, you can use [index aliases](https://www.elastic.co/guide/en/elasticsearch/reference/7.6/indices-aliases.html) to ensure data is recognized by the UI.

UptimeのIndex指定については、こんな質問が過去にあったようです。

> [@Uptime indices setting available?](https://discuss.elastic.co/t/uptime-indices-setting-available/212311):
>
> Hi, in the spaces I've created, I limit access to certain indices, so space A has access to heartbeat-a-\* indices and space B has access to heartbeat-b-\* indices only. I've created role A and role B to achieve this. In the Metrics app or SIEM app, there are space related settings available, which I can use to set the used indices for that app in that space, for the Uptime app, I don't have this. This is a problem, if a user has both roles, then he sees the heartbeat monitors for both roles in …

---

<div class="post-metadata">

**Author:** ![t-nakata](https://avatars.discourse-cdn.com/v4/letter/t/8491ac/32.png) [@t-nakata](https://discuss.elastic.co/u/t-nakata)\
**Post date:** [February 18, 2020, 7:19am UTC](https://discuss.elastic.co/t/heartbeat/219557/4 "2020-02-18T07:19:48Z")

</div>

ご回答ありがとうございます。

設定を確認したところ、先頭に空白が入っていたことが原因のようでした。  
空白を消して先頭から定義したところ、想定通りの結果となりました

---

<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:** [March 17, 2020, 7:19am UTC](https://discuss.elastic.co/t/heartbeat/219557/5 "2020-03-17T07:19:48Z")

</div>

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