<?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 to get boolean fields from a stats max count (event number) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-boolean-fields-from-a-stats-max-count-event-number/m-p/708091#M239471</link>
    <description>&lt;LI-CODE lang="markup"&gt;| eventstats max(triggeredEventNumber) as userLastEvent BY userName
| where triggeredEventNumber = userLastEvent&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 06 Jan 2025 23:34:46 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2025-01-06T23:34:46Z</dc:date>
    <item>
      <title>How to get boolean fields from a stats max count (event number)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-boolean-fields-from-a-stats-max-count-event-number/m-p/708064#M239461</link>
      <description>&lt;P&gt;How do I return field values from a specific max(eventnumber)?&lt;BR /&gt;&lt;BR /&gt;This was helpful but did not solve my issue&amp;nbsp;&lt;A href="https://community.splunk.com/t5/Splunk-Search/How-to-get-stats-max-count-of-a-field-by-another-field/m-p/587210" target="_blank" rel="noopener"&gt;Solved: How to get stats max count of a field by another f... - Splunk Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;We are ingesting logs from test devices. Each log has an event number, which I can search on to find the most recent event. When the devices disconnect from our cloud instance, they cache events which are transmitted at a lower priority (newest to oldest) than real time events. For example: event #100 connected to cloud, event 101-103 disconnected from cloud and cached, events, #104 re-connected to cloud (latest status) received, then event 103 is transmitted, then 102, so using latest/earliest or first/last does not return the most recent status&lt;/P&gt;&lt;P&gt;The logs consist of an event number and boolean (true/false) fields.&lt;/P&gt;&lt;P&gt;Searching for max(event number) and values(boolean field value) results in both true/false for any time picker period that has multiple events, for example:&lt;/P&gt;&lt;P&gt;| stats max(triggeredEventNumber) values(isCheckIn) values(isAntiSurveillanceViolation) BY userName&lt;/P&gt;&lt;P&gt;userName&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;max(triggeredEventNumber)&amp;nbsp; &amp;nbsp; &amp;nbsp; values(isCheckIn)&amp;nbsp; &amp;nbsp; &amp;nbsp; latest(isAntiSurveillanceViolation)&lt;BR /&gt;NS2_GS22_MW&amp;nbsp; &amp;nbsp; 92841&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;false true&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FALSE&lt;/P&gt;&lt;P&gt;In the example the actual value of isCheckIn was true.&lt;BR /&gt;&lt;BR /&gt;Here is a complete example event:&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"version": 1,&lt;BR /&gt;"logType": "deviceStateEvent",&lt;BR /&gt;"deviceSerialNumber": "4234220083",&lt;BR /&gt;"userName": "NS2_GS22_MW",&lt;BR /&gt;"cloudTimestampUTC": "2025-01-06T18:17:00Z",&lt;BR /&gt;"deviceTimestampUTC": "2025-01-06T18:16:46Z",&lt;BR /&gt;"triggeredEventNumber": 92841,&lt;BR /&gt;"batteryPercent": 87,&lt;BR /&gt;"isCheckIn": true,&lt;BR /&gt;"isAntiSurveillanceViolation": false,&lt;BR /&gt;"isLowBatteryViolation": false,&lt;BR /&gt;"isCellularViolation": false,&lt;BR /&gt;"isDseDelayed": false,&lt;BR /&gt;"isPhonePresent": true,&lt;BR /&gt;"isCameraExposed": false,&lt;BR /&gt;"isShutterOpen": false,&lt;BR /&gt;"isMicExposed": false,&lt;BR /&gt;"isCharging": false,&lt;BR /&gt;"isPowerOff": false,&lt;BR /&gt;"isHibernation": false,&lt;BR /&gt;"isPhoneInfoStale": false,&lt;BR /&gt;"bleMacAddress": "5c:2e:c6:bc:e4:cf",&lt;BR /&gt;"cellIpv4Address": "0.0.0.0",&lt;BR /&gt;"cellIpv6Address": "::"&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2025 18:52:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-boolean-fields-from-a-stats-max-count-event-number/m-p/708064#M239461</guid>
      <dc:creator>Seawheels51</dc:creator>
      <dc:date>2025-01-06T18:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to get boolean fields from a stats max count (event number)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-boolean-fields-from-a-stats-max-count-event-number/m-p/708071#M239465</link>
      <description>&lt;P&gt;That is the way the &lt;FONT face="courier new,courier"&gt;values()&lt;/FONT&gt; function works.&amp;nbsp; It will list, in lexicographical order, all of the unique values for the given field.&amp;nbsp; What would you rather see?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2025 20:46:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-boolean-fields-from-a-stats-max-count-event-number/m-p/708071#M239465</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2025-01-06T20:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to get boolean fields from a stats max count (event number)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-boolean-fields-from-a-stats-max-count-event-number/m-p/708077#M239467</link>
      <description>&lt;P&gt;Thank you for the reply&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;The results I want to see are the fields for that triggered event number only.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2025 21:41:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-boolean-fields-from-a-stats-max-count-event-number/m-p/708077#M239467</guid>
      <dc:creator>Seawheels51</dc:creator>
      <dc:date>2025-01-06T21:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to get boolean fields from a stats max count (event number)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-boolean-fields-from-a-stats-max-count-event-number/m-p/708078#M239468</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;the problem is the cached events are delivered more recently (lower priority transmission) than the actual current state event which is why the search for max(triggeredEventNumber) instead of first/last or earliest/latest since I cannot forecast how many cached events may be delivered after current state and before the next current state event is created (as a result of a state change typically battery percent change)&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2025 21:49:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-boolean-fields-from-a-stats-max-count-event-number/m-p/708078#M239468</guid>
      <dc:creator>Seawheels51</dc:creator>
      <dc:date>2025-01-06T21:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to get boolean fields from a stats max count (event number)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-boolean-fields-from-a-stats-max-count-event-number/m-p/708091#M239471</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eventstats max(triggeredEventNumber) as userLastEvent BY userName
| where triggeredEventNumber = userLastEvent&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 06 Jan 2025 23:34:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-boolean-fields-from-a-stats-max-count-event-number/m-p/708091#M239471</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2025-01-06T23:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to get boolean fields from a stats max count (event number)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-boolean-fields-from-a-stats-max-count-event-number/m-p/708168#M239487</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my laymans terms use eventstats search to find max(triggeredEventNumber) BY userName. Next use where to select only that max(triggeredEventNumber) for results.&lt;/P&gt;&lt;P&gt;Then I used stats values(field) to extract the values for the fields I am interested in.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 17:10:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-boolean-fields-from-a-stats-max-count-event-number/m-p/708168#M239487</guid>
      <dc:creator>Seawheels51</dc:creator>
      <dc:date>2025-01-07T17:10:32Z</dc:date>
    </item>
  </channel>
</rss>

