Splunk Search

Why does tstats works different for root event datasets within the same data model

att35
Builder

Hi.

I have a data model that consists of two root event datasets. Both accelerated using simple SPL.

First dataset I can access using the following

 

| tstats summariesonly=t count FROM datamodel=model_name 
where nodename=dataset_1 by dataset_1.FieldName

 

But for the 2nd root event dataset, same format doesn't work. For that, I get events only by referencing the dataset along with the datamodel.

 

| tstats summariesonly=t count FROM datamodel=model_name.dataset_2 
by dataset_2.FieldName

 

e.g., the following will not work.

 

| tstats summariesonly=t count FROM datamodel=model_name 
where nodename=dataset_2 by dataset_2.FieldName

 

 

I am trying to understand what causes splunk search to work differently on these datasets when both are at the same level?

Thanks,

~ Abhi

Labels (1)
Tags (2)

Yaron_Eilat
Engager

I am very new to Splunk but I just encountered the explanation for this in a course 🙂

When no Dataset is specified in the From clause, Splunk assumes the first root Dataset is addressed.

When you want to address any root Dataset other than the first one, you must specify it explicitly.

Therefore, it is best practice to ignore the fact that Splunk assumes the first root Dataset and specify it in every use even if Splunk allows you to save that little bit of typing 😉

 

 

| tstats summariesonly=t count FROM datamodel=model_name.dataset_1 
where nodename=dataset_1 by dataset_1.FieldName

 

 

 

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...