Splunk Search

Search help -- Display count if field is present in the output

renjujacob88
Path Finder

Hi Splunkers ,

Need help in creating the case statement.

We are feeding the palo alto logs to the threat intelligence of splunk( ip_intel) to see if any blacklisted ip is hitting the perimeters.
The query which I wrote is given below with the snapshot of the output

index=palo src_ip!=10.* | rename src_ip as ip | stats values(action) as action max(_time) as LastSeen min(_time) as FirstSeen dc(dest_ip) as dest_count values(threat_name) as threat_name values(severity) as severity count by ip|lookup ip_intel ip as ip OUTPUT description threat_key | table ip description threat_key action LastSeen FirstSeen threat_name severity dest_count count | eval description = if(isnull(description),"YES",description) | eval threat_key = if(isnull(threat_key),"YES",threat_key) | where threat_key!="YES" | convert ctime(LastSeen) ctime(FirstSeen)|
Blockquote
alt text

Now we need to modify the query in such a way that if the threat_name is present in the output(field of palo alto) display the result(whatever the count may be).
If the threat_name fields are empty then search for the count and display the count which is above 100.

Appreciate the help

0 Karma
1 Solution

niketn
Legend

@renjujacob88, following is based on sample data provided. Pipe the following to your existing results:

| eval attentionFlag=case(isnotnull(threat_name),"Investigate",isnull(threat_name) AND count>100,"Investigate",true(),"Ignore")
| search attentionFlag="Investigate"
| fields - attentionFlag
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

niketn
Legend

@renjujacob88, following is based on sample data provided. Pipe the following to your existing results:

| eval attentionFlag=case(isnotnull(threat_name),"Investigate",isnull(threat_name) AND count>100,"Investigate",true(),"Ignore")
| search attentionFlag="Investigate"
| fields - attentionFlag
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
Get Updates on the Splunk Community!

Customer Experience | Splunk 2024: New Onboarding Resources

In 2023, we were routinely reminded that the digital world is ever-evolving and susceptible to new ...

Celebrate CX Day with Splunk: Take our interactive quiz, join our LinkedIn Live ...

Today and every day, Splunk celebrates the importance of customer experience throughout our product, ...

How to Get Started with Splunk Data Management Pipeline Builders (Edge Processor & ...

If you want to gain full control over your growing data volumes, check out Splunk’s Data Management pipeline ...