# Logstash's - Beat to Elasticsearch Configuration - metadata

**URL:** https://discuss.elastic.co/t/logstashs-beat-to-elasticsearch-configuration-metadata/121362
**Category:** Beats
**Created:** [February 25, 2018, 5:07am UTC](https://discuss.elastic.co/t/logstashs-beat-to-elasticsearch-configuration-metadata/121362 "2018-02-25T05:07:02Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)
#### Post date: [February 25, 2018, 5:07am UTC](https://discuss.elastic.co/t/logstashs-beat-to-elasticsearch-configuration-metadata/121362/1 "2018-02-25T05:07:02Z")

</div>

I'm trying to follow [Beats input plugin | Logstash Reference [6.2] | Elastic](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-beats.html#_description)

logstash's (input/output):

```
# cat pipeline/10-input-beats.conf 
input {
	beats {
		port => 5044
	}
}
# 
# cat pipeline/30-output-elasticsearch.conf | grep -v password
output {
	if [container_id] {
		elasticsearch {
			hosts => "elasticsearch:9200"
			user => "elastic"
		}
	} else {
		elasticsearch {
			hosts => "elasticsearch:9200"
			user => "elastic"
			manage_template => false
			index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
			document_type => "%{[@metadata][type]}"
		}
	}
}
# 

```

* * *

elasticsearch's log:

```
esm1 | [2018-02-25T02:40:04,197][INFO][o.e.c.m.MetaDataCreateIndexService] [esm1] [%{[@metadata][beat]}-%{[@metadata][version]}-2018.02.25] creating index, cause [auto(bulk api)], templates [], shards [5]/[1], mappings []
esm1 | [2018-02-25T02:40:04,895][INFO][o.e.c.m.MetaDataMappingService] [esm1] [%{[@metadata][beat]}-%{[@metadata][version]}-2018.02.25/AlutbrA8TOyG-rsfgzy5uw] create_mapping [%{[@metadata][type]}]
esm1 | [2018-02-25T02:40:05,236][INFO][o.e.c.m.MetaDataMappingService] [esm1] [%{[@metadata][beat]}-%{[@metadata][version]}-2018.02.25/AlutbrA8TOyG-rsfgzy5uw] update_mapping [%{[@metadata][type]}]

```

elasticsearch's index with bogus name:

```
# curl --silent --request GET $ELASTICSEARCH_URI/_cat/indices | grep metadata
green open %{[@metadata][beat]}-%{[@metadata][version]}-2018.02.25 AlutbrA8TOyG-rsfgzy5uw 5 1 4 0 117.2kb 58.6kb
# 

```

Why isn't `%{[@metadata][beat]}` and/or `%{[@metadata][version]}` isn't being translated to actual values?

Please advise.

---

<div class="post-metadata">

### Author: ![rcowart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rcowart/32/88091_2.png) [@rcowart](https://discuss.elastic.co/u/rcowart)
#### Post date: [February 25, 2018, 6:36am UTC](https://discuss.elastic.co/t/logstashs-beat-to-elasticsearch-configuration-metadata/121362/2 "2018-02-25T06:36:16Z")

</div>

In the beat's configuration I set `name` to the name of the beat (metricbeat, filebeat, etc). You would then want to use `beat.version` insead of metadata fields. So you would have...

```auto
index => "%{[beat][name]}-%{[beat][version]}-%{+YYYY.MM.dd}"

```

Remove the `document _type` bit. That will cause you problems in 6.x.

---

<div class="post-metadata">

### Author: ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)
#### Post date: [February 25, 2018, 4:07pm UTC](https://discuss.elastic.co/t/logstashs-beat-to-elasticsearch-configuration-metadata/121362/3 "2018-02-25T16:07:44Z")

</div>

if `logstash` _supposedly_ can do it on the fly, why change beat configuration?

---

<div class="post-metadata">

### Author: ![rcowart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rcowart/32/88091_2.png) [@rcowart](https://discuss.elastic.co/u/rcowart)
#### Post date: [February 26, 2018, 6:41am UTC](https://discuss.elastic.co/t/logstashs-beat-to-elasticsearch-configuration-metadata/121362/4 "2018-02-26T06:41:33Z")

</div>

@alexus I am just telling you how I do it, which works. I can't speak to any inaccuracies in the docs.

---

<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 26, 2018, 8:41am UTC](https://discuss.elastic.co/t/logstashs-beat-to-elasticsearch-configuration-metadata/121362/5 "2018-03-26T08:41:34Z")

</div>

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