Splunk Search

splunk search to find who (ip's) connects to port 9997

dbashyam
Explorer

Hi,

I am looking for a splunk search to find which IP's are connecting to port 9997?

index=sys_*prod source=netstat | search State='ESTABLISHED' and LocalAddress=':9997'

I tried but I am not getting the proper result. Any idea how I can get the result.

Thanks,
Dinesh

Tags (1)
0 Karma

grijhwani
Motivator

Presumably your "LocalAddress" field is a complete address, not just the port number, in which case the term "LocalAddress=':9997'" is never going to be satisfied. At the very least it will need to be LocalAddress="*:9997". Firstly you are using single quotes, which mean the parameter is taken to be absolutely literal (i.e. no string matching patterns), and secondly you will need to match the trailing address (hence the leading asterisk).

0 Karma

christian_l
Path Finder

Hi Dinesh,

maybe you could give us a sample out of your logs.
With the current information I would suggest the following search query:

   index=sys_*prod source=netstat State='ESTABLISHED' LocalAddress=':9997' | stats values(src_ip_field)

Remember field names are case-sensitive, a AND connection was done implicit and if needed has to be written upper-case.

Regards,
Christian

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...