<?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: get latest events in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/get-latest-events/m-p/148978#M41633</link>
    <description>&lt;P&gt;well, &lt;CODE&gt;last()&lt;/CODE&gt; will get you the latest events, like you asked. Maybe you have to rephrase your question and provide some more details, like event sample and expected result....&lt;/P&gt;</description>
    <pubDate>Thu, 02 Oct 2014 07:03:56 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2014-10-02T07:03:56Z</dc:date>
    <item>
      <title>get latest events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-latest-events/m-p/148975#M41630</link>
      <description>&lt;P&gt;How do I get latest events for the below search&lt;/P&gt;

&lt;P&gt;i.e count should get the latest RegistrationState and SessionState if i search for last 15mins or 60mins. Always should get latest events to count. So I can get latest count of Available and Unregistered.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=xx InMaintenanceMode=False |dedup MachineName,RegistrationState | eval avail=if(SessionState=="","t","f")|eval unreg=if(RegistrationState=="Unregistered","t","f") | stats count(eval(avail="t")) AS Available, count(eval(unreg="t")) AS Unregistered by SiteName,DesktopGroupName 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Oct 2014 05:35:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-latest-events/m-p/148975#M41630</guid>
      <dc:creator>kris99</dc:creator>
      <dc:date>2014-10-02T05:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: get latest events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-latest-events/m-p/148976#M41631</link>
      <description>&lt;P&gt;Hi kris99,&lt;/P&gt;

&lt;P&gt;you can use &lt;CODE&gt;last()&lt;/CODE&gt; in your stats &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.4/SearchReference/CommonStatsFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/6.1.4/SearchReference/CommonStatsFunctions&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;something like this should do the job:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=xx InMaintenanceMode=False 
| dedup MachineName,RegistrationState 
| eval avail=if(SessionState=="","t","f")
| eval unreg=if(RegistrationState=="Unregistered","t","f") 
| stats count, last(eval(avail="t")) AS Available, last(eval(unreg="t")) AS Unregistered by SiteName,DesktopGroupName 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Thu, 02 Oct 2014 05:49:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-latest-events/m-p/148976#M41631</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-10-02T05:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: get latest events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-latest-events/m-p/148977#M41632</link>
      <description>&lt;P&gt;doesn't work.. &lt;/P&gt;

&lt;P&gt;its adding new count column and returning Available and Unregistered as 1 only &lt;/P&gt;</description>
      <pubDate>Thu, 02 Oct 2014 06:55:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-latest-events/m-p/148977#M41632</guid>
      <dc:creator>kris99</dc:creator>
      <dc:date>2014-10-02T06:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: get latest events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-latest-events/m-p/148978#M41633</link>
      <description>&lt;P&gt;well, &lt;CODE&gt;last()&lt;/CODE&gt; will get you the latest events, like you asked. Maybe you have to rephrase your question and provide some more details, like event sample and expected result....&lt;/P&gt;</description>
      <pubDate>Thu, 02 Oct 2014 07:03:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-latest-events/m-p/148978#M41633</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-10-02T07:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: get latest events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-latest-events/m-p/148979#M41634</link>
      <description>&lt;P&gt;okay maybe I misunderstand your question, but did you try to add &lt;CODE&gt;head&lt;/CODE&gt; &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.4/SearchReference/Head"&gt;http://docs.splunk.com/Documentation/Splunk/6.1.4/SearchReference/Head&lt;/A&gt; to your search? This will return only the latest events of your base search. Maybe this is what you are after?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Oct 2014 07:53:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-latest-events/m-p/148979#M41634</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-10-02T07:53:22Z</dc:date>
    </item>
  </channel>
</rss>

