<?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 search for earlier events for a given field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-earlier-events-for-a-given-field/m-p/283525#M85680</link>
    <description>&lt;P&gt;when I do the search "dex=allevents sourcetype=somelogs | stats earliest(_time) as firstevent by user" i get all the users with a field 'firstevent' wich is a string of numbers and I can't quite make out what this means. &lt;/P&gt;</description>
    <pubDate>Tue, 26 Jul 2016 17:20:51 GMT</pubDate>
    <dc:creator>pladamsplunk</dc:creator>
    <dc:date>2016-07-26T17:20:51Z</dc:date>
    <item>
      <title>How to search for earlier events for a given field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-earlier-events-for-a-given-field/m-p/283523#M85678</link>
      <description>&lt;P&gt;I'm trying to create a report which will find the number of 'new users'. I've extracted the field &lt;STRONG&gt;user&lt;/STRONG&gt;. I want to find the earliest event generated for every given user within the user field, and then create the restriction to only show the number of users whose first events were created within some recent time. This number will be the number of new users. Can anyone help me create a search to accomplish this goal?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 17:12:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-earlier-events-for-a-given-field/m-p/283523#M85678</guid>
      <dc:creator>pladamsplunk</dc:creator>
      <dc:date>2016-07-26T17:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for earlier events for a given field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-earlier-events-for-a-given-field/m-p/283524#M85679</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=allevents sourcetype=somelogs | stats earliest(_time) as firstevent by user | where _time&amp;gt;some_recent_time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Jul 2016 17:15:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-earlier-events-for-a-given-field/m-p/283524#M85679</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-26T17:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for earlier events for a given field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-earlier-events-for-a-given-field/m-p/283525#M85680</link>
      <description>&lt;P&gt;when I do the search "dex=allevents sourcetype=somelogs | stats earliest(_time) as firstevent by user" i get all the users with a field 'firstevent' wich is a string of numbers and I can't quite make out what this means. &lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 17:20:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-earlier-events-for-a-given-field/m-p/283525#M85680</guid>
      <dc:creator>pladamsplunk</dc:creator>
      <dc:date>2016-07-26T17:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for earlier events for a given field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-earlier-events-for-a-given-field/m-p/283526#M85681</link>
      <description>&lt;P&gt;The string of numbers is epoch time, You can format the time like this. I would recommend you leave it as epoch to do the time compare and then change to readable format. (.... depicts your current search)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | eval firstevent=strftime(firstevent, "%c")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To filter based on time, you could try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | where firstevent&amp;gt;relative_time(now(), "-1mon") | eval firstevent=strftime(firstevent, "%x %X")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Jul 2016 17:27:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-earlier-events-for-a-given-field/m-p/283526#M85681</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-26T17:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for earlier events for a given field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-earlier-events-for-a-given-field/m-p/283527#M85682</link>
      <description>&lt;P&gt;.... | where firstevent&amp;gt;relative_time(now(), "-1mon") | eval firstevent=strftime(firstevent, "%x %X")&lt;/P&gt;

&lt;P&gt;This command will compare the current date stored in splunk against the -1mon (or whatever is here) correct?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 17:32:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-earlier-events-for-a-given-field/m-p/283527#M85682</guid>
      <dc:creator>pladamsplunk</dc:creator>
      <dc:date>2016-07-26T17:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for earlier events for a given field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-earlier-events-for-a-given-field/m-p/283528#M85683</link>
      <description>&lt;P&gt;That's Correct&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 17:33:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-earlier-events-for-a-given-field/m-p/283528#M85683</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-26T17:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for earlier events for a given field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-earlier-events-for-a-given-field/m-p/283529#M85684</link>
      <description>&lt;P&gt;It all works thank you very much, up voted!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 17:55:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-earlier-events-for-a-given-field/m-p/283529#M85684</guid>
      <dc:creator>pladamsplunk</dc:creator>
      <dc:date>2016-07-26T17:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for earlier events for a given field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-earlier-events-for-a-given-field/m-p/283530#M85685</link>
      <description>&lt;P&gt;Please mark the answer as accepted to close it out.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 17:56:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-earlier-events-for-a-given-field/m-p/283530#M85685</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-26T17:56:23Z</dc:date>
    </item>
  </channel>
</rss>

