Splunk Search

Passive DNS

kjstogn
Explorer

I am trying to create a passive dns collection based on splunk stream data. My current SPL is this:

index=botsv2 sourcetype=stream:dns query=*frothly.local
| stats earliest(_time) as firstSeen, latest(_time) as lastSeen by query
| eval firstSeen=strftime(firstSeen, "%m/%d/%Y %H:%M:%S")
| eval lastSeen=strftime(lastSeen, "%m/%d/%Y %H:%M:%S")

What I am trying to accomplish is show how many days as "activeDays" a query was made. Just because its first and last may be seen 30 days apart it may have only been queried a couple times. 

Also the stream queries and answers are separate events and how would i join them to create a by query and answers

 

Labels (1)
Tags (2)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Here's an untested search to find out how many separate days each query was made.  It has the side effect of retaining only the date of each query, not the time.

index=botsv2 sourcetype=stream:dns query=*frothly.local
| bin span=1d _time
| stats earliest(_time) as firstSeen, latest(_time) as lastSeen, dc(_time) as queryDays by query
| eval firstSeen=strftime(firstSeen, "%m/%d/%Y %H:%M:%S")
| eval lastSeen=strftime(lastSeen, "%m/%d/%Y %H:%M:%S")

 

---
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.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...