Splunk Search

I want to extract the same result from stats.

noott211
Path Finder

I want to see the result values of Src_ip and dst_ip are the same and "ok" and the number of these result values. What should I do? The code I made doesn't work well.



index="my_index"
|eval cheack=if(html_code==200,"error","OK")
|stats list(src_ip) as src_ip list(dst_ip) as dst_ip by cheack
|table src_ip , dst_ip , cheack , count

 

Labels (4)
0 Karma
1 Solution

ashvinpandey
Contributor

@noott211 Try using the below queries:
Query1:

 

index="my_index"
|eval check=if(html_code==200,"error","OK")
|stats values(check) as check by src_ip dst_ip
|table src_ip , dst_ip , check , count

 

Query2:

 

index="my_index"
|eval check=if(html_code==200,"error","OK")
|stats values(src_ip) as src_ip values(dst_ip) as dst_ip by check 
|table src_ip , dst_ip , check , count

 


If this reply helped you an upvote would be appreciated, thank you.

View solution in original post

Tags (1)

ashvinpandey
Contributor

@noott211 Try using the below queries:
Query1:

 

index="my_index"
|eval check=if(html_code==200,"error","OK")
|stats values(check) as check by src_ip dst_ip
|table src_ip , dst_ip , check , count

 

Query2:

 

index="my_index"
|eval check=if(html_code==200,"error","OK")
|stats values(src_ip) as src_ip values(dst_ip) as dst_ip by check 
|table src_ip , dst_ip , check , count

 


If this reply helped you an upvote would be appreciated, thank you.

Tags (1)
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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...