# Filebeat: Template Creation Error

**URL:** <https://discuss.elastic.co/t/filebeat-template-creation-error/177222>\
**Category:** Beats\
**Created:** [April 17, 2019, 7:56am UTC](https://discuss.elastic.co/t/filebeat-template-creation-error/177222 "2019-04-17T07:56:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dawiro](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@dawiro](https://discuss.elastic.co/u/dawiro)\
**Post date:** [April 17, 2019, 7:56am UTC](https://discuss.elastic.co/t/filebeat-template-creation-error/177222/1 "2019-04-17T07:56:58Z")

</div>

Hi,  
I'm testing filebeat 6.7.1 and am testing creation of custom template and index names. My config looks like this:

```auto
setup.template:
  enabled: true
  name: "beats-logs-%{[agent.version]}"
  pattern: "beats-logs-*"
  fields: "/etc/filebeat/fields.yml"
  overwrite: false
  settings:
    index.number_of_shards: 3
    index.number_of_replicas: 1
    index.codec: best_compression
    _source.enabled: false
setup.kibana:
output.elasticsearch:
  hosts: ["localhost:9200"]
  index: "beats-logs-%{[agent.version]}-%{+yyyy.MM.dd}"

```

Filebeat starts but throws the following error:

```auto
019-04-17T07:15:51.183Z ERROR pipeline/output.go:100 Failed to connect to backoff(elasticsearch(http://localhost:9200)): Connection marked as failed because the onConnect callback failed: Error loading Elasticsearch template: error creating template instance: key not found
2019-04-17T07:15:51.183Z INFO pipeline/output.go:93 Attempting to reconnect to backoff(elasticsearch(http://localhost:9200)) with 3 reconnect attempt(s)

```

What am I doing wrong here?

Regards,  
D

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [April 17, 2019, 4:33pm UTC](https://discuss.elastic.co/t/filebeat-template-creation-error/177222/2 "2019-04-17T16:33:24Z")

</div>

> [@dawiro](#):
>
> %{[agent.version]}

This is supported starting 7.0.0. For 6.x, use `%{[beat.version]}` instead.

---

<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:** [May 15, 2019, 6:33pm UTC](https://discuss.elastic.co/t/filebeat-template-creation-error/177222/3 "2019-05-15T18:33:25Z")

</div>

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