# How to put my logs in different types document?

**URL:** <https://discuss.elastic.co/t/how-to-put-my-logs-in-different-types-document/24774>\
**Category:** Logstash\
**Created:** [July 2, 2015, 9:07am UTC](https://discuss.elastic.co/t/how-to-put-my-logs-in-different-types-document/24774 "2015-07-02T09:07:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Smasell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smasell/32/43483_2.png) [@Smasell](https://discuss.elastic.co/u/Smasell)\
**Post date:** [July 2, 2015, 9:07am UTC](https://discuss.elastic.co/t/how-to-put-my-logs-in-different-types-document/24774/1 "2015-07-02T09:07:31Z")

</div>

Hi everybody!!!  
I have my output in config file:  
elasticsearch {  
host =\> "[myServer.com](http://myServer.com)"  
port =\> 9200  
index =\> "events”  
protocol =\> "http"  
}  
and I want to direct all logs with message "Logged in" and "Logged out" in "events\_logs" type document, and all the remaining documents in "rest\_logs".  
In the result I want 2 different types in my index:  
/myServer.com/events/events\_logs  
/myServer.com/events/rest\_logs  
How can I do this?  
THX to all!!!

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [July 2, 2015, 11:54am UTC](https://discuss.elastic.co/t/how-to-put-my-logs-in-different-types-document/24774/2 "2015-07-02T11:54:50Z")

</div>

Use a mutate filter to change the `type` field for the messages that should have a different type.

```
filter {
  if [message] =~ /Logged (in|out)/ {
    mutate {
      replace => ["type", "events_logs"]
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![Smasell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smasell/32/43483_2.png) [@Smasell](https://discuss.elastic.co/u/Smasell)\
**Post date:** [July 2, 2015, 12:08pm UTC](https://discuss.elastic.co/t/how-to-put-my-logs-in-different-types-document/24774/3 "2015-07-02T12:08:16Z")

</div>

@magnusbaeck  
Thanks I'll try it)

---

<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:35am UTC](https://discuss.elastic.co/t/how-to-put-my-logs-in-different-types-document/24774/4 "2017-07-06T05:35:45Z")

</div>


