Splunk Search

How do I get this stats count search result from the REST API?

Tolstopyz
New Member

Hi all!

In the search box I wrote:

source="AzureQueueToServiceBusRouter and Portal events" (FormSignInFailedMessage OR SignInSuccessfulMessage OR FormSignInSuccessfulMessage OR SignInFailedMessage) | stats count by IpAddress | SEARCH count >5

In response, I get a table with statistics on the ip.

But, I need to perform all of these actions through the API to receive an answer in the form of JSON or XML.

I can start job for search:

curl.exe  https:/127.0.0.1:8089/services/search/jobs -d search="search FormSignInFailedMessage OR SignInSuccessfulMessage OR FormSignInSuccessfulMessage OR SignInFailedMessage"  -d "earliest_time=-15m" -d "latest=rt"

but how to perform stats count by IpAddress | SEARCH count >5 I don't now.

0 Karma

lukasz92
Communicator

The same way. I tried to do it with similar query and it works.

Try something like that:

curl.exe https://127.0.0.1:8089/services/search/jobs -d search="search FormSignInFailedMessage OR SignInSuccessfulMessage OR FormSignInSuccessfulMessage OR SignInFailedMessage | stats count by IpAddress | search count>5" -d "earliest_time=-15m" -d "latest=rt"

0 Karma

Tolstopyz
New Member

Unfortunately after such a request through API:

https://127.0.0.1:8089/services/search/jobs -d search="search FormSignInFailedMessage OR SignInSuccessfulMessage OR FormSignInSuccessfulMessage OR SignInFailedMessage | stats count by IpAddress | search count>5" -d "earliest_time=-15m" -d "latest=rt"

I get 0 results

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...