<?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 use wildcard in case like condition? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-wildcard-in-case-like-condition/m-p/680275#M232522</link>
    <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;case&lt;/FONT&gt; function does not support wildcards natively, but you can use them in &lt;FONT face="courier new,courier"&gt;like&lt;/FONT&gt; (as you have) or you can use the equivalent regular expression using &lt;FONT face="courier new,courier"&gt;match&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Status=case(like('message',"%Exchange Rates Process Completed. File sucessfully sent to Concur%"),"SUCCESS", match('message',"(TEST|DEV|PRD)\(SUCCESS): Exchange Rates OnDemand Interface Run Report - Concur"),"SUCCESS", like('TracePoint',"%EXCEPTION%"),"ERROR")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Mar 2024 16:18:09 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2024-03-11T16:18:09Z</dc:date>
    <item>
      <title>How to use wildcard in case like condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-wildcard-in-case-like-condition/m-p/680266#M232519</link>
      <description>&lt;P&gt;Hi Guys, Thanks in Advance. So i have case conditions to be match in my splunk query.below the message based on correlationID.I want to show JobType and status. In status i added case like to match the conditions with message field.For the all three environment the message would be same but the environment name only differe.I added all the three in case. So how can we use wildcard in the case statement or any other different solutions to shorten the query.&lt;/P&gt;&lt;P&gt;(message="DEV(SUCCESS): Exchange Rates OnDemand Interface Run Report - Concur") OR ("TEST(SUCCESS): Exchange Rates OnDemand Interface Run Report - Concur") OR ("PRD(SUCCESS): Exchange Rates OnDemand Interface Run Report - Concur")&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(message="onDemand Flow for concur Expense Report file with FileID Started") OR (message="Exchange Rates Scheduler process started") OR (message="Exchange Rates Process Completed. File successfully sent to Concur*") OR (message="DEV(SUCCESS): Exchange Rates OnDemand Interface Run Report - Concur") OR ("TEST(SUCCESS): Exchange Rates OnDemand Interface Run Report - Concur") OR ("PRD(SUCCESS): Exchange Rates Interface Run Report - Concur")|transaction correlationId| rename timestamp as Timestamp correlationId as CorrelationId tracePoint as TracePoint content.payload.TargetFileName as TargetFileName | eval JobType=case(like('message',"%onDemand Flow for concur Expense Report file with FileID Started%"), "OnDemand",like('message',"%Exchange Rates Scheduler process started%"),"Scheduled", true() , "Unknown") | eval Status=case(like('message',"%Exchange Rates Process Completed. File sucessfully sent to Concur%"),"SUCCESS", like('message',"%TEST(SUCCESS): Exchange Rates OnDemand Interface Run Report - Concur%"),"SUCCESS", like('message',"%DEV(SUCCESS): Exchange Rates OnDemand Interface Run Report - Concur%"),"SUCCESS", like('message',"%PRD(SUCCESS): Exchange Rates OnDemand Interface Run Report - Concur"%"),"SUCCESS",like('TracePoint',"%EXCEPTION%"),"ERROR")&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 11 Mar 2024 10:44:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-wildcard-in-case-like-condition/m-p/680266#M232519</guid>
      <dc:creator>karthi2809</dc:creator>
      <dc:date>2024-03-11T10:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to use wildcard in case like condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-wildcard-in-case-like-condition/m-p/680275#M232522</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;case&lt;/FONT&gt; function does not support wildcards natively, but you can use them in &lt;FONT face="courier new,courier"&gt;like&lt;/FONT&gt; (as you have) or you can use the equivalent regular expression using &lt;FONT face="courier new,courier"&gt;match&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Status=case(like('message',"%Exchange Rates Process Completed. File sucessfully sent to Concur%"),"SUCCESS", match('message',"(TEST|DEV|PRD)\(SUCCESS): Exchange Rates OnDemand Interface Run Report - Concur"),"SUCCESS", like('TracePoint',"%EXCEPTION%"),"ERROR")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 16:18:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-wildcard-in-case-like-condition/m-p/680275#M232522</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-03-11T16:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to use wildcard in case like condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-wildcard-in-case-like-condition/m-p/680300#M232528</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;Its not working&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 15:35:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-wildcard-in-case-like-condition/m-p/680300#M232528</guid>
      <dc:creator>karthi2809</dc:creator>
      <dc:date>2024-03-11T15:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to use wildcard in case like condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-wildcard-in-case-like-condition/m-p/680303#M232529</link>
      <description>&lt;P&gt;"its not working" doesn't tell me what's wrong so it's hard to offer a fix.&amp;nbsp; It's possible, however, the regex needs improvement.&amp;nbsp; Please try my updated answer.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 16:18:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-wildcard-in-case-like-condition/m-p/680303#M232529</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-03-11T16:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to use wildcard in case like condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-wildcard-in-case-like-condition/m-p/680390#M232549</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you mentioned match condition in case statement.let me share the query.If i use match i am not getting the Status field&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="mule" applicationName="api" environment=DEV  timestamp (message="onDemand Flow for concur Expense Report file with FileID Started") OR (message="Exchange Rates Scheduler process started") OR (message="Exchange Rates Process Completed. File successfully sent to Concur*") OR (message="DEV(SUCCESS): Exchange Rates OnDemand Interface Run Report - Concur") OR ("TEST(SUCCESS): Exchange Rates OnDemand Interface Run Report - Concur") OR ("PRD(SUCCESS): Exchange Rates Interface Run Report - Concur")|transaction correlationId| rename timestamp as Timestamp correlationId as CorrelationId tracePoint as TracePoint content.payload.TargetFileName as TargetFileName
| eval JobType=case(like('message',"%onDemand Flow for concur Expense Report file with FileID Started%"),"OnDemand",like('message',"%Exchange Rates Scheduler process started%"),"Scheduled", true() , "Unknown") 
    | eval Status=case(like('message',"%Exchange Rates Process Completed. File sucessfully sent to Concur%"),"SUCCESS",match('message',"%(TEST|DEV|PRD)(SUCCESS): Exchange Rates OnDemand Interface Run Report - Concur%"),"SUCCESS",like('TracePoint',"%EXCEPTION%"),"ERROR") 
|eventstats min(Timestamp) AS Start_Time, max(Timestamp) AS End_Time by CorrelationId 
| eval StartTime=round(strptime(Start_Time, "%Y-%m-%dT%H:%M:%S.%QZ")) 
| eval EndTime=round(strptime(End_Time, "%Y-%m-%dT%H:%M:%S.%QZ")) 
| eval ElapsedTimeInSecs=EndTime-StartTime 
| eval "Total Elapsed Time"=strftime(ElapsedTimeInSecs,"%H:%M:%S") 
|rename Start_Time as Timestamp 
| table Status JobType ElapsedTimeInSecs "Total Elapsed Time" Timestamp CorrelationId message TargetFileName&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 12:39:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-wildcard-in-case-like-condition/m-p/680390#M232549</guid>
      <dc:creator>karthi2809</dc:creator>
      <dc:date>2024-03-12T12:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use wildcard in case like condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-wildcard-in-case-like-condition/m-p/680395#M232553</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;match&lt;/FONT&gt; function treats "%" as a literal character rather than as a wildcard.&amp;nbsp; Instead, &lt;FONT face="courier new,courier"&gt;match&lt;/FONT&gt; uses regular expressions.&amp;nbsp; Remove the "%" from the match string and you should get a status value.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 13:24:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-wildcard-in-case-like-condition/m-p/680395#M232553</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-03-12T13:24:34Z</dc:date>
    </item>
  </channel>
</rss>

