<?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 From search to Data Model in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/From-search-to-Data-Model/m-p/698742#M237247</link>
    <description>&lt;P&gt;Hi, i have problem with Data model search.&lt;/P&gt;&lt;P&gt;This is my SPL:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;|datamodel Network_Resolution_DNS_v2 search| search DNS.message_type=Query |rename DNS.query as query&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| fields _time, query&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| streamstats current=f last(_time) as last_time by query&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| eval gap=last_time - _time&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| stats count avg(gap) AS AverageBeaconTime var(gap) AS VarianceBeaconTime BY query&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| eval AverageBeaconTime=round(AverageBeaconTime,3), VarianceBeaconTime=round(VarianceBeaconTime,3)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| sort -count&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| where VarianceBeaconTime &amp;lt; 60 AND count &amp;gt; 2 AND AverageBeaconTime&amp;gt;1.000&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| table query VarianceBeaconTime count AverageBeaconTime&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;and it's work fine but slowly, so i would like to change to Data Model.&lt;/P&gt;&lt;P&gt;How looks like query ?&amp;nbsp;&lt;BR /&gt;I have DM model DNS_v2 and it's work for another queries, but not for this.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;| tstats summariesonly=true values(DNS.query) as query FROM datamodel="DNS_v2" where DNS.message_type=Query groupby _time&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| mvexpand query&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| streamstats current=f last(_time) as last_time by query&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| eval gap=(last_time - _time)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| stats count avg(gap) AS AverageBeaconTime var(gap) AS VarianceBeaconTime BY query&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| eval AverageBeaconTime=round(AverageBeaconTime,3), VarianceBeaconTime=round(VarianceBeaconTime,3)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| sort -count&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| where VarianceBeaconTime &amp;lt; 60 AND count &amp;gt; 2 AND AverageBeaconTime&amp;gt;1.000&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| table query VarianceBeaconTime count AverageBeaconTime&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Has anyone had this problem before?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Sep 2024 07:58:11 GMT</pubDate>
    <dc:creator>kukasky</dc:creator>
    <dc:date>2024-09-11T07:58:11Z</dc:date>
    <item>
      <title>From search to Data Model</title>
      <link>https://community.splunk.com/t5/Splunk-Search/From-search-to-Data-Model/m-p/698742#M237247</link>
      <description>&lt;P&gt;Hi, i have problem with Data model search.&lt;/P&gt;&lt;P&gt;This is my SPL:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;|datamodel Network_Resolution_DNS_v2 search| search DNS.message_type=Query |rename DNS.query as query&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| fields _time, query&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| streamstats current=f last(_time) as last_time by query&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| eval gap=last_time - _time&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| stats count avg(gap) AS AverageBeaconTime var(gap) AS VarianceBeaconTime BY query&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| eval AverageBeaconTime=round(AverageBeaconTime,3), VarianceBeaconTime=round(VarianceBeaconTime,3)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| sort -count&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| where VarianceBeaconTime &amp;lt; 60 AND count &amp;gt; 2 AND AverageBeaconTime&amp;gt;1.000&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| table query VarianceBeaconTime count AverageBeaconTime&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;and it's work fine but slowly, so i would like to change to Data Model.&lt;/P&gt;&lt;P&gt;How looks like query ?&amp;nbsp;&lt;BR /&gt;I have DM model DNS_v2 and it's work for another queries, but not for this.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;| tstats summariesonly=true values(DNS.query) as query FROM datamodel="DNS_v2" where DNS.message_type=Query groupby _time&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| mvexpand query&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| streamstats current=f last(_time) as last_time by query&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| eval gap=(last_time - _time)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| stats count avg(gap) AS AverageBeaconTime var(gap) AS VarianceBeaconTime BY query&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| eval AverageBeaconTime=round(AverageBeaconTime,3), VarianceBeaconTime=round(VarianceBeaconTime,3)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| sort -count&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| where VarianceBeaconTime &amp;lt; 60 AND count &amp;gt; 2 AND AverageBeaconTime&amp;gt;1.000&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| table query VarianceBeaconTime count AverageBeaconTime&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Has anyone had this problem before?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 07:58:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/From-search-to-Data-Model/m-p/698742#M237247</guid>
      <dc:creator>kukasky</dc:creator>
      <dc:date>2024-09-11T07:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: From search to Data Model</title>
      <link>https://community.splunk.com/t5/Splunk-Search/From-search-to-Data-Model/m-p/698753#M237249</link>
      <description>&lt;P&gt;What is a "DNS_v2" datamodel? It's not one of the CIM-defined ones.&lt;/P&gt;&lt;P&gt;Your original search uses&lt;/P&gt;&lt;PRE&gt;|datamodel Network_Resolution_DNS_v2 search&lt;/PRE&gt;&lt;P&gt;whereas your tstats use&lt;/P&gt;&lt;PRE&gt;| tstats summariesonly=true values(DNS.query) as query FROM datamodel="DNS_v2" [...]&lt;/PRE&gt;&lt;P&gt;Few more hints:&lt;/P&gt;&lt;P&gt;1. Use preformatted paragraph style or a code block to paste SPL - it helps in reability and prevents the forum interface from rendering some text as emojis and such.&lt;/P&gt;&lt;P&gt;2. What do you mean by "doesn't work"? Do you get an error? Or you simply get different results than expected? If so, how they differ?&lt;/P&gt;&lt;P&gt;3. There are two typical approaches to debugging SPL - either build it from the start adding commands one by one until they stop yielding proper results or start with the whole search and remove commands from the end one by one until they start producing proper results - then you know which step is the problematic one.&lt;/P&gt;&lt;P&gt;4. Often it's much easier for people to help you when you provide sample(s) of your data and describe what you want to do with it than posting some (sometimes fairly complicated) SPL without additional comments as to what you want to achieve.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 09:25:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/From-search-to-Data-Model/m-p/698753#M237249</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-09-11T09:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: From search to Data Model</title>
      <link>https://community.splunk.com/t5/Splunk-Search/From-search-to-Data-Model/m-p/698762#M237251</link>
      <description>&lt;P&gt;&amp;nbsp;&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;| tstats summariesonly=true values(DNS.query) as query FROM datamodel="Network_Resolution_DNS_v2" where DNS.message_type=Query groupby _time
