<?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 Search for first event in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382904#M111855</link>
    <description>&lt;P&gt;I would like to write a search of traffic data that will return _time,user,src_ip for the first occurrence.  However, it is highly probably that a user will have multiple src_ip.  (eg A user logins into a PC and a WiFi device).&lt;/P&gt;

&lt;P&gt;So I am looking for a list of unique user / src_ip combinations showing the earliest instance the combination exists.  &lt;/P&gt;

&lt;P&gt;I currently have:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;index="pan" (user="*\user1" AND &amp;gt; src_ip="192.168.*")&lt;BR /&gt;&lt;BR /&gt;
| stats  earliest(_time) as firstEvent count by src_ip,user&lt;BR /&gt;&lt;BR /&gt;
| table firstEvent,user,src_ip&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;This returns the earliest combinations of user / src_ip disaplying the user and src_ip however I cannot get it to display the earliest _time each combination is found.&lt;/P&gt;

&lt;P&gt;Many thanks.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 01:16:21 GMT</pubDate>
    <dc:creator>balcv</dc:creator>
    <dc:date>2020-09-30T01:16:21Z</dc:date>
    <item>
      <title>Search for first event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382904#M111855</link>
      <description>&lt;P&gt;I would like to write a search of traffic data that will return _time,user,src_ip for the first occurrence.  However, it is highly probably that a user will have multiple src_ip.  (eg A user logins into a PC and a WiFi device).&lt;/P&gt;

&lt;P&gt;So I am looking for a list of unique user / src_ip combinations showing the earliest instance the combination exists.  &lt;/P&gt;

&lt;P&gt;I currently have:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;index="pan" (user="*\user1" AND &amp;gt; src_ip="192.168.*")&lt;BR /&gt;&lt;BR /&gt;
| stats  earliest(_time) as firstEvent count by src_ip,user&lt;BR /&gt;&lt;BR /&gt;
| table firstEvent,user,src_ip&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;This returns the earliest combinations of user / src_ip disaplying the user and src_ip however I cannot get it to display the earliest _time each combination is found.&lt;/P&gt;

&lt;P&gt;Many thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:16:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382904#M111855</guid>
      <dc:creator>balcv</dc:creator>
      <dc:date>2020-09-30T01:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: Search for first event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382905#M111856</link>
      <description>&lt;P&gt;I think you need to look first into the user, which is the "static" part, and then look for each src_ip he has as it is dynamic:&lt;/P&gt;

&lt;P&gt;Making it generic so you can get the results for any user and src_ip pair&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="pan" 
| stats earliest(_time) as firstEvent count by src_ip,user 
| table firstEvent,user,src_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This gives you the earliest time and count of each combination... Is this what you want? I'm not sure I'm not missing your goal here&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 07:05:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382905#M111856</guid>
      <dc:creator>tiagofbmm</dc:creator>
      <dc:date>2019-07-10T07:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: Search for first event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382906#M111857</link>
      <description>&lt;P&gt;Can you please make more clear what you want and how that is different from what you get? because the search you are showing does exactly that: for each user/src_ip combination, show the earliest(_time) and the count.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:16:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382906#M111857</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2020-09-30T01:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Search for first event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382907#M111858</link>
      <description>&lt;P&gt;That's the exact same search as was mentioned in the question (apart from dropping some of the filtering for user and src_ip fields)?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 07:09:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382907#M111858</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-07-10T07:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: Search for first event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382908#M111859</link>
      <description>&lt;P&gt;I understood the problem here was "each combination is found", where filtering on user AND src_ip would give just one. Anyway, that's why I asked for more clarification too, it's not clear whether we're missing the point&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 07:12:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382908#M111859</guid>
      <dc:creator>tiagofbmm</dc:creator>
      <dc:date>2019-07-10T07:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Search for first event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382909#M111860</link>
      <description>&lt;P&gt;You query seems to working fine with my sample data. I wonder what is missing. Anyway, I have formatted 'firstEvent' field (from epoch format) for easy readability.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| &amp;lt;base_query&amp;gt;
| stats earliest(_time) as firstEvent count by src_ip,user 
| eval firstEvent=strftime(firstEvent,"%Y-%m-%d %H:%M:%S")
| table firstEvent,user,src_ip
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jul 2019 07:12:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382909#M111860</guid>
      <dc:creator>jawaharas</dc:creator>
      <dc:date>2019-07-10T07:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Search for first event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382910#M111861</link>
      <description>&lt;P&gt;He's not filtering for specific user or IP, he's filtering for a certain pattern in both fields. But totally agree with you that the question is not very clear &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 07:15:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382910#M111861</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-07-10T07:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Search for first event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382911#M111862</link>
      <description>&lt;P&gt;I do not understand your problem.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 17:12:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382911#M111862</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-10T17:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: Search for first event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382912#M111863</link>
      <description>&lt;P&gt;The problem is that I do not get any results for _time.  The output includes the unique user / src_ip combinations but does not show the earliest time it was detected in the search results.  The column for firstEvent is blank. &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:16:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382912#M111863</guid>
      <dc:creator>balcv</dc:creator>
      <dc:date>2020-09-30T01:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: Search for first event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382913#M111864</link>
      <description>&lt;P&gt;The problem is that I do not get any results for _time.  The output includes the unique user / src_ip combinations but does not show the earliest time it was detected in the search results.  The column for firstEvent is blank. &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:16:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382913#M111864</guid>
      <dc:creator>balcv</dc:creator>
      <dc:date>2020-09-30T01:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: Search for first event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382914#M111865</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="pan" (user="*\user1" AND src_ip="192.168.*") 
| stats min(_time) as _time count last(_raw) As firstEvent by src_ip,user 
| table _time firstEvent,user,src_ip
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jul 2019 05:29:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382914#M111865</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-11T05:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: Search for first event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382915#M111866</link>
      <description>&lt;P&gt;Is that &lt;CODE&gt;&amp;gt;&lt;/CODE&gt; supposed to be there?  Why?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 05:30:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-first-event/m-p/382915#M111866</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-11T05:30:00Z</dc:date>
    </item>
  </channel>
</rss>

