<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic tstats joined to index query using stats in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/tstats-joined-to-index-query-using-stats/m-p/743968#M241195</link>
    <description>&lt;P&gt;Hello team,&lt;/P&gt;&lt;P&gt;I know I can use stats instead of join.&amp;nbsp; For our purposes we sometimes do that with 2 different indexes.&lt;/P&gt;&lt;P&gt;Now we have a one huge index from which we took some fields and we now have "data model" which i can query using tstats.&amp;nbsp; Problem is when I need to join result data from tstats with results from another index.&amp;nbsp; Is this possible?&lt;/P&gt;&lt;P&gt;I have following query (psedo query):&lt;/P&gt;&lt;P&gt;index=abc fieldX IN (Mary John Bob)&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;| tstats values(a) values(b) where fieldY=xy by _time span=1s&lt;/P&gt;&lt;P&gt;| stats values(somevalue) as SomeA, dc(index) as idx, values(fieldX) as X by CommonName&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Apr 2025 14:55:34 GMT</pubDate>
    <dc:creator>dmitrynt</dc:creator>
    <dc:date>2025-04-10T14:55:34Z</dc:date>
    <item>
      <title>tstats joined to index query using stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/tstats-joined-to-index-query-using-stats/m-p/743968#M241195</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;&lt;P&gt;I know I can use stats instead of join.&amp;nbsp; For our purposes we sometimes do that with 2 different indexes.&lt;/P&gt;&lt;P&gt;Now we have a one huge index from which we took some fields and we now have "data model" which i can query using tstats.&amp;nbsp; Problem is when I need to join result data from tstats with results from another index.&amp;nbsp; Is this possible?&lt;/P&gt;&lt;P&gt;I have following query (psedo query):&lt;/P&gt;&lt;P&gt;index=abc fieldX IN (Mary John Bob)&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;| tstats values(a) values(b) where fieldY=xy by _time span=1s&lt;/P&gt;&lt;P&gt;| stats values(somevalue) as SomeA, dc(index) as idx, values(fieldX) as X by CommonName&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Apr 2025 14:55:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/tstats-joined-to-index-query-using-stats/m-p/743968#M241195</guid>
      <dc:creator>dmitrynt</dc:creator>
      <dc:date>2025-04-10T14:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: tstats joined to index query using stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/tstats-joined-to-index-query-using-stats/m-p/743969#M241196</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Yes, you can combine tstats results with index search results using append , then aggregate with stats on a common field. I would avoid join for performance reasons.&lt;/P&gt;&lt;PRE&gt;index=abc fieldX IN (Mary John Bob)
