Hi, please consider this example.csv:
device result _time
apollo1 passed 2019-06-28
apollo1 failed 2019-06-28
zeus8 passed 2019-06-23
zeus8 failed 2019-06-23
zeus8 error 2019-06-23
hermes3 failed 2019-06-23 //Edit #1
hermes3 failed 2019-06-23 //Edit #1
apollo1 passed 2019-06-20 //Edit #1
Note: This is just an example. My real CSV has thousands of devices.
I want to return the latest entry based on the device value. When a device appears more than once with a duplicated timestamp and different result value, the event where result = passed should appear. Else, show the event where result is failed or error. What query do I need to do that?
My current query ( |inputlookup example.csv |stats latest by device ) does not guarantee the event where result = passed will appear when a device shows up multiple times with with the same latest timestamp and different result values.
//Edit #1 below
The query I need would produce the table below:
device result _time
apollo1 passed 2019-06-28
zeus8 passed 2019-06-23
hermes3 failed 2019-06-23
The query would 1) show only the latest device with the latest _time , 2) if a device is listed twice with the same _time and a different result , show just the device where result = passed. Else display the event with either failed or error, and 3) since conditions 1 and 2 are followed, each device should only appear once.
... View more