<?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 find the latest field only from multiple output in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/find-the-latest-field-only-from-multiple-output/m-p/535473#M151334</link>
    <description>&lt;P&gt;I have a query like below :&lt;/P&gt;&lt;P&gt;bla bla ...| lookup mylookupfile.csv Hostname as Name output Status Creation_Date&lt;BR /&gt;| eval Status=MVDEDUP(Status) |eval Creation_Date=mvindex(Creation_Date,-1)| then rest of my query&lt;/P&gt;&lt;P&gt;Here issue happens when while matching for the Hostname i get two Status values&amp;nbsp;&lt;/P&gt;&lt;P&gt;So above query gives me output where :&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) i am getting Creation_Date field as the latest date only&lt;/P&gt;&lt;P&gt;2) But Status i am receiving both Active and Destroyed&lt;/P&gt;&lt;P&gt;i want to get in Status field only the corresponding value of Status for latest(Creation_Date)&lt;/P&gt;&lt;P&gt;How can i do that&lt;/P&gt;</description>
    <pubDate>Tue, 12 Jan 2021 12:56:22 GMT</pubDate>
    <dc:creator>surekhasplunk</dc:creator>
    <dc:date>2021-01-12T12:56:22Z</dc:date>
    <item>
      <title>find the latest field only from multiple output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/find-the-latest-field-only-from-multiple-output/m-p/535473#M151334</link>
      <description>&lt;P&gt;I have a query like below :&lt;/P&gt;&lt;P&gt;bla bla ...| lookup mylookupfile.csv Hostname as Name output Status Creation_Date&lt;BR /&gt;| eval Status=MVDEDUP(Status) |eval Creation_Date=mvindex(Creation_Date,-1)| then rest of my query&lt;/P&gt;&lt;P&gt;Here issue happens when while matching for the Hostname i get two Status values&amp;nbsp;&lt;/P&gt;&lt;P&gt;So above query gives me output where :&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) i am getting Creation_Date field as the latest date only&lt;/P&gt;&lt;P&gt;2) But Status i am receiving both Active and Destroyed&lt;/P&gt;&lt;P&gt;i want to get in Status field only the corresponding value of Status for latest(Creation_Date)&lt;/P&gt;&lt;P&gt;How can i do that&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 12:56:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/find-the-latest-field-only-from-multiple-output/m-p/535473#M151334</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2021-01-12T12:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: find the latest field only from multiple output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/find-the-latest-field-only-from-multiple-output/m-p/535490#M151343</link>
      <description>&lt;P&gt;If I understand the problem correctly then this should help.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;bla bla ...| lookup mylookupfile.csv Hostname as Name output Status Creation_Date
| eval created = strptime(Creation_Date, "format string that matches the date format")
| sort 1000 - created
| fields - created
| head 1
| then rest of my query&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;The lookup file already associates Status with Creation_Date so all the query needs to do is find the most recent Creation_Date value.&amp;nbsp; We do that by converting the Creation_Date field to epoch form (assuming it is not already an epoch) then sorting the dates in descending order.&amp;nbsp; The first event in the results is the latest date.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 14:58:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/find-the-latest-field-only-from-multiple-output/m-p/535490#M151343</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-01-12T14:58:46Z</dc:date>
    </item>
  </channel>
</rss>

