<?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 Translate sql to Splunk search language in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Translate-sql-to-Splunk-search-language/m-p/355306#M5693</link>
    <description>&lt;P&gt;How can this sql "like" query be translated into something the Splunk search language can understand?  &lt;/P&gt;

&lt;P&gt;select count(*) from LOG start from X time till Y time&lt;BR /&gt;
select uniquecount(deviceGUID) from LOG start from X time till Y time &lt;BR /&gt;
"SELECT COUNT(DISTINCT e.account) FROM Log e WHERE e.launchPoint IN ?1 AND e.action = 'Tile Selection' AND e.assetId IS NULL AND e.destination LIKE 'page:%' AND e.dateTime BETWEEN ?2 AND ?3"&lt;/P&gt;</description>
    <pubDate>Thu, 15 Mar 2018 16:53:01 GMT</pubDate>
    <dc:creator>dwong2</dc:creator>
    <dc:date>2018-03-15T16:53:01Z</dc:date>
    <item>
      <title>Translate sql to Splunk search language</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Translate-sql-to-Splunk-search-language/m-p/355306#M5693</link>
      <description>&lt;P&gt;How can this sql "like" query be translated into something the Splunk search language can understand?  &lt;/P&gt;

&lt;P&gt;select count(*) from LOG start from X time till Y time&lt;BR /&gt;
select uniquecount(deviceGUID) from LOG start from X time till Y time &lt;BR /&gt;
"SELECT COUNT(DISTINCT e.account) FROM Log e WHERE e.launchPoint IN ?1 AND e.action = 'Tile Selection' AND e.assetId IS NULL AND e.destination LIKE 'page:%' AND e.dateTime BETWEEN ?2 AND ?3"&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 16:53:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Translate-sql-to-Splunk-search-language/m-p/355306#M5693</guid>
      <dc:creator>dwong2</dc:creator>
      <dc:date>2018-03-15T16:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: Translate sql to Splunk search language</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Translate-sql-to-Splunk-search-language/m-p/355307#M5694</link>
      <description>&lt;P&gt;These are a bit generic since your SQL is a bit generic but hopefully it will help you get the gist. &lt;/P&gt;

&lt;P&gt;select count(*) from LOG start from X time till Y time&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=LOGindex sourectype=LOGsourcetype earliest=X latest=Y | stats count 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Fill in the index and/or sourcetype that correspond to your LOG. &lt;BR /&gt;
Fill in the earliest and latest times that correspond to X and Y or use the time picker&lt;BR /&gt;
stats count gets you the count(*)&lt;/P&gt;

&lt;P&gt;select uniquecount(deviceGUID) from LOG start from X time till Y time &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=LOGindex sourectype=LOGsourcetype earliest=X latest=Y | stats dc(deviceGUID)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Same as the one above only use stats dc to get a distinct count&lt;/P&gt;

&lt;P&gt;"SELECT COUNT(DISTINCT e.account) FROM Log e WHERE e.launchPoint IN ?1 AND e.action = 'Tile Selection' AND e.assetId IS NULL AND e.destination LIKE 'page:%' AND e.dateTime BETWEEN ?2 AND ?3"&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=Logelocation sourcetype=Logesourcetype launchPoint=1 action="Title Selection" NOT assetId=* destination="*page:*" earliest="12/11/2012:20:00:00" latest="15/11/2012:20:00:00" | stats dc(e.account)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;index and/or sourcetype for the log as above.&lt;BR /&gt;
Your where criteria goes in the search (before the pipe)&lt;BR /&gt;
Using wildcards can mimic a LIKE search - destination="&lt;EM&gt;page:&lt;/EM&gt;" &lt;BR /&gt;
earliest and latest can be filled in as dates or as relative&lt;BR /&gt;
and then your distcint count&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 17:26:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Translate-sql-to-Splunk-search-language/m-p/355307#M5694</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2018-03-15T17:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Translate sql to Splunk search language</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Translate-sql-to-Splunk-search-language/m-p/355308#M5695</link>
      <description>&lt;P&gt;@kmaron Thank you for the quick response.  I'll give it a try.  &lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 19:36:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Translate-sql-to-Splunk-search-language/m-p/355308#M5695</guid>
      <dc:creator>dwong2</dc:creator>
      <dc:date>2018-03-15T19:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: Translate sql to Splunk search language</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Translate-sql-to-Splunk-search-language/m-p/355309#M5696</link>
      <description>&lt;P&gt;Did these work out for you?  If they did please accept my answer.&lt;BR /&gt;&lt;BR /&gt;
If not let me know so I can help. &lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 20:11:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Translate-sql-to-Splunk-search-language/m-p/355309#M5696</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2018-03-19T20:11:35Z</dc:date>
    </item>
  </channel>
</rss>

