# Configure metadata sent to logstash

**URL:** https://discuss.elastic.co/t/configure-metadata-sent-to-logstash/96461
**Category:** Beats
**Tags:** beats-development
**Created:** [August 9, 2017, 2:48pm UTC](https://discuss.elastic.co/t/configure-metadata-sent-to-logstash/96461 "2017-08-09T14:48:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jmegin](https://avatars.discourse-cdn.com/v4/letter/j/e79b87/32.png) [@jmegin](https://discuss.elastic.co/u/jmegin)
#### Post date: [August 9, 2017, 2:48pm UTC](https://discuss.elastic.co/t/configure-metadata-sent-to-logstash/96461/1 "2017-08-09T14:48:48Z")

</div>

I am writing a custom beat that will be sending messages to logstash. I would like to be able to add additional fields to the @metadata object received by logstash. Is this possible? I am currently using libbeat v 5.5.

I followed the developer guide to create a new beat, and attempted adding the following code to what was generated in order to try to set additional fields in the @metadata object:

```
event := common.MapStr{
	"@timestamp": common.Time(time.Now()),
	"type": b.Name,
	"counter": counter,
}
eventMeta := common.MapStr{
	"index": "test",
	"otherData": "1234",
}
metaOp := publisher.Metadata(eventMeta)
bt.client.PublishEvent(event, metaOp)

```

Unfortunately, this did not work, and the @metadata object in logstash is still  
`{"beat":"testbeat","type":"testbeat"}`

Any help would be greatly appreciated.

Thanks,  
James

---

<div class="post-metadata">

### Author: ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)
#### Post date: [August 10, 2017, 12:20pm UTC](https://discuss.elastic.co/t/configure-metadata-sent-to-logstash/96461/2 "2017-08-10T12:20:56Z")

</div>

In 5.x branch this is currently not possible. You can add another field to your event and do some event manipulation in logstash to get a similar result.

In master and 6.x branch the publisher pipeline has been refactored and the event type has become:

```auto
type Event struct {
  Timestamp time.Time
  Meta common.MapStr
  Fields common.MapStr
}

```

Whatever you put into `Meta` will be send/used by the outputs. e.g. adding `event.Meta["pipeline"]` selects the ingest node pipeline if the Elasticsearch output is used. All other outputs (file, console, kafka, redis, logstash) will put fields in `Meta` into the `@metadata` field when encoding to json.

Please note, 6.0 just entered the beta-phase and we haven't had time to update the developer docs, as there might be some more internal changes/cleanups before 6.0 GA, potentially affecting 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: [September 7, 2017, 12:20pm UTC](https://discuss.elastic.co/t/configure-metadata-sent-to-logstash/96461/3 "2017-09-07T12:20:57Z")

</div>

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