# Recommended way of telling Logstash type of logs

**URL:** <https://discuss.elastic.co/t/recommended-way-of-telling-logstash-type-of-logs/115004>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [January 11, 2018, 5:43am UTC](https://discuss.elastic.co/t/recommended-way-of-telling-logstash-type-of-logs/115004 "2018-01-11T05:43:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joshuaspence](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshuaspence/32/10939_2.png) [@joshuaspence](https://discuss.elastic.co/u/joshuaspence)\
**Post date:** [January 11, 2018, 5:43am UTC](https://discuss.elastic.co/t/recommended-way-of-telling-logstash-type-of-logs/115004/1 "2018-01-11T05:43:47Z")

</div>

In Filebeat 6 the `document_type` field was removed. However, all of the examples that I can find for parsing logs with Logstash rely on the `type` field being set (which was determined by the `document_type` setting on the Filebeat prospector. For example, [[SOLVED] Filebeat to Logstash best practice](https://discuss.elastic.co/t/solved-filebeat-to-logstash-best-practice/89728/3) show does this:

```auto
filter {
  if [type] == "nginx-access" {
    # ...
  }
}

```

Some other resources (such as [Document\_type deprecated?](https://discuss.elastic.co/t/document-type-deprecated/96441/2)) suggest add a custom field to the `fields` configuration on the Filebeat prospector, but this seems a little bit incovenient because it means that either I have to use `[fields][type]` in my Logstash configuration (which is fine I guess, but `[type]` felt much cleaner) or I need to remember to set `fields_under_root` on all of the Filebeat prospectors.

---

<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:** [January 11, 2018, 1:12pm UTC](https://discuss.elastic.co/t/recommended-way-of-telling-logstash-type-of-logs/115004/2 "2018-01-11T13:12:08Z")

</div>

There is no direct replacement for `document_type`. With removal of `document_type` you have to use `fields` + `fields_under_root` or use tge `tags` settting. Using tags you condition in Logstash becomes:

```auto
filter {
  if "nginx-access" in [tags] {
  }
}

```

---

<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 8, 2018, 1:12pm UTC](https://discuss.elastic.co/t/recommended-way-of-telling-logstash-type-of-logs/115004/3 "2018-02-08T13:12:29Z")

</div>

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