Splunk Search

I'm looking to create a search query to analyze traffic to determine source / destination IP and source / destination port, as well as using timestamp?

rcastello
Explorer

Hello,

I'm currently using this query to create a table:

index=* sourcetype=* dport=139 OR sport=139
| eval timestamp=strftime(_time, "%B %d, %I:%M:%S %p") 
| table timestamp sourcetype dport sport

However, I'd like to include src_ip and dest_ip, so I tried this but it doesn't pull the same results:

index=* sourcetype=* src_ip=* dest_ip=* dport=139 OR sport=139
| eval timestamp=strftime(_time, "%B %d, %I:%M:%S %p") 
| table timestamp sourcetype src_ip dest_ip dport sport

What am I doing incorrectly and how can I reach my desired results? Thank you for any help provided.

Tags (1)
0 Karma

woodcock
Esteemed Legend

Try this:

index=* sourcetype=* dport=139 OR sport=139
| eval timestamp=strftime(_time, "%B %d, %I:%M:%S %p") 
| eval src=coalesce(src_ip, src, src*, "unknown")
| eval dest=coalesce(dest_ip, dest, dest*, "unknown")
| table timestamp sourcetype src dest dport sport
0 Karma

rcastello
Explorer

Hello woodcock,

Thanks for your assistance. When I utilize your recommendation, Splunk throws this error:

Error in 'eval' command: The expression is malformed. An unexpected character is reached at ', "unknown")'.

Is there some data I should be using in place of "unknown" instead? Thanks for your help, @woodcock .

0 Karma

ddrillic
Ultra Champion

It does seem that coalesce takes only two parameters...

Sorry, the documentation says

-- This function takes an arbitrary number of arguments and returns the first value that is not NULL.

0 Karma
Get Updates on the Splunk Community!

More Control Over Your Monitoring Costs with Archived Metrics!

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

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...