Splunk Search

Query for Results count making performance worse

pasokkum
Path Finder

In the view, we have one table. We want to know the total results found for that particular search. So we used one more search on button click with the same query to get the count of the results using stats command and displaying it in a label using html javascript. Since 2 queries are running on the same time on click of search button, the performance is worse.
Is there any way to get the count of the results without using any queries?

Tags (1)
0 Karma
1 Solution

gfuente
Motivator

Hello

You can use this token: $job.resultCount$: Number of results a search job returned.

That contains the value you need. So from the main search (only one) you get both things. Then you can use the token to display it the panel title for example

Review this:
http://docs.splunk.com/Documentation/Splunk/6.4.2/Viz/tokens

Regards

View solution in original post

gfuente
Motivator

Hello

You can use this token: $job.resultCount$: Number of results a search job returned.

That contains the value you need. So from the main search (only one) you get both things. Then you can use the token to display it the panel title for example

Review this:
http://docs.splunk.com/Documentation/Splunk/6.4.2/Viz/tokens

Regards

pasokkum
Path Finder

Thanks gfuente.. We are using html code.. How to use resultCount parameter in html?

0 Karma

pasokkum
Path Finder

Thanks!! It helped..

search1.on('search:done', function(properties){
var resultscount=properties.content.resultCount;
document.getElementById('count').innerHTML=resultscount;
});

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...