<?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 use head command at the end if we have multiple joins in a search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-head-command-at-the-end-if-we-have-multiple-joins-in/m-p/377167#M110663</link>
    <description>&lt;P&gt;Hi @kmaron  , yes i have used that, but it did not worked out&lt;/P&gt;</description>
    <pubDate>Wed, 07 Nov 2018 07:03:46 GMT</pubDate>
    <dc:creator>Akumar294</dc:creator>
    <dc:date>2018-11-07T07:03:46Z</dc:date>
    <item>
      <title>How to use head command at the end if we have multiple joins in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-head-command-at-the-end-if-we-have-multiple-joins-in/m-p/377165#M110661</link>
      <description>&lt;P&gt;Hello Guys,&lt;/P&gt;

&lt;P&gt;I have a search in which i am using different join commands(4 join commands) and finally at the end, i will be getting some thousands records. But what i want is - to get the most recent event by doing a head 1 or head 10 based on &lt;STRONG&gt;most recent timestamp&lt;/STRONG&gt;.&lt;BR /&gt;
Below search should just return 1 record based on latest time stamp as i have used head 1 at the end, but it seems head is not doing any job at all, i get the same number of events if i remove head 1. Does head doesn't work with join?&lt;BR /&gt;
Please suggest&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="pi_sales_monitoring_agent_nonprod" sourcetype=PS_dev-tes-mtr*
|search "pms_01_zip_rename"
|rex field=_raw "\.(?&amp;lt;Job_Number&amp;gt;\d\d\d\d\d\d\d)\."
|transaction Job_Number mvraw=true
|search "completed message sent" AND pmall
|eval myRaw = _raw
|mvexpand myRaw 
|rename myRaw as _raw
|search "completed message sent"
|stats count as c1
|join[search index="pi_sales_monitoring_agent_nonprod" sourcetype=PS_dev-tes-mtr*  "pms_01_zip_rename"
|rex field=_raw "\.(?&amp;lt;Job_Number&amp;gt;\d\d\d\d\d\d\d)\."
|transaction Job_Number mvraw=true
|search "completed abnormally message sent" AND pmall
|eval myRaw = _raw
|mvexpand myRaw 
|rename myRaw as _raw
|search "completed abnormally message sent"
|stats count as c2]
|join[search index="pi_sales_monitoring_agent_nonprod" sourcetype=PS_dev-tes-mtr*  "pms_01_zip_rename"
|rex field=_raw "\.(?&amp;lt;Job_Number&amp;gt;\d\d\d\d\d\d\d)\."
|transaction Job_Number mvraw=true
|search ((NOT "Complete") AND (NOT "Completed abnormally")) AND pmall
|eval myRaw = _raw
|mvexpand myRaw 
|rename myRaw as _raw
|search ((NOT "Complete") AND (NOT "Completed abnormally"))
|stats count as c3]
|join[search index="pi_sales_monitoring_agent_nonprod" sourcetype=PS_dev-tes-mtr*  "pms_01_zip_rename"
|rex field=_raw "\.(?&amp;lt;Job_Number&amp;gt;\d\d\d\d\d\d\d)\."
|transaction Job_Number
|search pmall
|stats count as c4]
|head 1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Nov 2018 09:55:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-head-command-at-the-end-if-we-have-multiple-joins-in/m-p/377165#M110661</guid>
      <dc:creator>Akumar294</dc:creator>
      <dc:date>2018-11-06T09:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to use head command at the end if we have multiple joins in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-head-command-at-the-end-if-we-have-multiple-joins-in/m-p/377166#M110662</link>
      <description>&lt;P&gt;Have you tried using append instead of join?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Nov 2018 14:14:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-head-command-at-the-end-if-we-have-multiple-joins-in/m-p/377166#M110662</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2018-11-06T14:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to use head command at the end if we have multiple joins in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-head-command-at-the-end-if-we-have-multiple-joins-in/m-p/377167#M110663</link>
      <description>&lt;P&gt;Hi @kmaron  , yes i have used that, but it did not worked out&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 07:03:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-head-command-at-the-end-if-we-have-multiple-joins-in/m-p/377167#M110663</guid>
      <dc:creator>Akumar294</dc:creator>
      <dc:date>2018-11-07T07:03:46Z</dc:date>
    </item>
  </channel>
</rss>

