index=ios host=1.1.0.2 src_ip="1.2.2.1" "NBRCHANGE"
| head 1
| eval status = if(like(_raw, "%down%"), 1 , 0)
| stats count
| eval status=if(count==0, "up", status)
| table status
This seems to be a simple query but for some reason it really does not like me.
I am wanting to return a default value of "up" if there is no results found.
Long Explanation:
I am creating a dashboard that will tell us if an interface on a router is down. Since our Index is large and is no position to be adjusted I am only checking for changes in the log over the last 30 days. At the end of the 30 days the dashboard will produce "No results found" because there has been no events in the last 30 days that matches the search. Because of this I want to setup a default value that will return.
I have tried:
fillnull
| eval noResults = if(searchmatch("NBRCHANGE"),1,0)
| stats count as myCount sum(noResults) AS noResults
| eval noResults=if(myCount=="0",0,noResults)
| eval status = case(noResults=="0", "first result returned", noResults!="0", if(like(_raw, "%down%"), "second result returned", "third result returned"))
| table status
... View more