<?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: Only display earliest hit for each day in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175056#M186642</link>
    <description>&lt;P&gt;BTW, you can still have fields even when your log contains a variety of different record formats.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Mar 2014 16:22:47 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2014-03-06T16:22:47Z</dc:date>
    <item>
      <title>Only display earliest hit for each day</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175048#M186634</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;We have building access logs in Splunk and I have to generate an attendance report.  I can filter based on specific events, like when someone swiped at the turnstile downstairs, but it shows multiple results since people leave/come back to the building several times a day.  I need to only show the first result per each day.  Example output:&lt;/P&gt;

&lt;P&gt;03/05/2014 08:23:16.257432 - Card Access - Access granted - NY - 10th St - Turnstile 1 - Joe Smith&lt;/P&gt;

&lt;P&gt;03/04/2014 15:54:53.062885 - Card Access - Access granted - NY - 10th St - Turnstile 2 - Joe Smith&lt;/P&gt;

&lt;P&gt;03/04/2014 15:22:12.837323 - Card Access - Access granted - NY - 10th St - Turnstile 1 - Joe Smith&lt;/P&gt;

&lt;P&gt;03/04/2014 08:46:14.337548 - Card Access - Access granted - NY - 10th St - Turnstile 3 - Joe Smith&lt;/P&gt;

&lt;P&gt;03/03/2014 09:10:01.092098 - Card Access - Access granted - NY - 10th St - Turnstile 1 - Joe Smith&lt;/P&gt;

&lt;P&gt;02/28/2014 09:32:04.303305 - Card Access - Access granted - NY - 10th St - Turnstile 2 - Joe Smith&lt;/P&gt;

&lt;P&gt;02/27/2014 09:57:45.852013 - Card Access - Access granted - NY - 10th St - Turnstile 1 - Joe Smith&lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;I want to filter it out so that it looks like ..&lt;/P&gt;

&lt;P&gt;03/05/2014 08:23:16.257432 - Card Access - Access granted - NY - 10th St - Turnstile 1 - Joe Smith&lt;/P&gt;

&lt;P&gt;03/04/2014 08:46:14.337548 - Card Access - Access granted - NY - 10th St - Turnstile 3 - Joe Smith&lt;/P&gt;

&lt;P&gt;03/03/2014 09:10:01.092098 - Card Access - Access granted - NY - 10th St - Turnstile 1 - Joe Smith&lt;/P&gt;

&lt;P&gt;02/28/2014 09:32:04.303305 - Card Access - Access granted - NY - 10th St - Turnstile 2 - Joe Smith&lt;/P&gt;

&lt;P&gt;02/27/2014 09:57:45.852013 - Card Access - Access granted - NY - 10th St - Turnstile 1 - Joe Smith&lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;Basically only display a single event for each day that appears first.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2014 15:55:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175048#M186634</guid>
      <dc:creator>oleg106</dc:creator>
      <dc:date>2014-03-05T15:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Only display earliest hit for each day</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175049#M186635</link>
      <description>&lt;P&gt;No problem.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere
| eval date=strftime(_time,"%x")
| sort _time
| dedup username date
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Assuming that these field names work, of course!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2014 16:05:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175049#M186635</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-03-05T16:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Only display earliest hit for each day</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175050#M186636</link>
      <description>&lt;P&gt;Try this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your base search | eval Date=strftime(_time, "%x") | stats first(_time) as swipedTime, first(_raw) as FullRecord by Date | eval swiptedTime=strftime(swiptedTime,"%H:%M:%S.%3Q")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Mar 2014 16:49:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175050#M186636</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-03-05T16:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: Only display earliest hit for each day</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175051#M186637</link>
      <description>&lt;P&gt;Sorry, I forgot to add an important detail.  The app spits out all sorts of log types, and since they are all formatted differently, they are not broken up in fields.  So I would need to be able to rely just on the timestamp the log came in, the rest can be ignored.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2014 18:31:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175051#M186637</guid>
      <dc:creator>oleg106</dc:creator>
      <dc:date>2014-03-05T18:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Only display earliest hit for each day</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175052#M186638</link>
      <description>&lt;P&gt;Sorry, I forgot to add an important detail.  The app spits out all sorts of log types, and since they are all formatted differently, they are not broken up in fields.  So I would need to be able to rely just on the timestamp the log came in, the rest can be ignored.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2014 18:31:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175052#M186638</guid>
      <dc:creator>oleg106</dc:creator>
      <dc:date>2014-03-05T18:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: Only display earliest hit for each day</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175053#M186639</link>
      <description>&lt;P&gt;Sorry, I forgot to add an important detail.  The app spits out all sorts of log types, and since they are all formatted differently, they are not broken up in fields.  So I would need to be able to rely just on the timestamp the log came in, the rest can be ignored.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2014 18:32:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175053#M186639</guid>
      <dc:creator>oleg106</dc:creator>
      <dc:date>2014-03-05T18:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Only display earliest hit for each day</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175054#M186640</link>
      <description>&lt;P&gt;That's going to be problematic if you want to see the first event &lt;EM&gt;per user&lt;/EM&gt; - we must have some way of identifying the user! If the field isn't currently extracted, that's okay, but there still must be some mechanism that we can describe to Splunk.&lt;/P&gt;

&lt;P&gt;The search above requires only a username. If you want just the first event for each day, just leave off the username field, but I don't think that is what you want.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2014 21:01:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175054#M186640</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-03-05T21:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Only display earliest hit for each day</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175055#M186641</link>
      <description>&lt;P&gt;Or you can substitute &lt;CODE&gt;_raw&lt;/CODE&gt; for &lt;CODE&gt;username&lt;/CODE&gt;, which is what @somesoni2 did. The only problem is that dedup-ing &lt;CODE&gt;_raw&lt;/CODE&gt; can be a performance issue.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2014 21:03:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175055#M186641</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-03-05T21:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: Only display earliest hit for each day</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175056#M186642</link>
      <description>&lt;P&gt;BTW, you can still have fields even when your log contains a variety of different record formats.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2014 16:22:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175056#M186642</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-03-06T16:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Only display earliest hit for each day</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175057#M186643</link>
      <description>&lt;P&gt;This works, thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2014 21:53:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Only-display-earliest-hit-for-each-day/m-p/175057#M186643</guid>
      <dc:creator>oleg106</dc:creator>
      <dc:date>2014-03-06T21:53:54Z</dc:date>
    </item>
  </channel>
</rss>

