<?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 Re: How to get a count of all of the events in all datamodels with tstats in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-count-of-all-of-the-events-in-all-datamodels-with/m-p/319151#M95411</link>
    <description>&lt;P&gt;This is what I have thus far.  You have to specify the datamodel (which is fine as I'm not using all of them) but I can't seem to find the name of the field that has the datamodel name either.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats summariesonly=t min(_time) as min, max(_time) as max count from datamodel=Web 
| append 
    [| tstats summariesonly=t min(_time) as min, max(_time) as max count from datamodel=Malware] 
| append 
    [| tstats summariesonly=t min(_time) as min, max(_time) as max count from datamodel=Intrusion_Detection ] 
| eval "Start time"=strftime(min, "%c") 
| eval "End time"=strftime(max, "%c") 
| eval "Event count" = count 
| fields "Start time" "End time" "Event count"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 15 Sep 2018 19:11:48 GMT</pubDate>
    <dc:creator>DEAD_BEEF</dc:creator>
    <dc:date>2018-09-15T19:11:48Z</dc:date>
    <item>
      <title>How to get a count of all of the events in all datamodels with tstats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-count-of-all-of-the-events-in-all-datamodels-with/m-p/319147#M95407</link>
      <description>&lt;P&gt;Hi, I am trying to get a list of datamodels and their counts of events for each, so as to make sure that our datamodels are working.&lt;/P&gt;
&lt;P&gt;I have got a list of the datamodels here:&lt;/P&gt;
&lt;P&gt;| datamodel | spath input=_raw output=datamodelname path="modelName" | table datamodelname&lt;/P&gt;
&lt;P&gt;However, when I append the tstats command onto this, as in here, Splunk reponds with no data and "datamodel 'datamodelname' not found".&lt;/P&gt;
&lt;P&gt;| tstats count from datamodel=datamodelname&lt;/P&gt;
&lt;P&gt;I am guessing that the "datamodel" parameter in tstats should be a literal and not a variable field? If so, how do I execute this?&lt;/P&gt;
&lt;P&gt;Kindest regards,&lt;/P&gt;
&lt;P&gt;BlueSocket&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 15:17:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-count-of-all-of-the-events-in-all-datamodels-with/m-p/319147#M95407</guid>
      <dc:creator>BlueSocket</dc:creator>
      <dc:date>2023-03-07T15:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a count of all of the events in all datamodels with tstats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-count-of-all-of-the-events-in-all-datamodels-with/m-p/319148#M95408</link>
      <description>&lt;P&gt;I can't believe that no one has got an idea about this (and there have been 55 views with 44 people following this question)!&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 10:13:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-count-of-all-of-the-events-in-all-datamodels-with/m-p/319148#M95408</guid>
      <dc:creator>BlueSocket</dc:creator>
      <dc:date>2018-01-26T10:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a count of all of the events in all datamodels with tstats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-count-of-all-of-the-events-in-all-datamodels-with/m-p/319149#M95409</link>
      <description>&lt;P&gt;You are probably going to want to use a &lt;CODE&gt;map&lt;/CODE&gt; command based upon the output of the initial command.  I don't have one handy, but I'll check and see if I can put one together when i get a chance, if no one has solved this for you by then.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 17:33:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-count-of-all-of-the-events-in-all-datamodels-with/m-p/319149#M95409</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-01-26T17:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a count of all of the events in all datamodels with tstats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-count-of-all-of-the-events-in-all-datamodels-with/m-p/319150#M95410</link>
      <description>&lt;P&gt;Thanks - I got a bit further, but not quite there with this query:&lt;/P&gt;

&lt;P&gt;| datamodel | spath input=_raw output=datamodelname path="modelName" | table datamodelname | map search="|tstats count from datamodel=$datamodelname$ | eval datamodel=$datamodelname$ | table datamodel, count"&lt;/P&gt;

&lt;P&gt;And I get this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;datamodel            count
----------------            --------
                             1928
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get the index and the count, but not the datamodel in the table. I am looking for:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;datamodel      count
----------------      --------
security             1928
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried:&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2018 11:12:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-count-of-all-of-the-events-in-all-datamodels-with/m-p/319150#M95410</guid>
      <dc:creator>BlueSocket</dc:creator>
      <dc:date>2018-01-29T11:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a count of all of the events in all datamodels with tstats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-count-of-all-of-the-events-in-all-datamodels-with/m-p/319151#M95411</link>
      <description>&lt;P&gt;This is what I have thus far.  You have to specify the datamodel (which is fine as I'm not using all of them) but I can't seem to find the name of the field that has the datamodel name either.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats summariesonly=t min(_time) as min, max(_time) as max count from datamodel=Web 
| append 
    [| tstats summariesonly=t min(_time) as min, max(_time) as max count from datamodel=Malware] 
| append 
    [| tstats summariesonly=t min(_time) as min, max(_time) as max count from datamodel=Intrusion_Detection ] 
| eval "Start time"=strftime(min, "%c") 
| eval "End time"=strftime(max, "%c") 
| eval "Event count" = count 
| fields "Start time" "End time" "Event count"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 15 Sep 2018 19:11:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-count-of-all-of-the-events-in-all-datamodels-with/m-p/319151#M95411</guid>
      <dc:creator>DEAD_BEEF</dc:creator>
      <dc:date>2018-09-15T19:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a count of all of the events in all datamodels with tstats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-count-of-all-of-the-events-in-all-datamodels-with/m-p/319152#M95412</link>
      <description>&lt;P&gt;This is a very dumb solution, but I was looking for a quick and dirty way to see the numbers.  Maybe this might spark another idea with someone else.&lt;/P&gt;

&lt;P&gt;I amended the search and did this:&lt;/P&gt;

&lt;P&gt;| datamodel &lt;BR /&gt;
| spath input=_raw output=datamodelname path="modelName" &lt;BR /&gt;
| table datamodelname &lt;BR /&gt;
| map search="|tstats count($datamodelname$) count from datamodel=$datamodelname$"&lt;/P&gt;

&lt;P&gt;So this gave me this table:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4186i7BE37701EFB2CA8E/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Match the zero to the count table, and you get the number of events.&lt;/P&gt;

&lt;P&gt;Again, I know it's a lame way to do it, but it works for my intents.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2019 15:12:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-count-of-all-of-the-events-in-all-datamodels-with/m-p/319152#M95412</guid>
      <dc:creator>arizviherjavec</dc:creator>
      <dc:date>2019-04-25T15:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a count of all of the events in all datamodels with tstats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-count-of-all-of-the-events-in-all-datamodels-with/m-p/633532#M220059</link>
      <description>&lt;P&gt;Hi BlueSocket,&lt;/P&gt;&lt;P&gt;I know this is a pretty old thread, but I stumbled upon the same question today.&lt;BR /&gt;You almost had the solution yourself. You only missed escaped quotes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| datamodel | spath input=_raw output=datamodelname path="modelName" | table datamodelname | map search="|tstats count from datamodel=$datamodelname$ | eval datamodel=\"$datamodelname$\" | table datamodel, count"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 09:04:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-count-of-all-of-the-events-in-all-datamodels-with/m-p/633532#M220059</guid>
      <dc:creator>patrickp_splunk</dc:creator>
      <dc:date>2023-03-07T09:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a count of all of the events in all datamodels with tstats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-count-of-all-of-the-events-in-all-datamodels-with/m-p/673380#M230571</link>
      <description>&lt;P&gt;I stumbled across this while seeking a solution this week. I came up with something pretty similar to&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254531"&gt;@patrickp_splunk&lt;/a&gt;&amp;nbsp;. With a slight change. I kicked things into json before it comes out of the map command (because `map` only allowed me to bring back one field).&lt;/P&gt;&lt;PRE&gt;| datamodelsimple \&lt;BR /&gt;     | map maxsearches=500 search="| tstats count FROM datamodel=$datamodel$ | eval dmName=\"$datamodel$\" &lt;BR /&gt;     | tojson | fields - count,dmName" | extract | table dmName,count&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2024 16:08:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-a-count-of-all-of-the-events-in-all-datamodels-with/m-p/673380#M230571</guid>
      <dc:creator>EbolaWare</dc:creator>
      <dc:date>2024-01-05T16:08:34Z</dc:date>
    </item>
  </channel>
</rss>

