<?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: Return last event appear time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Return-last-event-appear-time/m-p/336317#M159750</link>
    <description>&lt;P&gt;Just building on the @sbbadri's query, I think you just need &lt;CODE&gt;count()&lt;/CODE&gt; and &lt;CODE&gt;last()&lt;/CODE&gt; stats functions with aggregation by user_id, Description. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=WinEventLog:Security EventCode=4625 | stats count last(_time) as lastHappenTime by user_id Description
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 28 Jul 2017 08:06:35 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-07-28T08:06:35Z</dc:date>
    <item>
      <title>Return last event appear time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-last-event-appear-time/m-p/336314#M159747</link>
      <description>&lt;P&gt;HI Everyone&lt;BR /&gt;
I have a query will return me a table shows top users that has logon fail detail as below&lt;BR /&gt;
query &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=WinEventLog:Security EventCode=4625
| top user_id,  Description, 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and return table looks like below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user_id Description count   percent
user1   logonFail   121             17.741935
user2   logonFail   98              10.2544
user3   logonFail   25              6.3625
****
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to added an column that shows the last event time of that failed log happened and now display the percent column as below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user_id Description count   lastHappenTime
user1   logonFail   121             15:30
user2   logonFail   98              10:15
user3   logonFail   25              16:24
****
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;so this way I can tell whether the fail logon event is still happening or not. Anyone done the similar thing can give me some hit please?&lt;BR /&gt;
Thanks in advance&lt;BR /&gt;
Regards&lt;BR /&gt;
Sam&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2017 05:20:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-last-event-appear-time/m-p/336314#M159747</guid>
      <dc:creator>samlinsongguo</dc:creator>
      <dc:date>2017-07-28T05:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: Return last event appear time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-last-event-appear-time/m-p/336315#M159748</link>
      <description>&lt;P&gt;sourcetype=WinEventLog:Security   EventCode=4625   | stats  last(_time) as lastHappenTime by user_id Description| eval lastHappenTime=strftime(lastHappenTime,"%H:%M:%S") |  top user_id Description lastHappenTime&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:04:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-last-event-appear-time/m-p/336315#M159748</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2020-09-29T15:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: Return last event appear time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-last-event-appear-time/m-p/336316#M159749</link>
      <description>&lt;P&gt;this does added the lastHappenTime column but the count is wrong (show as 1) as below &lt;BR /&gt;
    user_id Description    count    lastHappenTime&lt;BR /&gt;
     user1    logonFail    1               15:30&lt;BR /&gt;
     user2    logonFail    1                10:15&lt;BR /&gt;
     user3    logonFail    1                16:24&lt;BR /&gt;
     ****&lt;BR /&gt;
it make sence only one event at 1530 but I want to know when was the last event happened (in this case it is 15:30) and how many is happened in today which I expect 120 rather than 1&lt;BR /&gt;
Regards&lt;BR /&gt;
Sam&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2017 06:14:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-last-event-appear-time/m-p/336316#M159749</guid>
      <dc:creator>samlinsongguo</dc:creator>
      <dc:date>2017-07-28T06:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: Return last event appear time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-last-event-appear-time/m-p/336317#M159750</link>
      <description>&lt;P&gt;Just building on the @sbbadri's query, I think you just need &lt;CODE&gt;count()&lt;/CODE&gt; and &lt;CODE&gt;last()&lt;/CODE&gt; stats functions with aggregation by user_id, Description. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=WinEventLog:Security EventCode=4625 | stats count last(_time) as lastHappenTime by user_id Description
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jul 2017 08:06:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-last-event-appear-time/m-p/336317#M159750</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-07-28T08:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: Return last event appear time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-last-event-appear-time/m-p/336318#M159751</link>
      <description>&lt;P&gt;again, a little building based on @sbbadri and @niketnilay, since you can't do a top on count, and you want the percentage:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=WinEventLog:Security EventCode=4625 | stats count last(_time) as lastHappenTime by user_id Description|eventstats sum(count) as total|eval percent=round((count/total)*100,2)|fields user_id Description count percent lastHappenTime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jul 2017 11:30:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-last-event-appear-time/m-p/336318#M159751</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-07-28T11:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Return last event appear time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-last-event-appear-time/m-p/336319#M159752</link>
      <description>&lt;P&gt;Thank you for all the help!!! I got what I wanted on following query   &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; wineventlog` sourcetype=WinEventLog:Security EventCode=4625 
    | fields + user_id _time Description src 
    | stats values(src) as "Source Computer", values(Description) as Description  latest(_time) as lastHappenTime count(_time) as Total by user_id 
    | eval lastHappenTime=strftime(lastHappenTime,"%H:%M:%S") 
    | sort - "lastHappenTime" 
    | head 10
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Jul 2017 00:20:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-last-event-appear-time/m-p/336319#M159752</guid>
      <dc:creator>samlinsongguo</dc:creator>
      <dc:date>2017-07-31T00:20:45Z</dc:date>
    </item>
  </channel>
</rss>

