<?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 search by a field which may have null value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-by-a-field-which-may-have-null-value/m-p/607458#M211193</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248117"&gt;@kingso_paypal&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Let me understand: you want to take events with&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;transaction_amount&amp;gt;max_amount, but do you want to consider also events without max_amount or not?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If yes, you could fullfill missing values with zero, if not, you have to add a condition to the main search:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;first case&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=&amp;lt;table_name&amp;gt; (transaction_amount&amp;gt;max_amount OR (transaction_amount&amp;gt;0 NOT max_amount=*))
| bucket Date span=day 
| fillnull value=null max_amount 
| stats count by Date, max_amount, transaction_amount&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;second case:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=&amp;lt;table_name&amp;gt; (transaction_amount&amp;gt;max_amount max_amount=*)
| bucket Date span=day 
| fillnull value=null max_amount 
| stats count by Date, max_amount, transaction_amount&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Fri, 29 Jul 2022 06:05:03 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2022-07-29T06:05:03Z</dc:date>
    <item>
      <title>How to search by a field which may have null value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-by-a-field-which-may-have-null-value/m-p/607450#M211189</link>
      <description>&lt;P&gt;Below is the log events that I have. One has max_amount value and one has empty value. I want to find out the events that have transaction_amount &amp;gt; max_amount.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[Date=2022-07-29, max_amount=100, transaction_amount=120]

[Date=2022-07-29, max_amount=100, transaction_amount=90]

[Date=2022-07-29, transaction_amount=120]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried transaction_amount&amp;gt;max_amount but not working.&amp;nbsp;I guess it is due to some records having no max_amount value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=&amp;lt;table_name&amp;gt; transaction_amount&amp;gt;max_amount | bucket Date span=day | fillnull value=null max_amount | stats count by Date, max_amount, transaction_amount&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;How to get the record #1?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2022 05:48:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-by-a-field-which-may-have-null-value/m-p/607450#M211189</guid>
      <dc:creator>kingso_paypal</dc:creator>
      <dc:date>2022-07-29T05:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to search by a field which may have null value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-by-a-field-which-may-have-null-value/m-p/607458#M211193</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248117"&gt;@kingso_paypal&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Let me understand: you want to take events with&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;transaction_amount&amp;gt;max_amount, but do you want to consider also events without max_amount or not?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If yes, you could fullfill missing values with zero, if not, you have to add a condition to the main search:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;first case&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=&amp;lt;table_name&amp;gt; (transaction_amount&amp;gt;max_amount OR (transaction_amount&amp;gt;0 NOT max_amount=*))
| bucket Date span=day 
| fillnull value=null max_amount 
| stats count by Date, max_amount, transaction_amount&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;second case:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=&amp;lt;table_name&amp;gt; (transaction_amount&amp;gt;max_amount max_amount=*)
| bucket Date span=day 
| fillnull value=null max_amount 
| stats count by Date, max_amount, transaction_amount&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2022 06:05:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-by-a-field-which-may-have-null-value/m-p/607458#M211193</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-07-29T06:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to search by a field which may have null value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-by-a-field-which-may-have-null-value/m-p/607500#M211220</link>
      <description>&lt;P&gt;Both cases are true to me. But when I tried, both return 0 records to me. Why?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2022 09:59:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-by-a-field-which-may-have-null-value/m-p/607500#M211220</guid>
      <dc:creator>kingso_paypal</dc:creator>
      <dc:date>2022-07-29T09:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to search by a field which may have null value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-by-a-field-which-may-have-null-value/m-p/607501#M211221</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248117"&gt;@kingso_paypal&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;running the main search, do you see both the fields in interesting fields panel?&lt;/P&gt;&lt;P&gt;If yes, have you values or not?&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2022 10:08:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-by-a-field-which-may-have-null-value/m-p/607501#M211221</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-07-29T10:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to search by a field which may have null value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-by-a-field-which-may-have-null-value/m-p/607690#M211304</link>
      <description>&lt;P&gt;It returns 0 events. This happens when I add a column which has no value at all unless I "fillnull" it, but I did it on max_amount field...&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 04:14:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-by-a-field-which-may-have-null-value/m-p/607690#M211304</guid>
      <dc:creator>kingso_paypal</dc:creator>
      <dc:date>2022-08-01T04:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to search by a field which may have null value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-by-a-field-which-may-have-null-value/m-p/607700#M211312</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248117"&gt;@kingso_paypal&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;running this search:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=&amp;lt;table_name&amp;gt; transaction_amount&amp;gt;max_amount&lt;/LI-CODE&gt;&lt;P&gt;have you results?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;do you see both the fields in interesting fields panel?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Ciao.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Giuseppe&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 06:41:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-by-a-field-which-may-have-null-value/m-p/607700#M211312</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-08-01T06:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to search by a field which may have null value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-by-a-field-which-may-have-null-value/m-p/607701#M211313</link>
      <description>&lt;P&gt;This is because &lt;FONT face="andale mono,times"&gt;search&lt;/FONT&gt; command cannot dereference field value, not because of missing value in some events. &amp;nbsp;Use &lt;FONT face="andale mono,times"&gt;where&lt;/FONT&gt; command instead.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=&amp;lt;table_name&amp;gt;
| eventstats values(max_amount) AS max_amount ``` only if max_amount is a fixed value ```
| where transaction_amount &amp;gt; max_amount&lt;/LI-CODE&gt;&lt;P&gt;The above assumes that &lt;EM&gt;max_amount&lt;/EM&gt; is a fixed value for every event.&lt;/P&gt;&lt;P&gt;Obviously, if you don't want to count those events that lacks &lt;EM&gt;max_amount&lt;/EM&gt;, remove that &lt;FONT face="andale mono,times"&gt;eventstats&lt;/FONT&gt;. &amp;nbsp;On the other hand, if &lt;EM&gt;max_amount&lt;/EM&gt; could be different values in different events but you want to set a value in those events, you need to decide whether to replace &lt;EM&gt;&lt;FONT face="andale mono,times"&gt;value()&lt;/FONT&gt;&lt;/EM&gt; with &lt;FONT face="andale mono,times"&gt;min()&lt;/FONT&gt;, &lt;FONT face="andale mono,times"&gt;max()&lt;/FONT&gt;, &lt;FONT face="andale mono,times"&gt;avg()&lt;/FONT&gt;, &lt;FONT face="andale mono,times"&gt;median()&lt;/FONT&gt;, or any other statistical function that returns a single value from multiple values.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 07:04:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-by-a-field-which-may-have-null-value/m-p/607701#M211313</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-08-01T07:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to search by a field which may have null value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-by-a-field-which-may-have-null-value/m-p/608047#M211419</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248117"&gt;@kingso_paypal&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 09:23:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-by-a-field-which-may-have-null-value/m-p/608047#M211419</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-08-03T09:23:04Z</dc:date>
    </item>
  </channel>
</rss>

