One potential option is to dedup by host, and keep 2 events per host. These should be the most recent event. Once you have those, you can use earliest/latest against the state, and then search to find the hosts that changed from active to standby:
| makeresults
| append [| makeresults | eval _time=1002, host="A", state="standby"]
| append [| makeresults | eval _time=1001, host="B", state="active"]
| append [| makeresults | eval _time=1000, host="A", state="active"]
| append [| makeresults | eval _time=999, host="B", state="active"]
| append [| makeresults | eval _time=998, host="A", state="standby"]
| append [| makeresults | eval _time=997, host="A", state="active"]
| append [| makeresults | eval _time=996, host="A", state="active"]
| append [| makeresults | eval _time=995, host="B", state="standby"]
| append [| makeresults | eval _time=994, host="B", state="standby"]
| dedup 2 host
| stats earliest(state) AS earliest_state, latest(state) AS latest_state BY host
| search earliest_state=active latest_state=standby
... View more