Splunk Search

Can you help me with the following SPL: Index=fw_cisco

dkraut
Engager

Question on the following SPL:

 >  index=fw_cisco src_ip="1.2.3.4" | stats count(dest_port) by dest_ip dest_port

This works well, but I'd also like to include the protocol in the output, so I know if the port is TCP or UDP. I've tried different things but no luck.

Is that even possible using this SPL?

0 Karma

Vijeta
Influencer

You can write - index=fw_cisco src_ip="1.2.3.4" | stats count(dest_port) by dest_ip dest_port protocol

0 Karma

richgalloway
SplunkTrust
SplunkTrust

There are two ways to do that.

index=fw_cisco src_ip="1.2.3.4" | stats count(dest_port) by dest_ip dest_port protocol

index=fw_cisco src_ip="1.2.3.4" | stats count(dest_port) values(protocol) by dest_ip dest_port
---
If this reply helps you, Karma would be appreciated.
0 Karma

dkraut
Engager

Hi Rich, I had already tried the first one but it returns no statistics at all. The second one you suggested returns statistics, including a values(protocol) field, but that field is blank? Looking at the corresponding Event data I see strings in the entries for "stub TCP connection", "stub UDP connection" so the data seems to be there.

Thanks!

0 Karma

richgalloway
SplunkTrust
SplunkTrust

The fact that the first command returns nothing and the second returns an empty field tells me your data does not have a field called "protocol". It must be called something else. Look where you see "stub TCP connection" to get the correct field name.

---
If this reply helps you, Karma would be appreciated.
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 ...