<?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 Adding the most recent _indextime/_time to results table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Adding-the-most-recent-indextime-time-to-results-table/m-p/468209#M131807</link>
    <description>&lt;P&gt;We are attempting to write a report querying multiple indexes, which creates a table using data from each. Our challenge is... When we add &lt;STRONG&gt;indextime&lt;/STRONG&gt; or &lt;STRONG&gt;_time&lt;/STRONG&gt; the report shows all the &lt;STRONG&gt;indextime&lt;/STRONG&gt; for each system in the date range selected. Instead, we want to show only the latest indextime/_time in the report only for each system.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=* sourcetype=ActiveDirectory objectCategory="CN=Computer,CN=Schema,CN=Configuration,DC=foo,DC=com") OR (index=windows DisplayName="BitLocker Drive Encryption Service" source="kiwi syslog server")

| eval indextime=strftime(_indextime,"%Y-%m-%d %H:%M:%S")

| eval cn=coalesce(cn,host) | stats values(*) AS * BY cn | search cn=* host=*
       NOT [inputlookup All_Virtual_Machines.csv | rename Name as cn]
| where StartMode!="" AND operatingSystem!="" AND Started!="true"
| rename cn as System, operatingSystem as OS 
| dedup System 

| table System StartMode State Started OS indextime | sort System
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 03 Apr 2020 15:39:15 GMT</pubDate>
    <dc:creator>lbrhyne</dc:creator>
    <dc:date>2020-04-03T15:39:15Z</dc:date>
    <item>
      <title>Adding the most recent _indextime/_time to results table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-the-most-recent-indextime-time-to-results-table/m-p/468209#M131807</link>
      <description>&lt;P&gt;We are attempting to write a report querying multiple indexes, which creates a table using data from each. Our challenge is... When we add &lt;STRONG&gt;indextime&lt;/STRONG&gt; or &lt;STRONG&gt;_time&lt;/STRONG&gt; the report shows all the &lt;STRONG&gt;indextime&lt;/STRONG&gt; for each system in the date range selected. Instead, we want to show only the latest indextime/_time in the report only for each system.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=* sourcetype=ActiveDirectory objectCategory="CN=Computer,CN=Schema,CN=Configuration,DC=foo,DC=com") OR (index=windows DisplayName="BitLocker Drive Encryption Service" source="kiwi syslog server")

| eval indextime=strftime(_indextime,"%Y-%m-%d %H:%M:%S")

| eval cn=coalesce(cn,host) | stats values(*) AS * BY cn | search cn=* host=*
       NOT [inputlookup All_Virtual_Machines.csv | rename Name as cn]
| where StartMode!="" AND operatingSystem!="" AND Started!="true"
| rename cn as System, operatingSystem as OS 
| dedup System 

| table System StartMode State Started OS indextime | sort System
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Apr 2020 15:39:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-the-most-recent-indextime-time-to-results-table/m-p/468209#M131807</guid>
      <dc:creator>lbrhyne</dc:creator>
      <dc:date>2020-04-03T15:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: Adding the most recent _indextime/_time to results table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-the-most-recent-indextime-time-to-results-table/m-p/468210#M131808</link>
      <description>&lt;P&gt;It's because you're doing a values(*) in your stats command, which is bringing in every index time. If any of the other fields end up having more than one value, it'll also do the same thing for those. &lt;/P&gt;

&lt;P&gt;try doing - using max(_indextime) in the stats command and moving the strftime to the bottom.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=* sourcetype=ActiveDirectory objectCategory="CN=Computer,CN=Schema,CN=Configuration,DC=g1net,DC=com") OR (index=windows DisplayName="BitLocker Drive Encryption Service" source="kiwi syslog server")
 | eval cn=coalesce(cn,host) | stats values(*) AS * max(_indextime) as indextime BY cn | search cn=* host=*
        NOT [inputlookup All_Virtual_Machines.csv | rename Name as cn]
 | where StartMode!="" AND operatingSystem!="" AND Started!="true"
 | rename cn as System, operatingSystem as OS 
 | dedup System 
 | table System StartMode State Started OS indextime | eval indextime=strftime(indextime,"%Y-%m-%d %H:%M:%S")| sort System
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 04 Apr 2020 01:30:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-the-most-recent-indextime-time-to-results-table/m-p/468210#M131808</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2020-04-04T01:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: Adding the most recent _indextime/_time to results table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-the-most-recent-indextime-time-to-results-table/m-p/468211#M131809</link>
      <description>&lt;P&gt;Thank you cmerriman! That worked perfectly! I simply copied and pasted your revisions and it worked!&lt;/P&gt;</description>
      <pubDate>Sat, 04 Apr 2020 14:24:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-the-most-recent-indextime-time-to-results-table/m-p/468211#M131809</guid>
      <dc:creator>lbrhyne</dc:creator>
      <dc:date>2020-04-04T14:24:11Z</dc:date>
    </item>
  </channel>
</rss>