| stats values(somevalue) as SomeA values(fieldX) as X by CommonName
| append [| tstats values(a) as a values(b) as b where datamodel=YourDataModel fieldY=xy by _time span=1s CommonName ]
| stats values(a) as a values(b) as b values(SomeA) as SomeA values(X) as X dc(index) as idx by CommonName&lt;/PRE&gt;&lt;P&gt;Run raw index search grouped by CommonName.&lt;/P&gt;&lt;P&gt;Append&amp;nbsp;tstats to get data model results grouped by CommonName.&lt;/P&gt;&lt;P&gt;The final stats aggregates all fields by append0, effectively "joining" the datasets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt; If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 11 Apr 2025 06:19:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/tstats-joined-to-index-query-using-stats/m-p/743969#M241196</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-04-11T06:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: tstats joined to index query using stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/tstats-joined-to-index-query-using-stats/m-p/743970#M241197</link>
      <description>&lt;P&gt;with [search index... you are creating a subsearch which has limitations of 100k events i think.&amp;nbsp; I can't do subsearches as index is very big, think millions..&lt;/P&gt;</description>
      <pubDate>Thu, 10 Apr 2025 15:55:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/tstats-joined-to-index-query-using-stats/m-p/743970#M241197</guid>
      <dc:creator>dmitrynt</dc:creator>
      <dc:date>2025-04-10T15:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: tstats joined to index query using stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/tstats-joined-to-index-query-using-stats/m-p/743983#M241202</link>
      <description>&lt;P&gt;Even less. By default, unless we're talking join which has different limits, it's just 10k results.&lt;/P&gt;&lt;P&gt;Back to your original question... I'm not sure what you want to do to be honest. What do you want to join with what. And what results you are getting from each of those searches.&lt;/P&gt;&lt;P&gt;BTW you don't have to use tstats to search from datamodel (but you might want to if you want to aggregate quickly&amp;nbsp;&lt;STRONG&gt;if your DM is accelerated&lt;/STRONG&gt;; otherwise it might be slower than normal search)&lt;/P&gt;</description>
      <pubDate>Thu, 10 Apr 2025 18:39:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/tstats-joined-to-index-query-using-stats/m-p/743983#M241202</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2025-04-10T18:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: tstats joined to index query using stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/tstats-joined-to-index-query-using-stats/m-p/744003#M241204</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/257397"&gt;@dmitrynt&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you're concerned about hitting subsearch limits then run your index= search first, then append the tstats.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note - The default limits for append by &lt;A href="https://docs.splunk.com/Documentation/Splunk/9.4.1/SearchReference/Append" target="_self"&gt;default are 10,000 *results* and max 60 second execution time&lt;/A&gt;, but I would hope that your tstats runs faster than this and returns less &amp;lt; 10k results! This limit is based on *returned results* not number of events scanned, so applying stats (for example) in an append can also help with these limits.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 06:23:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/tstats-joined-to-index-query-using-stats/m-p/744003#M241204</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-04-11T06:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: tstats joined to index query using stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/tstats-joined-to-index-query-using-stats/m-p/744049#M241213</link>
      <description>&lt;P&gt;Here is my orignal query.&amp;nbsp; I have to mask a lot of code and evals. Sorry.&amp;nbsp; Probably ignore that i do eventstats and than stats as im doing a lookup which im not showing and getting columns there.&lt;/P&gt;&lt;P&gt;Question is: if index=A is now Accelerated model.&amp;nbsp; How can i join results of index query with tstats results without using sub-searches or anything that would limit it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(index=a&lt;BR /&gt;OR&lt;BR /&gt;(index=b DistinguishedName IN ("ou=a" "ou=b")&lt;BR /&gt;| eventstats values(src_ip) as SourceIP dc(index) as idx values(OU) as OU by Account_Name&lt;BR /&gt;| search idx=2&lt;BR /&gt;| where index="a"&lt;BR /&gt;| stats dc(src_ip) as IP earliest(T) as FirstOccurance latest(T) as LatestOccurance values(OU) as Location count by Account_Name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 22:23:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/tstats-joined-to-index-query-using-stats/m-p/744049#M241213</guid>
      <dc:creator>dmitrynt</dc:creator>
      <dc:date>2025-04-11T22:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: tstats joined to index query using stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/tstats-joined-to-index-query-using-stats/m-p/744050#M241214</link>
      <description>&lt;P&gt;The only reason we created accelerated model is so that we can "return" 1 million events in few seconds.&amp;nbsp; Therefore, I'm not sure append fits this.&lt;/P&gt;&lt;P&gt;original non-working scenario due to huge index=a&lt;/P&gt;&lt;P&gt;index=a OR index=b&lt;BR /&gt;stats (where matched in 2 indexes) by FieldA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need to make work&lt;/P&gt;&lt;P&gt;index=b OR | tstats&amp;nbsp; values.....&lt;/P&gt;&lt;P&gt;stats (where matched in 2 indexes??) by FieldA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 22:41:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/tstats-joined-to-index-query-using-stats/m-p/744050#M241214</guid>
      <dc:creator>dmitrynt</dc:creator>
      <dc:date>2025-04-11T22:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: tstats joined to index query using stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/tstats-joined-to-index-query-using-stats/m-p/744052#M241215</link>
      <description>&lt;P&gt;Well, that's not gonna be easy.&lt;/P&gt;&lt;P&gt;With this many results not only you can't use append but also eventstats is not a good idea.&lt;/P&gt;&lt;P&gt;Unfortunately, the less precise you are about your use case the more probability that you will get a "no can do" answer.&lt;/P&gt;&lt;P&gt;Maybe you should work on your extractions and/or initial filtering, maybe it's one of the rare cases where adding indexed field would help... we don't know. We are not aware what problem you're trying to solve.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Apr 2025 07:16:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/tstats-joined-to-index-query-using-stats/m-p/744052#M241215</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2025-04-12T07:16:12Z</dc:date>
    </item>
  </channel>
</rss>

