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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...