| mvexpand query
| streamstats current=f last(_time) as last_time by query
| eval gap=(last_time - _time)
| stats count avg(gap) AS AverageBeaconTime var(gap) AS VarianceBeaconTime BY query
| eval AverageBeaconTime=round(AverageBeaconTime,3), VarianceBeaconTime=round(VarianceBeaconTime,3)
| sort -count
| where VarianceBeaconTime &amp;lt; 60 AND count &amp;gt; 2 AND AverageBeaconTime&amp;gt;1.000
| table query VarianceBeaconTime count AverageBeaconTime&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry when i have copied i pasted wrong datamodel. This is CIM model, but i duplicate this model and add some additional fields, but for this query i need only field query and time.&lt;/P&gt;&lt;P&gt;Original query is from&amp;nbsp;&lt;BR /&gt;&lt;A href="https://www.splunk.com/en_us/blog/security/detect-hunt-dns-exfiltration.html?locale=en_us" target="_blank"&gt;https://www.splunk.com/en_us/blog/security/detect-hunt-dns-exfiltration.html?locale=en_us&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 11:17:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/From-search-to-Data-Model/m-p/698762#M237251</guid>
      <dc:creator>kukasky</dc:creator>
      <dc:date>2024-09-11T11:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: From search to Data Model</title>
      <link>https://community.splunk.com/t5/Splunk-Search/From-search-to-Data-Model/m-p/698768#M237253</link>
      <description>&lt;P&gt;OK. What does "doesn't work" mean here? And do you get any results from the initial tstats search?&lt;/P&gt;&lt;P&gt;Stupid question - is your datamodel even accelerated?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 12:01:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/From-search-to-Data-Model/m-p/698768#M237253</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-09-11T12:01:51Z</dc:date>
    </item>
  </channel>
</rss>

