All Apps and Add-ons

Active Directory DNS logs - extract domain name without periods

daniel_augustyn
Contributor

I've been trying to extract domains from AD DNS logs with the following rex and it's not really working well:

[win]
SEDCMD = s/(\d+)/./g

I am still getting leading and trailing periods, for example:

.www.google.com.

The raw logs has parentheses with number of letters in it.
(3)www(6)google(3)com

Any other idea how to do it right?

1 Solution

dwaddle
SplunkTrust
SplunkTrust

This is kind-of a non-answer to your question. But, you might find more success using something like the Splunk App for Stream to pick up DNS data. You'll get nice, clean JSON events with requests and responses and no Windows log silliness..

View solution in original post

gerardo_maya
Splunk Employee
Splunk Employee

Hello Daniel, 

I found that using the command replace you can create a calculated field called dest.

| eval dest = replace(replace(dnsQuery,"\(\d+\)","."),"^\.|\.$","")

On the first replace you eliminate all the number rounded by parenthesis, and on the other replace you eliminate the first and the last period.

So on Cloud you only need to create a calculated field and put the function replace, just like this

replace(replace(dnsQuery,"\(\d+\)","."),"^\.|\.$","")

I hope it helps other Splunkers to solve this issue or other similar. 

Tags (3)
0 Karma

woodcock
Esteemed Legend

Your question is phrased very poorly so I cannot begin to answer. You say "capture" but then you are actually using SEDMCD which does not "capture", it actually "modifies by replacing". Please clearly restate what you would like, including a COMPLETE example with a fake event and desired outcome mockup.

0 Karma

dwaddle
SplunkTrust
SplunkTrust

This is kind-of a non-answer to your question. But, you might find more success using something like the Splunk App for Stream to pick up DNS data. You'll get nice, clean JSON events with requests and responses and no Windows log silliness..

daniel_augustyn
Contributor

Thank you, I would look into it.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...