# How to write the condition for logstash conf with multiple Indice

**URL:** <https://discuss.elastic.co/t/how-to-write-the-condition-for-logstash-conf-with-multiple-indice/162540>\
**Category:** Logstash\
**Created:** [December 31, 2018, 9:52pm UTC](https://discuss.elastic.co/t/how-to-write-the-condition-for-logstash-conf-with-multiple-indice/162540 "2018-12-31T21:52:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thang\_Cong\_Tu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thang_cong_tu/32/39308_2.png) [@Thang\_Cong\_Tu](https://discuss.elastic.co/u/Thang_Cong_Tu)\
**Post date:** [December 31, 2018, 9:52pm UTC](https://discuss.elastic.co/t/how-to-write-the-condition-for-logstash-conf-with-multiple-indice/162540/1 "2018-12-31T21:52:25Z")

</div>

Hello everyone,

I would like creating 2 separate indices to receive logs from 2 linux servers through nput beat port 5044 . My logstash config file is :

input {  
beats{  
port =\> 5044  
}  
}

output {  
if [beat.name] == "tsttlnoss0001"{  
elasticsearch {  
hosts =\> ["localhost:9200"]  
index =\> "filebeats"  
}  
}  
else if [beat.name] == "stgtlnoss0008"{  
elasticsearch {  
hosts =\> ["localhost:9200"]  
index =\> "node08"  
}  
}  
}

If I do not use the condition, I can get the log from 2 servers but the same indices , it's hard for me to monitoring the log. So could you please help to create the logstash file corresponding the request above (2 indices for 2 linux servers )

---

<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:** [January 28, 2019, 9:52pm UTC](https://discuss.elastic.co/t/how-to-write-the-condition-for-logstash-conf-with-multiple-indice/162540/2 "2019-01-28T21:52:25Z")

</div>

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