<?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: |metadata - Need results for Custom time range in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/metadata-Need-results-for-Custom-time-range/m-p/138347#M37957</link>
    <description>&lt;P&gt;No, not really. Time range for metadata only affects which entries that will be returned based on recentTime and lastTime.&lt;/P&gt;

&lt;P&gt;May I suggest another option - use &lt;CODE&gt;metasearch&lt;/CODE&gt; instead. As a bonus this also enables you to split your stats by multiple fields if you want (so for instance you could do stats count by host,sourcetype). This query should give you something similar to what you get with &lt;CODE&gt;metadata&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metasearch earliest=-1d | stats latest(_time) as lastTime,count by host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 11 Jul 2014 06:45:34 GMT</pubDate>
    <dc:creator>Ayn</dc:creator>
    <dc:date>2014-07-11T06:45:34Z</dc:date>
    <item>
      <title>|metadata - Need results for Custom time range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/metadata-Need-results-for-Custom-time-range/m-p/138346#M37956</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;|metadata type=hosts earliest=-1d latest=now
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This displays the overall eventcounts for the available hosts but not specific to the time range mentioned.&lt;BR /&gt;
Is there a way to specify the time range for metadata results ?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jul 2014 06:08:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/metadata-Need-results-for-Custom-time-range/m-p/138346#M37956</guid>
      <dc:creator>splunker12er</dc:creator>
      <dc:date>2014-07-11T06:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: |metadata - Need results for Custom time range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/metadata-Need-results-for-Custom-time-range/m-p/138347#M37957</link>
      <description>&lt;P&gt;No, not really. Time range for metadata only affects which entries that will be returned based on recentTime and lastTime.&lt;/P&gt;

&lt;P&gt;May I suggest another option - use &lt;CODE&gt;metasearch&lt;/CODE&gt; instead. As a bonus this also enables you to split your stats by multiple fields if you want (so for instance you could do stats count by host,sourcetype). This query should give you something similar to what you get with &lt;CODE&gt;metadata&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metasearch earliest=-1d | stats latest(_time) as lastTime,count by host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Jul 2014 06:45:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/metadata-Need-results-for-Custom-time-range/m-p/138347#M37957</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2014-07-11T06:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: |metadata - Need results for Custom time range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/metadata-Need-results-for-Custom-time-range/m-p/138348#M37958</link>
      <description>&lt;P&gt;That doesn't seem to work for me anyway.  If I put that in, not matter what  it's ignored.  Rather, whatever I select from the time picker is the time actually queried.  Any idea why?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2016 20:26:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/metadata-Need-results-for-Custom-time-range/m-p/138348#M37958</guid>
      <dc:creator>mendesjo</dc:creator>
      <dc:date>2016-02-17T20:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: |metadata - Need results for Custom time range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/metadata-Need-results-for-Custom-time-range/m-p/138349#M37959</link>
      <description>&lt;P&gt;If you're on version 6.x, the you can use tstats command to generate metadata stats, which is time bound and much faster (then regular search). Following is the equivalent to metadata search&lt;/P&gt;

&lt;P&gt;metadata search    &lt;CODE&gt;| metadata type=hosts index=*&lt;/CODE&gt; &lt;BR /&gt;
tstats search            &lt;CODE&gt;| tstats count as totalCount min(_time) as firstTime max(_time) as lastTime WHERE index=* by host | eval recentTime=lastTime | eval type="hosts"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2016 20:48:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/metadata-Need-results-for-Custom-time-range/m-p/138349#M37959</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-02-17T20:48:06Z</dc:date>
    </item>
  </channel>
</rss>

