Hi everyone,
How can I check if one query in my home.html page, created using the splunk framework, has produced results or not?
I would like do something like:
results_query=something
If results_query>0
print results
else
print "there are no results"
As this looks to be standard SQL, or SPL.
You should be able to use numrows or you could use stats count to define a field, and use an if on that field.
Try this:
| stats count | eval msg="No logs!" | table msg
Credit to @hexx from his answer here;
http://answers.splunk.com/answers/50379/table-message-when-no-results-found.html
Thank you for your reply, how can I use numrows to save the number of line and use the value for an if condition?
Is this SQL, or SPL?
SPL, yes in all in one html page
and is this all part of one page? If so you can use the if statement inside an eval in your search