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!

Prove Your Splunk Prowess at .conf25—No Prereqs Required!

Your Next Big Security Credential: No Prerequisites Needed We know you’ve got the skills, and now, earning the ...

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

This is the sixth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Splunk Answers Content Calendar, July Edition I

Hello Community! Welcome to another month of Community Content Calendar series! For the month of July, we will ...