<?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 value based on missing field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Return-value-based-on-missing-field/m-p/482394#M135147</link>
    <description>&lt;P&gt;Something like if logged_in="yes" &amp;amp; nonexist(logged_out) return true&lt;BR /&gt;
count true by session_id&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 03:38:56 GMT</pubDate>
    <dc:creator>ialahdal</dc:creator>
    <dc:date>2020-09-30T03:38:56Z</dc:date>
    <item>
      <title>Return value based on missing field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-value-based-on-missing-field/m-p/482393#M135146</link>
      <description>&lt;P&gt;I want to make a search that will return a count of session_id based on the following fields&lt;BR /&gt;
logged_out, logged_in&lt;BR /&gt;
I want a count of how many sessions have an event with the logged_in field existing &amp;amp; the logged_out field not existing, this way I can tell exactly how many sessions are currently online.&lt;/P&gt;

&lt;P&gt;How would I compare based on a field not existing, I tried isnull() and it didn't work as needed.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:38:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-value-based-on-missing-field/m-p/482393#M135146</guid>
      <dc:creator>ialahdal</dc:creator>
      <dc:date>2020-09-30T03:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Return value based on missing field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-value-based-on-missing-field/m-p/482394#M135147</link>
      <description>&lt;P&gt;Something like if logged_in="yes" &amp;amp; nonexist(logged_out) return true&lt;BR /&gt;
count true by session_id&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:38:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-value-based-on-missing-field/m-p/482394#M135147</guid>
      <dc:creator>ialahdal</dc:creator>
      <dc:date>2020-09-30T03:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Return value based on missing field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-value-based-on-missing-field/m-p/482395#M135148</link>
      <description>&lt;P&gt;@ialahdal &lt;/P&gt;

&lt;P&gt;Try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YOUR_SEARCH | eval flag=if(logged_in=="Yes" AND isnull(logged_out),1,0)
| stats sum(flag)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sample:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval logged_in="Yes",logged_out="Yes" 
| append 
    [| makeresults 
    | eval logged_in="Yes"] 
| eval flag=if(logged_in=="Yes" AND isnull(logged_out),1,0)
| stats sum(flag)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jan 2020 11:39:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-value-based-on-missing-field/m-p/482395#M135148</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2020-01-13T11:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Return value based on missing field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-value-based-on-missing-field/m-p/482396#M135149</link>
      <description>&lt;P&gt;@ialahdal  You can do something like below. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search query&amp;gt; | stats count(eval(ISNOTNULL(logged_in))) as in_count , count(eval(ISNOTNULL(logged_out)) as out_count by SessionID| where in_count  &amp;gt; out_count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jan 2020 17:32:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-value-based-on-missing-field/m-p/482396#M135149</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2020-01-13T17:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: Return value based on missing field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-value-based-on-missing-field/m-p/482397#M135150</link>
      <description>&lt;P&gt;Thanks to you and @kamlesh_vaghela, I think isnull is making values null, using isnotnull like you mentioned did get me to the results I needed eventually.&lt;BR /&gt;
Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 10:39:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-value-based-on-missing-field/m-p/482397#M135150</guid>
      <dc:creator>ialahdal</dc:creator>
      <dc:date>2020-01-14T10:39:48Z</dc:date>
    </item>
  </channel>
</rss>

