# Kibana: put if condition to graphs

**URL:** <https://discuss.elastic.co/t/kibana-put-if-condition-to-graphs/166056>\
**Category:** Kibana\
**Created:** [January 28, 2019, 10:19pm UTC](https://discuss.elastic.co/t/kibana-put-if-condition-to-graphs/166056 "2019-01-28T22:19:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zuzka](https://avatars.discourse-cdn.com/v4/letter/z/43a26b/32.png) [@zuzka](https://discuss.elastic.co/u/zuzka)\
**Post date:** [January 28, 2019, 10:19pm UTC](https://discuss.elastic.co/t/kibana-put-if-condition-to-graphs/166056/1 "2019-01-28T22:19:11Z")

</div>

Hi,  
i have logs coming to Kibana looking like this:  
runID: abc1  
name: test1  
result: pass  
runID: abc1  
name: test2  
result: fail

So i have few tests under one run. I need to set a status of FAIL/PASS to each run as a whole. So if there is at least one result "fail" I need to set a whole run as FAIL. only if all the tests within one run are passed, then the result is supposed to be passed.  
I cannot use just ordering by @timestamp as the last test is pass, but there is also a fail test in the test run.

Could you please help? Thanks a lot.

---

<div class="post-metadata">

**Author:** ![Sjaak01](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@Sjaak01](https://discuss.elastic.co/u/Sjaak01)\
**Post date:** [January 29, 2019, 8:00am UTC](https://discuss.elastic.co/t/kibana-put-if-condition-to-graphs/166056/2 "2019-01-29T08:00:26Z")

</div>

You can simply click "add filter" (top left of the interface) then select result as the field, select if conditional and fail as value.

Or type result:fail in the query bar. Both can be saved with a visualization.

That way your visualization will only show runID's that failed.

---

<div class="post-metadata">

**Author:** ![zuzka](https://avatars.discourse-cdn.com/v4/letter/z/43a26b/32.png) [@zuzka](https://discuss.elastic.co/u/zuzka)\
**Post date:** [January 29, 2019, 9:01am UTC](https://discuss.elastic.co/t/kibana-put-if-condition-to-graphs/166056/3 "2019-01-29T09:01:30Z")

</div>

Thank you. But i never know the runID value. I can look it up in logs, but I need it to work automatically. i always need to display results for the last runID package, and need to filter just these tests. I dont know, in advance, how the runID string will look like. It is a "random" string of maybe 50 characters.  
There are maybe 50 runs each day, and always need values for the last run only. And it must work automatically.

Or maybe I just did not understand you correctly

---

<div class="post-metadata">

**Author:** ![le\_walt](https://avatars.discourse-cdn.com/v4/letter/l/ba9def/32.png) [@le\_walt](https://discuss.elastic.co/u/le_walt)\
**Post date:** [January 30, 2019, 2:31pm UTC](https://discuss.elastic.co/t/kibana-put-if-condition-to-graphs/166056/4 "2019-01-30T14:31:42Z")

</div>

Hey @zuzka

Try filtering/creating a Max (last known) metric that allows to only see last data from a field

---

<div class="post-metadata">

**Author:** ![zuzka](https://avatars.discourse-cdn.com/v4/letter/z/43a26b/32.png) [@zuzka](https://discuss.elastic.co/u/zuzka)\
**Post date:** [January 30, 2019, 6:03pm UTC](https://discuss.elastic.co/t/kibana-put-if-condition-to-graphs/166056/5 "2019-01-30T18:03:58Z")

</div>

Thank you. My field is not available for "Max" metrics. It is a string and cannot be recognized via "Max".

---

<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 27, 2019, 6:04pm UTC](https://discuss.elastic.co/t/kibana-put-if-condition-to-graphs/166056/6 "2019-02-27T18:04:09Z")

</div>

Closed on February 27, 2019, 6:04pm UTC

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