<?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: i have a join query which i need to optimize using OR and Stats, Since i am dealing with timestamp and fetching last(field), i am struggling, Can any one help? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/i-have-a-join-query-which-i-need-to-optimize-using-OR-and-Stats/m-p/403373#M116724</link>
    <description>&lt;P&gt;yes. I figure it out later.  it's working perfectly. Thanks a lot.&lt;/P&gt;</description>
    <pubDate>Tue, 02 Oct 2018 17:01:49 GMT</pubDate>
    <dc:creator>m4sucess</dc:creator>
    <dc:date>2018-10-02T17:01:49Z</dc:date>
    <item>
      <title>i have a join query which i need to optimize using OR and Stats, Since i am dealing with timestamp and fetching last(field), i am struggling, Can any one help?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/i-have-a-join-query-which-i-need-to-optimize-using-OR-and-Stats/m-p/403367#M116718</link>
      <description>&lt;P&gt;index="index1  sourcetype="sourcetype1"&lt;BR /&gt;
| join deviceId [ search index="index2" sourcetype="sourcetype2" productFamily="xyz" ] &lt;BR /&gt;
| where productFamily="xyz"&lt;BR /&gt;
| sort _time&lt;BR /&gt;
| stats last(p2mp) as p2mp by deviceName&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;index1 has fields like deviceId,p2mp,deviceName&lt;BR /&gt;
index2 has fields like productFamily,deviceId&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I want to remove join, want to rebuild the optimized query which doesn't have job, append,sub search etc. Just OR, stats, eval ..&lt;BR /&gt;
I am trying with maintaining timestamp because I am using last keyword here and after doing OR and stats, all the data mixed up and I am not getting the result which I want. Can anyone help me??&lt;/P&gt;</description>
      <pubDate>Sat, 29 Sep 2018 05:42:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/i-have-a-join-query-which-i-need-to-optimize-using-OR-and-Stats/m-p/403367#M116718</guid>
      <dc:creator>m4sucess</dc:creator>
      <dc:date>2018-09-29T05:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: i have a join query which i need to optimize using OR and Stats, Since i am dealing with timestamp and fetching last(field), i am struggling, Can any one help?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/i-have-a-join-query-which-i-need-to-optimize-using-OR-and-Stats/m-p/403368#M116719</link>
      <description>&lt;P&gt;@m4sucess,&lt;BR /&gt;
Based on few assumptions, does this work in your case,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=index1 OR index=index2) (sourcetype="sourcetype1" OR sourcetype="sourcetype2")
|stats latest(p2mp) as p2mp,latest(deviceName) as deviceName,latest(productFamily) as productFamily by deviceId
|where productFamily="xyz"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Sep 2018 06:18:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/i-have-a-join-query-which-i-need-to-optimize-using-OR-and-Stats/m-p/403368#M116719</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-09-29T06:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: i have a join query which i need to optimize using OR and Stats, Since i am dealing with timestamp and fetching last(field), i am struggling, Can any one help?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/i-have-a-join-query-which-i-need-to-optimize-using-OR-and-Stats/m-p/403369#M116720</link>
      <description>&lt;P&gt;It's not working, i want last value of p2mp based on index1's timestamp. problem is once i got stats, everything is messed up, all the multivalues are combined in every field based on deviceid and then it's giving wrong output for last(field)&lt;/P&gt;</description>
      <pubDate>Sat, 29 Sep 2018 06:20:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/i-have-a-join-query-which-i-need-to-optimize-using-OR-and-Stats/m-p/403369#M116720</guid>
      <dc:creator>m4sucess</dc:creator>
      <dc:date>2018-09-29T06:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: i have a join query which i need to optimize using OR and Stats, Since i am dealing with timestamp and fetching last(field), i am struggling, Can any one help?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/i-have-a-join-query-which-i-need-to-optimize-using-OR-and-Stats/m-p/403370#M116721</link>
      <description>&lt;P&gt;what about adding below before stats?Does that bring us closer?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; |eval index1_time=if(index=="index1",_time,null())
 |eventstats latest(p2mp) as  p2mp by deviceId,index1_time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Sep 2018 07:25:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/i-have-a-join-query-which-i-need-to-optimize-using-OR-and-Stats/m-p/403370#M116721</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-09-29T07:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: i have a join query which i need to optimize using OR and Stats, Since i am dealing with timestamp and fetching last(field), i am struggling, Can any one help?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/i-have-a-join-query-which-i-need-to-optimize-using-OR-and-Stats/m-p/403371#M116722</link>
      <description>&lt;P&gt;Hi renjith, just want to understand, my requirement is to perform last, but you are using latest, why so??&lt;/P&gt;</description>
      <pubDate>Sat, 29 Sep 2018 07:31:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/i-have-a-join-query-which-i-need-to-optimize-using-OR-and-Stats/m-p/403371#M116722</guid>
      <dc:creator>m4sucess</dc:creator>
      <dc:date>2018-09-29T07:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: i have a join query which i need to optimize using OR and Stats, Since i am dealing with timestamp and fetching last(field), i am struggling, Can any one help?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/i-have-a-join-query-which-i-need-to-optimize-using-OR-and-Stats/m-p/403372#M116723</link>
      <description>&lt;P&gt;@m4sucess, you are ordering the time using sort _time which will order the events in and display the oldest event as first event. Then you are using last which brings you the last event which is actually the latest event. Instead of that I am using latest to bring back the latest event. You shall run a sample search to confirm&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal earliest=-15m|sort _time|stats last(_time) as last_time,latest(_time) as latest_time)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Oct 2018 16:20:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/i-have-a-join-query-which-i-need-to-optimize-using-OR-and-Stats/m-p/403372#M116723</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-10-01T16:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: i have a join query which i need to optimize using OR and Stats, Since i am dealing with timestamp and fetching last(field), i am struggling, Can any one help?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/i-have-a-join-query-which-i-need-to-optimize-using-OR-and-Stats/m-p/403373#M116724</link>
      <description>&lt;P&gt;yes. I figure it out later.  it's working perfectly. Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 17:01:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/i-have-a-join-query-which-i-need-to-optimize-using-OR-and-Stats/m-p/403373#M116724</guid>
      <dc:creator>m4sucess</dc:creator>
      <dc:date>2018-10-02T17:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: i have a join query which i need to optimize using OR and Stats, Since i am dealing with timestamp and fetching last(field), i am struggling, Can any one help?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/i-have-a-join-query-which-i-need-to-optimize-using-OR-and-Stats/m-p/403374#M116725</link>
      <description>&lt;P&gt;@m4sucess, if it resolved your question, please accept as answer to close this thread. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 17:37:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/i-have-a-join-query-which-i-need-to-optimize-using-OR-and-Stats/m-p/403374#M116725</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-10-03T17:37:02Z</dc:date>
    </item>
  </channel>
</rss>

