<?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: How to use the metadata command to search for hosts that have recently started sending data to Splunk? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-use-the-metadata-command-to-search-for-hosts-that-have/m-p/271429#M52117</link>
    <description>&lt;P&gt;Calculate the age of the firstTime&lt;BR /&gt;
Evaluate against 7d value&lt;BR /&gt;
7 days = 604800 seconds&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type=hosts index=_internal | eval age=now()-firstTime | where age&amp;lt;604800
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 26 May 2016 21:57:06 GMT</pubDate>
    <dc:creator>the_wolverine</dc:creator>
    <dc:date>2016-05-26T21:57:06Z</dc:date>
    <item>
      <title>How to use the metadata command to search for hosts that have recently started sending data to Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-use-the-metadata-command-to-search-for-hosts-that-have/m-p/271427#M52115</link>
      <description>&lt;P&gt;I'm trying to use the &lt;CODE&gt;metadata&lt;/CODE&gt; command to find hosts that have recently started sending logs.  Basically when firstTime is more recent than 7 days.  This is the search I have...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type=hosts index=* | eval firstday=strftime(firstTime,"%Y-%m-%d") | where firstday&amp;gt;=relative_time(now(),"-7d")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have tried many variations of this, to no avail.  The 'firstday' field shows accurately, but the results are not filtered.  Is there something I don't understand about this metadata command?  I appreciate the help!&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 21:29:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-use-the-metadata-command-to-search-for-hosts-that-have/m-p/271427#M52115</guid>
      <dc:creator>jbullough</dc:creator>
      <dc:date>2016-05-26T21:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the metadata command to search for hosts that have recently started sending data to Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-use-the-metadata-command-to-search-for-hosts-that-have/m-p/271428#M52116</link>
      <description>&lt;P&gt;firstTime is epoch&lt;BR /&gt;
firstday is string&lt;BR /&gt;
relative_time is epoch&lt;/P&gt;

&lt;P&gt;Simply do it this way:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | metadata type=hosts index=* | where firstTime &amp;gt;= relative_time(now(),"-7d")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 May 2016 21:55:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-use-the-metadata-command-to-search-for-hosts-that-have/m-p/271428#M52116</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-05-26T21:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the metadata command to search for hosts that have recently started sending data to Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-use-the-metadata-command-to-search-for-hosts-that-have/m-p/271429#M52117</link>
      <description>&lt;P&gt;Calculate the age of the firstTime&lt;BR /&gt;
Evaluate against 7d value&lt;BR /&gt;
7 days = 604800 seconds&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type=hosts index=_internal | eval age=now()-firstTime | where age&amp;lt;604800
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 May 2016 21:57:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-use-the-metadata-command-to-search-for-hosts-that-have/m-p/271429#M52117</guid>
      <dc:creator>the_wolverine</dc:creator>
      <dc:date>2016-05-26T21:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the metadata command to search for hosts that have recently started sending data to Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-use-the-metadata-command-to-search-for-hosts-that-have/m-p/271430#M52118</link>
      <description>&lt;P&gt;Wow, I was afraid it was something simple.  This worked perfectly, thanks!!&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 22:30:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-use-the-metadata-command-to-search-for-hosts-that-have/m-p/271430#M52118</guid>
      <dc:creator>jbullough</dc:creator>
      <dc:date>2016-05-26T22:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the metadata command to search for hosts that have recently started sending data to Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-use-the-metadata-command-to-search-for-hosts-that-have/m-p/271431#M52119</link>
      <description>&lt;P&gt;Actually this gave what appears to be more accurate results.  I'll have to see why the other answer isn't giving exactly accurate results.  Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 22:33:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-use-the-metadata-command-to-search-for-hosts-that-have/m-p/271431#M52119</guid>
      <dc:creator>jbullough</dc:creator>
      <dc:date>2016-05-26T22:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the metadata command to search for hosts that have recently started sending data to Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-use-the-metadata-command-to-search-for-hosts-that-have/m-p/271432#M52120</link>
      <description>&lt;P&gt;This looked right, but after trying the answer below the results are different, and it looks like it's producing more accurate results.  I'll dig into why.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 22:34:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-use-the-metadata-command-to-search-for-hosts-that-have/m-p/271432#M52120</guid>
      <dc:creator>jbullough</dc:creator>
      <dc:date>2016-05-26T22:34:37Z</dc:date>
    </item>
  </channel>
</rss>

