Splunk Search

Splunk content

quangnm21
Explorer

quangnm21_0-1703135426064.png

This was my initial search. I cannot compare the two fields "srcdomain = destdomain" because when I intend to use eval my value is output as null. Thanks everyone

quangnm21_0-1703135380899.png

 

Labels (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @quangnm21 ,

after every stats command (also tstats) you have only the fields that are present in the command, so dest_nt_domain and src_nt_domain aren't still present.

You have to insert in the tstats command the two fields with the values option:

| tstats `security.content.summariesonly` 
   values(host) AS srcHost 
   dc(host) AS chost 
   min(_time) AS firstTime 
   max(_time) AS lastTime 
   values(Authentication.dest_nt_domain) AS dest_nt_domain
   values(Authentication.src_nt_domain) AS src_nt_domain 
   FROM datamodel=Authentication 
   WHERE Authentication.action="success" Authentication.dest_nt_domain="PTIT" Authentication.src_nt_domain="PTIT" Authentication.user="qmn"
   BY Authentication.user
| eval 
   abc = tostring(dest_nt_domain),
   xyz = tostring(src_nt_domain)

 Then I hint to rename some fields avoiding the dot in the name (sometimes functions don't work).

Last doubt: if you have the Authentication.user field in the WHERE condition, why do you have it also in the BY cluse? it's always one value!

Last thing: please next time use, in addition to the screenshots, add also the search in text mode (using the "Insert/Edit code sample" button) , so I don't need to rewrite it!

Ciao.

Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi @quangnm21 ,

after every stats command (also tstats) you have only the fields that are present in the command, so dest_nt_domain and src_nt_domain aren't still present.

You have to insert in the tstats command the two fields with the values option:

| tstats `security.content.summariesonly` 
   values(host) AS srcHost 
   dc(host) AS chost 
   min(_time) AS firstTime 
   max(_time) AS lastTime 
   values(Authentication.dest_nt_domain) AS dest_nt_domain
   values(Authentication.src_nt_domain) AS src_nt_domain 
   FROM datamodel=Authentication 
   WHERE Authentication.action="success" Authentication.dest_nt_domain="PTIT" Authentication.src_nt_domain="PTIT" Authentication.user="qmn"
   BY Authentication.user
| eval 
   abc = tostring(dest_nt_domain),
   xyz = tostring(src_nt_domain)

 Then I hint to rename some fields avoiding the dot in the name (sometimes functions don't work).

Last doubt: if you have the Authentication.user field in the WHERE condition, why do you have it also in the BY cluse? it's always one value!

Last thing: please next time use, in addition to the screenshots, add also the search in text mode (using the "Insert/Edit code sample" button) , so I don't need to rewrite it!

Ciao.

Giuseppe

quangnm21
Explorer

@gcusello , Thank you

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @quangnm21 ,

good for you, see next time!

Ciao and happy splunking

Giuseppe

P.S.: Karma Points are 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!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...