<?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: Conditional Success/Fail in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Conditional-Success-Fail/m-p/691043#M235349</link>
    <description>&lt;P&gt;Thanks for the help Paul!&amp;nbsp; I have tried your tips:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=*app_pcf cf_app_name="mddr-batch-integration-flow" msg.message="*Work Flow Passed | for endpoint Atmtransaction*"
| rename msg.message as message
| eval Status=if(like(message,"%Work Flow Passed | for endpoint Atmtransaction%"),"SUCCESS", "FAIL")
| table _time, message, Status&lt;/LI-CODE&gt;&lt;P&gt;And now I have added the correct message (workflow Passed) however the Status is still showing as FAIL...&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Memphis_0-1718748009557.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31370iB988605954FD2FF3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Memphis_0-1718748009557.png" alt="Memphis_0-1718748009557.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Jun 2024 22:00:27 GMT</pubDate>
    <dc:creator>Memphis</dc:creator>
    <dc:date>2024-06-18T22:00:27Z</dc:date>
    <item>
      <title>Conditional Success/Fail</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-Success-Fail/m-p/691021#M235342</link>
      <description>&lt;P&gt;Hi all -&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create what I would think is a relatively simple conditional statement in Splunk.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Use Case:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I merely want to know if a job has passed or failed; the only thing that is maybe tricky about this is the only message we get for pass or fail look like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;msg.message="*Work Flow Passed | for endpoint XYZ*" OR msg.message="*STATUS - FAILED*"&lt;/P&gt;&lt;P&gt;I have tried to create a conditional statement based on the messaging but I either return NULL value or the wrong value.&amp;nbsp; If I try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=*app_pcf cf_app_name="mddr-batch-integration-flow" msg.message="*Work Flow Passed | for endpoint XYZ*" OR msg.message="*STATUS  - FAILED*"
| eval Status=if('message.msg'="*Work Flow Passed | for endpoint XYZ*","SUCCESS", "FAIL")
| table _time, Status&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Then it just shows Status as FAIL (which, i know is objectively wrong because the only message produced for this event is "work flow passed..." which should induce a TRUE value and display "SUCCESS").&lt;BR /&gt;&lt;BR /&gt;If I try another way:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=*app_pcf cf_app_name="mddr-batch-integration-flow" msg.message="*Work Flow Passed | for endpoint XYZ*" OR msg.message="*STATUS  - FAILED*"
| eval Status=case(msg.message="*Work Flow Passed | for endpoint XYZ*", "SUCCESS", msg.message="*STATUS  - FAILED*", "FAIL")
| table _time, Status&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I receive NULL value for the STATUS field...&amp;nbsp;&lt;/P&gt;&lt;P&gt;If it helps, this is how the event looks when i don't add any conditional statement or table:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Memphis_0-1718725841069.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31368i6B89759014E4D665/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Memphis_0-1718725841069.png" alt="Memphis_0-1718725841069.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;How can I fix this?? Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 15:50:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-Success-Fail/m-p/691021#M235342</guid>
      <dc:creator>Memphis</dc:creator>
      <dc:date>2024-06-18T15:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Success/Fail</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-Success-Fail/m-p/691027#M235345</link>
      <description>&lt;P&gt;In conditionals, use "like" instead:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval msg.message=mvappend("Work Flow Passed | for endpoint XYZ","STATUS - FAILED") 
| mvexpand msg.message
``` SPL above is to create sample data only ```
| rename msg.message as message
| eval Status=if(like(message,"%Work Flow Passed | for endpoint XYZ%"),"SUCCESS", "FAIL")
| table _time, message, Status&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;It also helps to rename fields with paths to avoid the need for quoting them.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 17:14:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-Success-Fail/m-p/691027#M235345</guid>
      <dc:creator>P_vandereerden</dc:creator>
      <dc:date>2024-06-18T17:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Success/Fail</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-Success-Fail/m-p/691043#M235349</link>
      <description>&lt;P&gt;Thanks for the help Paul!&amp;nbsp; I have tried your tips:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=*app_pcf cf_app_name="mddr-batch-integration-flow" msg.message="*Work Flow Passed | for endpoint Atmtransaction*"
| rename msg.message as message
| eval Status=if(like(message,"%Work Flow Passed | for endpoint Atmtransaction%"),"SUCCESS", "FAIL")
| table _time, message, Status&lt;/LI-CODE&gt;&lt;P&gt;And now I have added the correct message (workflow Passed) however the Status is still showing as FAIL...&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Memphis_0-1718748009557.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31370iB988605954FD2FF3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Memphis_0-1718748009557.png" alt="Memphis_0-1718748009557.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 22:00:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-Success-Fail/m-p/691043#M235349</guid>
      <dc:creator>Memphis</dc:creator>
      <dc:date>2024-06-18T22:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Success/Fail</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-Success-Fail/m-p/691046#M235350</link>
      <description>&lt;P&gt;Your data has a lower case 'a' for&amp;nbsp;atmtransaction and your like statement as 'A'&lt;/P&gt;&lt;P&gt;If you want to use like() then add in lower(), i.e.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Status=if(like(lower(message),"%work flow passed | for endpoint atmtransaction%"),"SUCCESS", "FAIL")&lt;/LI-CODE&gt;&lt;P&gt;NB: &lt;STRONG&gt;match(message, regex)&lt;/STRONG&gt; is an alternative to like, so you only need to match the part you are interested in, not the entire string, the match equivalent would be&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Status=if(match(message,"(?i)work flow passed \| for endpoint atmtransaction"),"SUCCESS", "FAIL")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 23:49:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-Success-Fail/m-p/691046#M235350</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-06-18T23:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Success/Fail</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-Success-Fail/m-p/691200#M235387</link>
      <description>&lt;P&gt;god blessit, i feel so dumb now lol.&amp;nbsp; Fixing the "a" from upper to lowercase was all I needed to do.&amp;nbsp; Thank you for catching that, i didn't realize that the capitalization would have an effect, but I see now why it does.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks again, everyone works great now.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 18:53:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-Success-Fail/m-p/691200#M235387</guid>
      <dc:creator>Memphis</dc:creator>
      <dc:date>2024-06-20T18:53:26Z</dc:date>
    </item>
  </channel>
</rss>

