<?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: comparing two field not working with eval case in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/comparing-two-field-not-working-with-eval-case/m-p/212964#M187922</link>
    <description>&lt;P&gt;Your query looks fine to me.  What's happening when you run the result ? Did you check that you don't have blank or null value in DBexcluded?&lt;/P&gt;</description>
    <pubDate>Fri, 05 Aug 2016 09:49:55 GMT</pubDate>
    <dc:creator>hardikJsheth</dc:creator>
    <dc:date>2016-08-05T09:49:55Z</dc:date>
    <item>
      <title>comparing two field not working with eval case</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-two-field-not-working-with-eval-case/m-p/212961#M187919</link>
      <description>&lt;P&gt;I have search below ..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputlookup biweekly_backup | join type=outer max=0 host [search index=tsm sourcetype="tsm-client-log" source="/server2splunk/server_sel" OR source="c:\\LogFiles\\sersel_sched.log" "Total server databases inspected" | rex field=_raw "^(?:[^:\n]*:){3}\s+(?P.+)"] | convert num(TDBs) | join type=outer max=0 host [search index=tsm sourcetype="tsm-client-log" source="/server2splunk/server_sel" OR source="c:\\LogFiles\\sersel_sched.log" "Total server databases backed up" | rex field=_raw "^(?P[^ ]+)(?:[^:\n]*:){3}\s+(?P.+)"] | convert num(DBBackedup) | join type=outer max=0 host [search index=tsm sourcetype="tsm-client-log" source="/server2splunk/server_sel" OR source="c:\\LogFiles\\sersel_sched.log" "Total server databases excluded" | rex field=_raw "^(?:[^:\n]*:){3}\s+(?P\s+\d+)"] | table host BDate TDBs DBBackedup DBexcluded
| dedup host
| eval DB_NotBackedup = (TDBs - DBBackedup)
| fillnull value=NoData 
| eval Backup_Status=case(DB_NotBackedup&amp;gt;DBexcluded, "BackupFailed - RunEffBackup", DBBackedup="NoData", "BackupMissed - RunFullBackup", 1=1, "Success")  | table Backup_Status BDate TDBs DBBackedup DBexcluded DB_NotBackedup
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;while comparing in |eval Backup_Status=case(DB_NotBackedup&amp;gt;DBexcluded, &lt;BR /&gt;
it doesn't take field values to compare &lt;BR /&gt;
but when i provide numeric values instead , it does,,   e.g. |eval Backup_Status=case(DB_NotBackedup&amp;gt;4, ......&lt;/P&gt;

&lt;P&gt;any idea what is missing? &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:31:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-two-field-not-working-with-eval-case/m-p/212961#M187919</guid>
      <dc:creator>chandra61446</dc:creator>
      <dc:date>2020-09-29T10:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: comparing two field not working with eval case</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-two-field-not-working-with-eval-case/m-p/212962#M187920</link>
      <description>&lt;P&gt;then it seems like the "BDexcluded" field is not an number. you can test it with the eval function isnum(X) &lt;BR /&gt;
see &lt;A href="https://docs.splunk.com/Documentation/Splunk/6.4.2/SearchReference/CommonEvalFunctions#Informational_functions"&gt;https://docs.splunk.com/Documentation/Splunk/6.4.2/SearchReference/CommonEvalFunctions#Informational_functions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2016 09:41:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-two-field-not-working-with-eval-case/m-p/212962#M187920</guid>
      <dc:creator>aholzel</dc:creator>
      <dc:date>2016-08-05T09:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: comparing two field not working with eval case</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-two-field-not-working-with-eval-case/m-p/212963#M187921</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Try rewriting your case with double = for comparison and use a space between the greater than symbol and the next variable name. Keep in mind this symbol can be part of the variable name (this is valid code | eval field&amp;gt;A = "random text" &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Backup_Status = case(
    DB_NotBackedup &amp;gt; DBexcluded, "BackupFailed - RunEffBackup", 
    DBBackedup == "NoData", "BackupMissed - RunFullBackup", 
    1==1, "Success"
) 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Aug 2016 09:43:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-two-field-not-working-with-eval-case/m-p/212963#M187921</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-08-05T09:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: comparing two field not working with eval case</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-two-field-not-working-with-eval-case/m-p/212964#M187922</link>
      <description>&lt;P&gt;Your query looks fine to me.  What's happening when you run the result ? Did you check that you don't have blank or null value in DBexcluded?&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2016 09:49:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-two-field-not-working-with-eval-case/m-p/212964#M187922</guid>
      <dc:creator>hardikJsheth</dc:creator>
      <dc:date>2016-08-05T09:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: comparing two field not working with eval case</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-two-field-not-working-with-eval-case/m-p/212965#M187923</link>
      <description>&lt;P&gt;still the same &lt;/P&gt;

&lt;P&gt;output  &lt;/P&gt;

&lt;P&gt;Backup_Status                                      BDate           TDBs DBBackedup  DBexcluded  DB_NotBackedup&lt;BR /&gt;
1   BackupFailed - RunEffBackup 07/30/2016  1581    1566                  3                  15&lt;BR /&gt;
2   BackupFailed - RunEffBackup 07/24/2016  1278    1275                  3                  3&lt;BR /&gt;
3   BackupFailed - RunEffBackup 07/31/2016  2165    2162                  3                          3&lt;BR /&gt;
4   BackupFailed - RunEffBackup 07/23/2016  678         677                        1                     1&lt;BR /&gt;
5   BackupFailed - RunEffBackup 07/30/2016  1918    1915                   2                     3&lt;BR /&gt;
6   BackupFailed - RunEffBackup 07/23/2016  1272    1268                   3                        4&lt;BR /&gt;
7   BackupFailed - RunEffBackup 07/23/2016  11009   11009                  0                        0&lt;BR /&gt;
8   BackupFailed - RunEffBackup 07/31/2016  10020   10019                  1                        1&lt;BR /&gt;
9   BackupMissed - RunFullBackup    NoData          NoData  NoData             NoData   NoData&lt;/P&gt;

&lt;P&gt;as per condition, no1 and no 6 should be success but it is not.. !!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:31:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-two-field-not-working-with-eval-case/m-p/212965#M187923</guid>
      <dc:creator>chandra61446</dc:creator>
      <dc:date>2020-09-29T10:31:31Z</dc:date>
    </item>
  </channel>
</rss>

