<?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 would I count by a most recent event value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-would-I-count-by-a-most-recent-event-value/m-p/228064#M67391</link>
    <description>&lt;P&gt;Try this, assuming the values are extracted in a field called &lt;CODE&gt;yourField&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo sourcetype=bar | stats dc(yourField) as yourField by facility
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;*&lt;STRONG&gt;&lt;EM&gt;OR&lt;/EM&gt;&lt;/STRONG&gt;*&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo sourcetype=bar | timechart span=1h latest(yourField) as yourField by facility
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 03 Oct 2016 17:47:48 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-10-03T17:47:48Z</dc:date>
    <item>
      <title>How would I count by a most recent event value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-would-I-count-by-a-most-recent-event-value/m-p/228060#M67387</link>
      <description>&lt;P&gt;The value that I need to count can be in multiple events. I just want to count it one time, but it will need to be the most recent value counted.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2016 14:57:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-would-I-count-by-a-most-recent-event-value/m-p/228060#M67387</guid>
      <dc:creator>splunkingjh</dc:creator>
      <dc:date>2016-10-03T14:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: How would I count by a most recent event value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-would-I-count-by-a-most-recent-event-value/m-p/228061#M67388</link>
      <description>&lt;P&gt;Without much information, I would suggest to give these a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo sourcetype=bar yourfield=yourvalue | head 1 | table yourfield

index=foo sourcetype=bar | stats latest(yourfield) as yourfield
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Oct 2016 16:11:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-would-I-count-by-a-most-recent-event-value/m-p/228061#M67388</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-03T16:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: How would I count by a most recent event value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-would-I-count-by-a-most-recent-event-value/m-p/228062#M67389</link>
      <description>&lt;P&gt;The second option seems to pull back the most recent. Is there a way that I can count all of those values? I am trying to parse HL7 data. It has presented quite the challenge. I am trying to provide a visual that will show active counts across the facility of different events.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2016 16:57:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-would-I-count-by-a-most-recent-event-value/m-p/228062#M67389</guid>
      <dc:creator>splunkingjh</dc:creator>
      <dc:date>2016-10-03T16:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: How would I count by a most recent event value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-would-I-count-by-a-most-recent-event-value/m-p/228063#M67390</link>
      <description>&lt;P&gt;By "Is there a way that I can count all of those values", Do you mean that you want to count the event which has the same value for field yourfield as in the latest event? If yes, then try something like this (if no, provide more info)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo sourcetype=bar [ search index=foo sourcetype=bar | stats latest(yourfield) as yourfield] | stats count by yourfield
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Oct 2016 17:24:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-would-I-count-by-a-most-recent-event-value/m-p/228063#M67390</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-03T17:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: How would I count by a most recent event value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-would-I-count-by-a-most-recent-event-value/m-p/228064#M67391</link>
      <description>&lt;P&gt;Try this, assuming the values are extracted in a field called &lt;CODE&gt;yourField&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo sourcetype=bar | stats dc(yourField) as yourField by facility
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;*&lt;STRONG&gt;&lt;EM&gt;OR&lt;/EM&gt;&lt;/STRONG&gt;*&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo sourcetype=bar | timechart span=1h latest(yourField) as yourField by facility
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Oct 2016 17:47:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-would-I-count-by-a-most-recent-event-value/m-p/228064#M67391</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-03T17:47:48Z</dc:date>
    </item>
  </channel>
</rss>

