# Logstash File Input not setting 'type'

**URL:** <https://discuss.elastic.co/t/logstash-file-input-not-setting-type/29237>\
**Category:** Logstash\
**Created:** [September 14, 2015, 10:28am UTC](https://discuss.elastic.co/t/logstash-file-input-not-setting-type/29237 "2015-09-14T10:28:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luke\_Anderson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luke_anderson/32/4772_2.png) [@Luke\_Anderson](https://discuss.elastic.co/u/Luke_Anderson)\
**Post date:** [September 14, 2015, 10:28am UTC](https://discuss.elastic.co/t/logstash-file-input-not-setting-type/29237/1 "2015-09-14T10:28:04Z")

</div>

Hi,

I am using a file input filter in logstash, and setting the 'type' to a custom value, however when logs are sent to elasticsearch the type is displaying as "logs" and not the value that I am setting.

This in turn is breaking my filter plugin as I am running grok filters based on the 'type' value (within IF statements). For example, my file input plugin would look like:

```
input {
  file {
    type => "my-log"
    add_field => {
        "program" => "my-program"
        "server" => "my-server"
    }
   path => ["/usr/local/etc/logstash/my-file.log"]
   start_position => "beginning"
   sincedb_path => "/tmp/sincedb_ls"
   codec => multiline {
      pattern => "^\["
      what => "previous"
      negate => true
    }
  }
}

```

I set type =\> "my-log" in my file input, however this is not being saved. Instead I get a type of "logs" in Elasticsearch (excerpt taken from Marvel Sense \_search API):

```
{
        "_index": "logstash-my-server-2015.09.14",
        "_type": "logs",
        "_id": "AU_LV8iKTwurq_6KlASy",
        "_score": null,
        "_source": {
           "message": 

```

etc etc......

Has anyone had similar issues?

Thanks  
Luke

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 15, 2015, 9:54pm UTC](https://discuss.elastic.co/t/logstash-file-input-not-setting-type/29237/2 "2015-09-15T21:54:22Z")

</div>

That's because you need to set `document_type` in the ES output.  
You can set that to whatever you want, including `%{type}` if you want it to be dynamic.

---

<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:** [July 6, 2017, 5:29am UTC](https://discuss.elastic.co/t/logstash-file-input-not-setting-type/29237/3 "2017-07-06T05:29:03Z")

</div>


