<?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: Can you do a data model search based on tstats and macros? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-you-do-a-data-model-search-based-on-tstats-and-macros/m-p/385501#M112579</link>
    <description>&lt;P&gt;Thanks D...  No go unfortunately.&lt;/P&gt;

&lt;P&gt;| tstats &lt;CODE&gt;summariesonly&lt;/CODE&gt; count FROM datamodel=Web.Web BY Web.url, Web.client_ip where Web.url IN ("&lt;EM&gt;0aqpqdju.me&lt;/EM&gt;", "&lt;EM&gt;0x1f4b0.com&lt;/EM&gt;",...)&lt;/P&gt;

&lt;P&gt;Error:  Error in 'TsidxStats': Wildcards (*) are not supported in groupby fields&lt;/P&gt;

&lt;P&gt;(FYI - The wildcards are being stripped in the above query when posted here.)&lt;/P&gt;

&lt;P&gt;As to the second option it won't work.  It has to contain the wildcards since the url can vary wildly.&lt;/P&gt;

&lt;P&gt;Seems like this should be a simple pattern matching search against the DM.  &lt;/P&gt;

&lt;P&gt;Someone suggested using macros.conf and transforms.conf in another channel.  Will give that a try.&lt;/P&gt;</description>
    <pubDate>Mon, 06 Aug 2018 15:03:15 GMT</pubDate>
    <dc:creator>david_casey</dc:creator>
    <dc:date>2018-08-06T15:03:15Z</dc:date>
    <item>
      <title>Can you do a data model search based on tstats and macros?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-do-a-data-model-search-based-on-tstats-and-macros/m-p/385499#M112577</link>
      <description>&lt;P&gt;Can you do a data model search based on a macro?  Trying but Splunk is not liking it.  It yells about the wildcards *, or returns no data depending on different syntax.&lt;/P&gt;

&lt;P&gt;Base data model search:&lt;/P&gt;

&lt;P&gt;| tstats &lt;CODE&gt;summariesonly&lt;/CODE&gt; count FROM datamodel=Web.Web BY Web.url, Web.client_ip&lt;/P&gt;

&lt;P&gt;The macro (coinminers_url) contains url patterns as follows: &lt;/P&gt;

&lt;P&gt;"&lt;EM&gt;0aqpqdju.me&lt;/EM&gt;" OR "&lt;EM&gt;0x1f4b0.com&lt;/EM&gt;" OR "&lt;EM&gt;12finance.com&lt;/EM&gt;" OR "&lt;EM&gt;1480876790.rsc.cdn77.org&lt;/EM&gt;" OR "&lt;EM&gt;1beb2a44.space&lt;/EM&gt;" OR "&lt;EM&gt;1q2w3.fun&lt;/EM&gt;" OR "&lt;EM&gt;1q2w3.me&lt;/EM&gt;"&lt;/P&gt;

&lt;P&gt;The objective is to cross reference the macro for any matches in the Web data model and display the date/time and internal client IP that hit one (or more) matches from the macro list.  These will be the clients that hit a known coinminer domain, which we maintain a list of based on a GitHub repo list.  That list is quite large so a traditional search can take quite a while.&lt;/P&gt;

&lt;P&gt;Suggestions?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2018 13:53:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-do-a-data-model-search-based-on-tstats-and-macros/m-p/385499#M112577</guid>
      <dc:creator>david_casey</dc:creator>
      <dc:date>2018-08-06T13:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: Can you do a data model search based on tstats and macros?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-do-a-data-model-search-based-on-tstats-and-macros/m-p/385500#M112578</link>
      <description>&lt;P&gt;You can build a macro that will use the &lt;CODE&gt;WHERE  fieldname  IN ("list","of","values")&lt;/CODE&gt;   format.  Per the docs, the below format should work with wildcards in the macro.  &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.1.2/SearchReference/ConditionalFunctions"&gt;https://docs.splunk.com/Documentation/Splunk/7.1.2/SearchReference/ConditionalFunctions&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;First try this with 3 values and see if it works...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | tstats summariesonly count FROM datamodel=Web.Web BY Web.url, Web.client_ip 
    where Web.url IN ("0aqpqdju.me", "0x1f4b0.com",...)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If it works, then just build a macro that resolves to that whole second line.&lt;/P&gt;

&lt;P&gt;... if you can't get the above working, then try this, but it will not work with wildcards...  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | tstats summariesonly count FROM datamodel=Web.Web BY Web.url, Web.client_ip 
 | where in(Web.url ,"0aqpqdju.me", "0x1f4b0.com",...)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Aug 2018 14:24:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-do-a-data-model-search-based-on-tstats-and-macros/m-p/385500#M112578</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-08-06T14:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can you do a data model search based on tstats and macros?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-do-a-data-model-search-based-on-tstats-and-macros/m-p/385501#M112579</link>
      <description>&lt;P&gt;Thanks D...  No go unfortunately.&lt;/P&gt;

&lt;P&gt;| tstats &lt;CODE&gt;summariesonly&lt;/CODE&gt; count FROM datamodel=Web.Web BY Web.url, Web.client_ip where Web.url IN ("&lt;EM&gt;0aqpqdju.me&lt;/EM&gt;", "&lt;EM&gt;0x1f4b0.com&lt;/EM&gt;",...)&lt;/P&gt;

&lt;P&gt;Error:  Error in 'TsidxStats': Wildcards (*) are not supported in groupby fields&lt;/P&gt;

&lt;P&gt;(FYI - The wildcards are being stripped in the above query when posted here.)&lt;/P&gt;

&lt;P&gt;As to the second option it won't work.  It has to contain the wildcards since the url can vary wildly.&lt;/P&gt;

&lt;P&gt;Seems like this should be a simple pattern matching search against the DM.  &lt;/P&gt;

&lt;P&gt;Someone suggested using macros.conf and transforms.conf in another channel.  Will give that a try.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2018 15:03:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-do-a-data-model-search-based-on-tstats-and-macros/m-p/385501#M112579</guid>
      <dc:creator>david_casey</dc:creator>
      <dc:date>2018-08-06T15:03:15Z</dc:date>
    </item>
  </channel>
</rss>

