# And operator in logstash output

**URL:** <https://discuss.elastic.co/t/and-operator-in-logstash-output/125822>\
**Category:** Logstash\
**Created:** [March 27, 2018, 9:01pm UTC](https://discuss.elastic.co/t/and-operator-in-logstash-output/125822 "2018-03-27T21:01:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael1/32/29279_2.png) [@Michael1](https://discuss.elastic.co/u/Michael1)\
**Post date:** [March 27, 2018, 9:01pm UTC](https://discuss.elastic.co/t/and-operator-in-logstash-output/125822/1 "2018-03-27T21:01:49Z")

</div>

I am sending JSON logs to logstash. Amongst the fields, there are two I am looking for -

[records][LogicalServerName]  
[records][category]

I wrote an output like such -

else if [records][LogicalServerName] == "servername" and [records][category] == "DatabaseWaitStatistics"  
{  
elasticsearch {  
hosts =\> ["http://my\_elastic\_ip:my\_elastic\_port"]  
index =\> "myindex-dbwaitstatistics-%{+YYYY.MM.dd}"  
user =\> "user"  
password =\> "pass"  
}  
}

I am seeing the logs get sent to logstash successfully, but in Kibana, I keep trying to create the index, but it doesn't appear there is one. I verified the fields and triple checked. Also, the function to send the logs is working for another index, but I did not try the 'and' operator with that.

What could be the issue?

---

<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:** [March 28, 2018, 2:04pm UTC](https://discuss.elastic.co/t/and-operator-in-logstash-output/125822/2 "2018-03-28T14:04:34Z")

</div>

And what does an example document look like? Use a `stdout { codec => rubydebug }` output.

---

<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:** [April 25, 2018, 2:04pm UTC](https://discuss.elastic.co/t/and-operator-in-logstash-output/125822/3 "2018-04-25T14:04:57Z")

</div>

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