# How to get additional information added by filebeat in the output of logstash

**URL:** <https://discuss.elastic.co/t/how-to-get-additional-information-added-by-filebeat-in-the-output-of-logstash/250903>\
**Category:** Logstash\
**Created:** [October 4, 2020, 3:42pm UTC](https://discuss.elastic.co/t/how-to-get-additional-information-added-by-filebeat-in-the-output-of-logstash/250903 "2020-10-04T15:42:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![linhonghui](https://avatars.discourse-cdn.com/v4/letter/l/7c8e57/32.png) [@linhonghui](https://discuss.elastic.co/u/linhonghui)\
**Post date:** [October 4, 2020, 3:42pm UTC](https://discuss.elastic.co/t/how-to-get-additional-information-added-by-filebeat-in-the-output-of-logstash/250903/1 "2020-10-04T15:42:03Z")

</div>

Hi  
I added additional information by fields option in filebeat configuration to identify application name, 'app\_id', such as,

```auto
filebeat.inputs:
- type: log
  enabled: true
  fields:
    app_id: crawler_164
......
output.logstash:
  hosts: ["10.0.0.164:5044"]

```

And it can be found from the log of logstash such as,

```auto
......
        "fields" => {
        "app_id" => "crawler_164"
.......

```

Then how to use this parameter in the output of logstash to assemble special output value.  
In my case, I use a http output,

```auto
output {
    stdout { codec => rubydebug }
    http {
      url => "https://oapi.dingtalk.com/robot/send?access_token=......"
      http_method => "post"
      content_type => "application/json; charset=utf-8"
      format => "message"
      message => '{"msgtype":"text","text":{"content":"Alarm from %{app_id}：%{message}"}}'
    }
}

```

%{message} can be parsed correctly and %{app\_id} is not. So how to use this parameter?  
Thank you!

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [October 4, 2020, 4:46pm UTC](https://discuss.elastic.co/t/how-to-get-additional-information-added-by-filebeat-in-the-output-of-logstash/250903/2 "2020-10-04T16:46:03Z")

</div>

Filebeat per default will add the custom fields as a nested field of `fields`, so in your case, the field `add_id` will be added as `{ "fields": { "app_id": value } }`, which is what you get in your logstash output.

To access this field in logstash you should use `%{[fields][app_id]}`.

If you want to change the default behavior you need to set the option [`fields_under_root`](https://www.elastic.co/guide/en/beats/filebeat/current/configuration-general-options.html#_fields_under_root) in your `filebeat.yml` input to `true`.

This way the field `add_id` will be added to the root of the document and can be accessed as `%{app_id}`.

---

<div class="post-metadata">

**Author:** ![linhonghui](https://avatars.discourse-cdn.com/v4/letter/l/7c8e57/32.png) [@linhonghui](https://discuss.elastic.co/u/linhonghui)\
**Post date:** [October 5, 2020, 12:54am UTC](https://discuss.elastic.co/t/how-to-get-additional-information-added-by-filebeat-in-the-output-of-logstash/250903/3 "2020-10-05T00:54:30Z")

</div>

Yes. It works correctly. Thank you!

---

<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:** [November 2, 2020, 12:54am UTC](https://discuss.elastic.co/t/how-to-get-additional-information-added-by-filebeat-in-the-output-of-logstash/250903/4 "2020-11-02T00:54:36Z")

</div>

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