<?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 write a search leveraging tstats, a data model, and timechart? in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/How-to-write-a-search-leveraging-tstats-a-data-model-and/m-p/619111#M11692</link>
    <description>&lt;P&gt;Adding the &lt;FONT face="courier new,courier"&gt;timechart&lt;/FONT&gt; command should do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats count AS "Count of Blocked Traffic" from datamodel=Network_Traffic where (nodename = All_Traffic.Traffic_By_Action.Blocked_Traffic) All_Traffic.src_zone=foo groupby _time span=1d, All_Traffic.src_zone prestats=true
| `drop_dm_object_name("All_Traffic")`
| timechart span=1d count by src_zone&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Nov 2022 14:05:06 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2022-11-01T14:05:06Z</dc:date>
    <item>
      <title>How to write a search leveraging tstats, a data model, and timechart?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-write-a-search-leveraging-tstats-a-data-model-and/m-p/619106#M11691</link>
      <description>&lt;P&gt;I am looking to convert this regular search:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=foo action=blocked `macro` src_zone=foo | timechart count span=1d &lt;/LI-CODE&gt;&lt;P&gt;over to a search that leverage tstats and the Network Traffic datamodel that shows the count of blocked traffic per day for the past 7 days due to the large volume of network events&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats count AS "Count of Blocked Traffic" from datamodel=Network_Traffic where (nodename = All_Traffic.Traffic_By_Action.Blocked_Traffic) All_Traffic.src_zone=foo groupby _time, All_Traffic.src_zone prestats=true&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;How can I get this search to use timechart?&lt;/P&gt;&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 13:52:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-write-a-search-leveraging-tstats-a-data-model-and/m-p/619106#M11691</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2022-11-01T13:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search leveraging tstats, a data model, and timechart?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-write-a-search-leveraging-tstats-a-data-model-and/m-p/619111#M11692</link>
      <description>&lt;P&gt;Adding the &lt;FONT face="courier new,courier"&gt;timechart&lt;/FONT&gt; command should do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats count AS "Count of Blocked Traffic" from datamodel=Network_Traffic where (nodename = All_Traffic.Traffic_By_Action.Blocked_Traffic) All_Traffic.src_zone=foo groupby _time span=1d, All_Traffic.src_zone prestats=true
| `drop_dm_object_name("All_Traffic")`
| timechart span=1d count by src_zone&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 14:05:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-write-a-search-leveraging-tstats-a-data-model-and/m-p/619111#M11692</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-11-01T14:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search leveraging tstats, a data model, and timechart?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-write-a-search-leveraging-tstats-a-data-model-and/m-p/619114#M11693</link>
      <description>&lt;P&gt;TYVM Rich!&lt;/P&gt;&lt;P&gt;If I needed to add a macro in the search, where would I place that?&lt;/P&gt;&lt;P&gt;Thx again&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 14:15:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-write-a-search-leveraging-tstats-a-data-model-and/m-p/619114#M11693</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2022-11-01T14:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search leveraging tstats, a data model, and timechart?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-write-a-search-leveraging-tstats-a-data-model-and/m-p/619124#M11694</link>
      <description>&lt;P&gt;It depends on what the macro does.&amp;nbsp; Start by putting it in the &lt;FONT face="courier new,courier"&gt;where&lt;/FONT&gt; clause of the &lt;FONT face="courier new,courier"&gt;tstats&lt;/FONT&gt; command.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 14:43:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-write-a-search-leveraging-tstats-a-data-model-and/m-p/619124#M11694</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-11-01T14:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search leveraging tstats, a data model, and timechart?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-write-a-search-leveraging-tstats-a-data-model-and/m-p/619510#M11697</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I wanted to change this search up so it's looking at total traffic events with an overlay of the avg number of blocks, how would I write that query?&lt;/P&gt;&lt;P&gt;I have the following but not getting any results:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats count AS "Total Traffic" from datamodel=Network_Traffic where (nodename = All_Traffic) All_Traffic.src_zone=INTERNET-O groupby _time span=1d, All_Traffic.src_zone, All_Traffic.Traffic_By_Action.Blocked_Traffic prestats=true 
| `drop_dm_object_name("All_Traffic")`
| timechart span=1d count
| stats avg(count) by Traffic_By_Action.Blocked_Traffic&lt;/LI-CODE&gt;&lt;P&gt;Is the issue that I'm pulling from two different objects in the Network datamodel -&amp;nbsp;&lt;SPAN&gt;All_Traffic and&amp;nbsp;Blocked_Traffic and not referencing&amp;nbsp;the&amp;nbsp;Blocked_Traffic model correctly?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 16:52:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-write-a-search-leveraging-tstats-a-data-model-and/m-p/619510#M11697</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2022-11-03T16:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search leveraging tstats, a data model, and timechart?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-write-a-search-leveraging-tstats-a-data-model-and/m-p/619526#M11698</link>
      <description>&lt;P&gt;Mucking around some more and getting closer as I now have this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats count AS "Total Traffic" from datamodel=Network_Traffic where (nodename = All_Traffic ) OR (nodename = Blocked_Traffic) All_Traffic.src_zone=INTERNET-O groupby _time span=1d, All_Traffic.src_zone, All_Traffic.action, All_Traffic.Traffic_By_Action.Blocked_Traffic prestats=true 
| `drop_dm_object_name("All_Traffic")` 
| timechart span=1d count by action 
| eval "Block Avg" = round('blocked'*100/('allowed'+'blocked'),2)&lt;/LI-CODE&gt;&lt;P&gt;But two issues:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Timechart now shows bars by action and 'd like to see just the total count of network sessions&lt;/LI&gt;&lt;LI&gt;The average is basically flatlined as it's at roughly 40% whereas my totals by action are roughly 1.5B&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Thu, 03 Nov 2022 17:55:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-write-a-search-leveraging-tstats-a-data-model-and/m-p/619526#M11698</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2022-11-03T17:55:03Z</dc:date>
    </item>
  </channel>
</rss>

