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!

New in Observability - Improvements to Custom Metrics SLOs, Log Observer Connect & ...

The latest enhancements to the Splunk observability portfolio deliver improved SLO management accuracy, better ...

Improve Data Pipelines Using Splunk Data Management

  Register Now   This Tech Talk will explore the pipeline management offerings Edge Processor and Ingest ...

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud?

Register Join this Tech Talk to learn how unique features like Service Centric Views, Tag Spotlight, and ...