# Exporting Only Part of a Message

**URL:** <https://discuss.elastic.co/t/exporting-only-part-of-a-message/165150>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [January 22, 2019, 5:24am UTC](https://discuss.elastic.co/t/exporting-only-part-of-a-message/165150 "2019-01-22T05:24:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![seth.yes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seth.yes/32/11788_2.png) [@seth.yes](https://discuss.elastic.co/u/seth.yes)\
**Post date:** [January 22, 2019, 5:24am UTC](https://discuss.elastic.co/t/exporting-only-part-of-a-message/165150/1 "2019-01-22T05:24:35Z")

</div>

I am looking to use Filebeat 6.5 to only export only the json of a log message. Current unrelated issues disallow me from modifying the way the raw message is formatted, nor the way the data is processed or indexed once off a host. For the following example code, I'd like Filebeat to only export the json -- if it's easier, the payload could be considered anything after the `:` before the json.

```auto
Jan 19 21:02:39 testbox1-aws my-service[94636]: {"level":"info","ts":1547931759.8724036,"caller":"agent/runner.go:172","message":"my message and other keys may be stored in this hash","service_name":"my-service","zone":"my-zone"}

```

Therefore my message to be sent to Logstash/Elasticsearch would be:

```auto
{"level":"info","ts":1547931759.8724036,"caller":"agent/runner.go:172","message":"my message and other keys may be stored in this hash","service_name":"my-service","zone":"my-zone"}

```

Does Filebeat support this? I have been looking at [decode\_json\_fields](https://www.elastic.co/guide/en/beats/filebeat/current/decode-json-fields.html), however that appears to expect the entire payload to be json..

---

<div class="post-metadata">

**Author:** ![Magnus\_Kessler](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnus_kessler/32/42001_2.png) [@Magnus\_Kessler](https://discuss.elastic.co/u/Magnus_Kessler)\
**Post date:** [January 22, 2019, 1:39pm UTC](https://discuss.elastic.co/t/exporting-only-part-of-a-message/165150/2 "2019-01-22T13:39:55Z")

</div>

Your best option here is to extract the message inside a logstash (grok) filter, and then use the JSON part with the [json filter plugin](https://www.elastic.co/guide/en/logstash/current/plugins-filters-json.html). If you don't want to use Logstash, the same can be achieved with Elasticsearch [ingest processors](https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest-processors.html), too.

---

<div class="post-metadata">

**Author:** ![seth.yes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seth.yes/32/11788_2.png) [@seth.yes](https://discuss.elastic.co/u/seth.yes)\
**Post date:** [January 22, 2019, 3:50pm UTC](https://discuss.elastic.co/t/exporting-only-part-of-a-message/165150/3 "2019-01-22T15:50:00Z")

</div>

Yeah, I don't currently have access to any of the downstream processing, thus why I was hoping to process the message on the host machine prior to exporting. Thanks for the suggestion!

---

<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:** [February 19, 2019, 3:50pm UTC](https://discuss.elastic.co/t/exporting-only-part-of-a-message/165150/4 "2019-02-19T15:50:00Z")

</div>

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