<?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 Table keep last event by criteria in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Table-keep-last-event-by-criteria/m-p/491785#M137250</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I've a question regarding stat or eventstat option last.&lt;BR /&gt;
I would like to keep the last "event" in a table with several informations and I don't succeed.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dynatrace
| streamstats last("consumedHostUnits") by "vmwareName"
| eval FirstTime=strftime(firstSeenTimestamp/1000,"%d-%m-%Y %H:%M"), LastTime=strftime(lastSeenTimestamp/1000,"%d-%m-%Y %H:%M")
| table "vmwareName" "ipAddresses{}" "consumedHostUnits" "managementZones{}.name" monitoringMode FirstTime LastTime _time
| sort "consumedHostUnits" desc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I've 3 times a row for a server&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7992iEC6F3ECAE2E3401B/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;And if I use "stats" instead of "eventstats" I lost data for the others column&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dynatrace
| stats last("consumedHostUnits") as HU by "vmwareName"
| eval FirstTime=strftime(firstSeenTimestamp/1000,"%d-%m-%Y %H:%M"), LastTime=strftime(lastSeenTimestamp/1000,"%d-%m-%Y %H:%M")
| sort HU desc
| table "vmwareName" "ipAddresses{}" HU "managementZones{}.name" monitoringMode FirstTime LastTime _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7993i9215CA77DFE82FB9/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;What is the solution to have the first screenshot with only a single line as the second screenshot ?&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2019 17:34:59 GMT</pubDate>
    <dc:creator>erwanlebaron</dc:creator>
    <dc:date>2019-11-20T17:34:59Z</dc:date>
    <item>
      <title>Table keep last event by criteria</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-keep-last-event-by-criteria/m-p/491785#M137250</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I've a question regarding stat or eventstat option last.&lt;BR /&gt;
I would like to keep the last "event" in a table with several informations and I don't succeed.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dynatrace
| streamstats last("consumedHostUnits") by "vmwareName"
| eval FirstTime=strftime(firstSeenTimestamp/1000,"%d-%m-%Y %H:%M"), LastTime=strftime(lastSeenTimestamp/1000,"%d-%m-%Y %H:%M")
| table "vmwareName" "ipAddresses{}" "consumedHostUnits" "managementZones{}.name" monitoringMode FirstTime LastTime _time
| sort "consumedHostUnits" desc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I've 3 times a row for a server&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7992iEC6F3ECAE2E3401B/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;And if I use "stats" instead of "eventstats" I lost data for the others column&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dynatrace
| stats last("consumedHostUnits") as HU by "vmwareName"
| eval FirstTime=strftime(firstSeenTimestamp/1000,"%d-%m-%Y %H:%M"), LastTime=strftime(lastSeenTimestamp/1000,"%d-%m-%Y %H:%M")
| sort HU desc
| table "vmwareName" "ipAddresses{}" HU "managementZones{}.name" monitoringMode FirstTime LastTime _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7993i9215CA77DFE82FB9/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;What is the solution to have the first screenshot with only a single line as the second screenshot ?&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 17:34:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-keep-last-event-by-criteria/m-p/491785#M137250</guid>
      <dc:creator>erwanlebaron</dc:creator>
      <dc:date>2019-11-20T17:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: Table keep last event by criteria</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-keep-last-event-by-criteria/m-p/491786#M137251</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dynatrace 
| stats last("consumedHostUnits") as HU values(firstSeenTimestamp) as firstSeenTimestamp values(lastSeenTimestamp) as lastSeenTimestamp values("ipAddresses{}") as "ipAddresses{}" values("managementZones{}.name") as "managementZones{}.name" values(monitoringMode) as monitoringMode values(_time) as time by "vmwareName" 
| eval FirstTime=strftime(firstSeenTimestamp/1000,"%d-%m-%Y %H:%M"), LastTime=strftime(lastSeenTimestamp/1000,"%d-%m-%Y %H:%M") 
| convert ctime(time) as time 
| sort HU desc 
| table "vmwareName" "ipAddresses{}" HU "managementZones{}.name" monitoringMode FirstTime LastTime time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Nov 2019 18:27:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-keep-last-event-by-criteria/m-p/491786#M137251</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-11-20T18:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Table keep last event by criteria</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Table-keep-last-event-by-criteria/m-p/491787#M137252</link>
      <description>&lt;P&gt;I was exactly what I was looking for.&lt;BR /&gt;
I hadn't understood the "values" while using stats.&lt;/P&gt;

&lt;P&gt;Thanks a lot&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 08:17:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Table-keep-last-event-by-criteria/m-p/491787#M137252</guid>
      <dc:creator>erwanlebaron</dc:creator>
      <dc:date>2019-11-21T08:17:40Z</dc:date>
    </item>
  </channel>
</rss>

