I have a following query:
index=main source=mylogsource.log "Response Message:*" "234998102"
| ifnoresults ---> (eval message | show message), if there are results --> continue applying the next commands
| eval number = 234998102
| rex field=_raw "(?:<balance couponType=\"Customer\">)(?P<customerCoupons>\d+)(?:</balance>)"
| rex field=_raw "(?:<balance couponType=\"Companion\">)(?P<companionCoupons>\d+)(?:</balance>)"
| rex field=_raw "(?:<balance couponType=\"Both\">)(?P<bothCoupons>\d+)(?:</balance>)"
| table number, trkid, customerCoupons, companionCoupons, bothCoupons
My idea is show a message if the base search doesn't have results or continue with the commands pipe if there are results.
It is possible achieve this?
I've never tried it in the middle of a search before, i've always tacked it onto the end if there were no results, but this is my method for that:
| appendpipe [ stats count | eval message="There is no data for this time period." | where count==0 |table message]
Let me know if that works in the middle of your search or what happens if it doesn't.