Splunk Search

Pass arguments from one search to another

atanasmitev
Path Finder

Hello guys,

I am trying to perform simple search, but with no success right now.
Here's my sample search, just changed the name of the columns for the sake of security:

1)index=myindex source="where_we_search.log" "URL Query" | stats count by IP_Address | search count >20
Now, 1) produces output of the type:

IP_Address Count
1.1.1.1 30
2.2.2.2 40

What I want to achieve is, for every IP in IP_Address column, search for count of Field2 (existing), like so, not working :
2)index=myindex source="where_we_search.log" "URL Query" | stats count by IP_Address | search count >20 | rename IP_Address as IPA | stats count(IPA) by "Field2"

IF I split the search in two, it passes, but I want to automate.

Help ?

Tags (2)
0 Karma

somesoni2
Revered Legend

Why not like this...

index=myindex source="where_we_search.log" "URL Query" field2=* | stats count by IP_Address, field2 | eventstats sum(count) as Total by IP_Address | search Total >20 
0 Karma

atanasmitev
Path Finder

Hello all,
After a couple of hours of searching, google provided the best idea.
Now here's the result:

index=myindex source="where_we_search.log" "URL Query" field2=* | stats count by IP_Address| search count > 20 | map maxsearches=5 search="index=myindex source="where_we_search.log" IP_Address=$IP_Address$ | stats count by field2 "

Thanks for your time. Now I need to figure how to output the results of the two searches into a table/csv.

Kind regards,

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...