Hi @chengka ,
You could also try the following:
index=stats (sourcetype=services History Service) OR (sourcetype=logs_sl "org.apache.coyote.AbstractProtocol start")
| eval restart = if(sourcetype==logs_sl, 1, 0)
| stats max(restart) as restart count
| where (restart==0) AND (count < 40)
Each event will be assigned a restart value of 0, unless it's the logs_sl sourcetype that matches the restart string, which will then get assigned a restart value of 1. Then stats will find the highest value of restart, which should always be 0 unless there's a restart, in which case it's 1. Finally the where statement only shows results of there is no restart and the count is less than 40.
... View more