<?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 How to merge eventcount output of indexes with stats call to max(_indextime)? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434206#M123944</link>
    <description>&lt;P&gt;I want to query splunk so that it can find all index names that do not have _ at the beginning and query for the max(_indextime) for each of them in an efficient way. However, I have been running into problems with structuring the query correctly. I wrote two queries that I need to combine:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| eventcount summarize=false index=* | fields index | dedup index&lt;/CODE&gt; which gives me all of the indexes that I want&lt;/P&gt;

&lt;P&gt;AND&lt;BR /&gt;
&lt;CODE&gt;| search index=* | fields + _indextime | stats max(_indextime) as max_time | convert ctime(max_time)&lt;/CODE&gt; which gives me the max time that I want&lt;/P&gt;

&lt;P&gt;After a lot of searches, I tried to combine them in the following way"&lt;BR /&gt;
&lt;CODE&gt;| eventcount summarize=false index=* | fields index | dedup index | stats max(_indextime) by index&lt;/CODE&gt;, which gives me a table of the correct indexes and an empty column of max(_indextime):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;-----index-----|-----max(_indextime)-----
index1
index2
index3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I would want is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;-----index-----|-----max(_indextime) (should be ctime(max(_indextime)))-----
index1..........|...07/10/2018 11:00:00
index2..........|...07/10/2018 11:04:00
index3..........|...07/09/2018 05:00:00
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I go about connecting these two queries? I have a feeling that I'm making some wrong assumptions about how to feed only the index name into the second query, but I'm not sure how to rectify them. If I can feed the indexes to search index={index} that would be fantastic, otherwise, if there's a way to make it more efficient with a single query to give me what I want, that would be even more great.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
-EV&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jul 2018 15:49:06 GMT</pubDate>
    <dc:creator>evuk</dc:creator>
    <dc:date>2018-07-10T15:49:06Z</dc:date>
    <item>
      <title>How to merge eventcount output of indexes with stats call to max(_indextime)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434206#M123944</link>
      <description>&lt;P&gt;I want to query splunk so that it can find all index names that do not have _ at the beginning and query for the max(_indextime) for each of them in an efficient way. However, I have been running into problems with structuring the query correctly. I wrote two queries that I need to combine:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| eventcount summarize=false index=* | fields index | dedup index&lt;/CODE&gt; which gives me all of the indexes that I want&lt;/P&gt;

&lt;P&gt;AND&lt;BR /&gt;
&lt;CODE&gt;| search index=* | fields + _indextime | stats max(_indextime) as max_time | convert ctime(max_time)&lt;/CODE&gt; which gives me the max time that I want&lt;/P&gt;

&lt;P&gt;After a lot of searches, I tried to combine them in the following way"&lt;BR /&gt;
&lt;CODE&gt;| eventcount summarize=false index=* | fields index | dedup index | stats max(_indextime) by index&lt;/CODE&gt;, which gives me a table of the correct indexes and an empty column of max(_indextime):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;-----index-----|-----max(_indextime)-----
index1
index2
index3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I would want is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;-----index-----|-----max(_indextime) (should be ctime(max(_indextime)))-----
index1..........|...07/10/2018 11:00:00
index2..........|...07/10/2018 11:04:00
index3..........|...07/09/2018 05:00:00
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I go about connecting these two queries? I have a feeling that I'm making some wrong assumptions about how to feed only the index name into the second query, but I'm not sure how to rectify them. If I can feed the indexes to search index={index} that would be fantastic, otherwise, if there's a way to make it more efficient with a single query to give me what I want, that would be even more great.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
-EV&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 15:49:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434206#M123944</guid>
      <dc:creator>evuk</dc:creator>
      <dc:date>2018-07-10T15:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge eventcount output of indexes with stats call to max(_indextime)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434207#M123945</link>
      <description>&lt;P&gt;Hi @evuk,&lt;/P&gt;

&lt;P&gt;Try this,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    |tstats max(_indextime) as max_time where index=* by index|convert ctime(max_time)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Jul 2018 16:12:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434207#M123945</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-07-10T16:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge eventcount output of indexes with stats call to max(_indextime)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434208#M123946</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats max(_indextime) AS max_time WHERE NOT index="_*" BY index
| convert ctime(max_time)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Jul 2018 16:39:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434208#M123946</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-10T16:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge eventcount output of indexes with stats call to max(_indextime)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434209#M123947</link>
      <description>&lt;P&gt;I'm not sure how this is possible, but the above is only giving me &lt;EM&gt;indexnames; it's somehow not registering the NOT part. I also tried parentheses around the NOT index="&lt;/EM&gt;*" part, which gave me the same thing as the above.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 17:23:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434209#M123947</guid>
      <dc:creator>evuk</dc:creator>
      <dc:date>2018-07-10T17:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge eventcount output of indexes with stats call to max(_indextime)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434210#M123948</link>
      <description>&lt;P&gt;This seems to work fine (but it gives me less indexes than exist as compared to the search in the original posting), but it is rather slow. Is there any way to speed it up and not have it look through all events? I can narrow down the time, but is there something that can optimize it so that it can be faster and start doing a backwards search for the latest time instead of looking through all indexes' times?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 17:24:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434210#M123948</guid>
      <dc:creator>evuk</dc:creator>
      <dc:date>2018-07-10T17:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge eventcount output of indexes with stats call to max(_indextime)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434211#M123949</link>
      <description>&lt;P&gt;Are you running it for all times time range? That would be slow in anyways.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 17:33:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434211#M123949</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-07-10T17:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge eventcount output of indexes with stats call to max(_indextime)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434212#M123950</link>
      <description>&lt;P&gt;yes because some indexes are current and others are not. I'm both trying to monitor and export the latest data. The goal is to show only the latest data since the last time that the user has looked at the data, so I may have to search for the latest data within a day or a month or anything else.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 17:38:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434212#M123950</guid>
      <dc:creator>evuk</dc:creator>
      <dc:date>2018-07-10T17:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge eventcount output of indexes with stats call to max(_indextime)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434213#M123951</link>
      <description>&lt;P&gt;Hi @evuk,&lt;BR /&gt;
Try tunning the tstats with admin privs. Can you compare what's missing in tstats and in your original search ? Mostly it should be some summary indexes&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 02:45:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434213#M123951</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-07-11T02:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge eventcount output of indexes with stats call to max(_indextime)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434214#M123952</link>
      <description>&lt;P&gt;Some of our indexes appear to collect data sporadically, so that's what's causing it. Thanks for your answer! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 14:02:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-eventcount-output-of-indexes-with-stats-call-to-max/m-p/434214#M123952</guid>
      <dc:creator>evuk</dc:creator>
      <dc:date>2018-07-11T14:02:47Z</dc:date>
    </item>
  </channel>
</rss>

