<?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 make another search in if condition using eval in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-another-search-in-if-condition-using-eval/m-p/510813#M143036</link>
    <description>&lt;P&gt;| where searchmatch("Transmission Complete") OR status="Failed"&lt;BR /&gt;| eval Status=if(status="Failed",status,"&lt;SPAN&gt;Successful")&lt;BR /&gt;&lt;/SPAN&gt;| eval Reason = if(status="Failed",_raw,"NA")&lt;BR /&gt;&lt;BR /&gt;add above.&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jul 2020 09:32:19 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-07-24T09:32:19Z</dc:date>
    <item>
      <title>How to make another search in if condition using eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-another-search-in-if-condition-using-eval/m-p/510374#M142845</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I think this might be simple but need some guidance.&amp;nbsp;Any help would be really appreciated.&lt;/P&gt;&lt;P&gt;I have a log and in which, I have to check the successful transmission for all countries.&lt;BR /&gt;When some transmission is failed, I have to show the reason or error for that country.&lt;/P&gt;&lt;P&gt;Below is the sample data:&lt;/P&gt;&lt;P&gt;Status--20/07/2020 12:18:15--CALC_RFS_TUE_PM--(KE)--0 : - Initializing Communications...&lt;BR /&gt;Status--20/07/2020 12:18:15--CALC_RFS_TUE_PM--(KE)--0 : - Sending Sender Information...&lt;BR /&gt;Status--20/07/2020 12:18:15--CALC_RFS_TUE_PM--(KE)--0 : - Sending Recipient Information...&lt;BR /&gt;Status--20/07/2020 12:18:15--CALC_RFS_TUE_PM--(KE)--0 : - Sending Message...&lt;BR /&gt;Status--20/07/2020 12:18:15--CALC_RFS_TUE_PM--(KE)--0 : - Transmission Complete&lt;BR /&gt;Success--20/07/2020 12:19:10--CALC_RFS_TUE_PM--(MY)---2207217873 :ORA-00001: unique constraint (WIMS.PK_TB_TRN_FCST_DAILY) violated&lt;BR /&gt;ORA-06512: at "WIMS.SP_BUILD_FCST", line 573&lt;BR /&gt;- ForeCast data committed successfully.&lt;BR /&gt;Failed--20/07/2020 12:19:10--CALC_RFS_TUE_PM--(MY)---2207217873 :ORA-00001: unique constraint (WIMS.PK_TB_TRN_FCST_DAILY) violated&lt;BR /&gt;ORA-06512: at "WIMS.SP_BUILD_FCST", line 573&lt;BR /&gt;- RFS calculation failed&lt;BR /&gt;Trace--20/07/2020 12:19:10--CALC_RFS_TUE_PM--(MY)---2207217873 :ORA-00001: unique constraint (WIMS.PK_TB_TRN_FCST_DAILY) violated&lt;BR /&gt;ORA-06512: at "WIMS.SP_BUILD_FCST", line 573&lt;BR /&gt;- Connecting to SMTP server for attempt:1&lt;BR /&gt;Status--20/07/2020 12:19:10--CALC_RFS_TUE_PM--(MY)---2207217873 :ORA-00001: unique constraint (WIMS.PK_TB_TRN_FCST_DAILY) violated&lt;BR /&gt;ORA-06512: at "WIMS.SP_BUILD_FCST", line 573&lt;BR /&gt;- Connecting to SMTP Server (notesGWEUR.MICHELIN.com )...&lt;BR /&gt;Status--20/07/2020 12:19:10--CALC_RFS_TUE_PM--(MY)---2207217873 :ORA-00001: unique constraint (WIMS.PK_TB_TRN_FCST_DAILY) violated&lt;BR /&gt;ORA-06512: at "WIMS.SP_BUILD_FCST", line 573&lt;BR /&gt;- Initializing Communications...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here "KE" and "MY" are the countries.&lt;BR /&gt;&lt;BR /&gt;I have tried like below, but giving errors.&lt;/P&gt;&lt;P&gt;| makeresults&lt;BR /&gt;| eval Possible_ORs="AU,MY,KE,JP,SI,VN,ID,TD,KO,J1"&lt;BR /&gt;| eval Possible_ORs=split(Possible_ORs, ",")&lt;BR /&gt;| mvexpand Possible_ORs&lt;BR /&gt;| eval count=0&lt;BR /&gt;| rename Possible_ORs as "ORs"&lt;BR /&gt;| fields - _time&lt;BR /&gt;| append [| search sourcetype=RFS_Log | rex "Status\W+(?P&amp;lt;Date&amp;gt;\d{1,2}\/\d{1,2}\/\d+\s+\d+\W+\d+\W+\d+).*(?P&amp;lt;OR_NAME&amp;gt;[A-Z]{2}).*Transmission\s+Complete"&lt;BR /&gt;| eval Date=strftime(Date, "%Y-%m-%d %H:%M:%S")&lt;BR /&gt;| eval ORs=OR_NAME | eval ORs = split(ORs,",") | mvexpand ORs | eval count=1&lt;BR /&gt;| fields - _raw _time]&lt;BR /&gt;| dedup ORs sortby - count&lt;BR /&gt;| eval Job Name=case(count&amp;gt;=0, "RFS Calculation")&lt;BR /&gt;| eval Status=case(count&amp;gt;0, "Calculation Successful", count=0, "Calculation Failed")&lt;BR /&gt;| eval Status=if(isnull(Status), "Calculation Failed", Status)&lt;BR /&gt;| eval Reason=if(Status="Calculation Failed",&lt;BR /&gt;[search sourcetype=RFS_Log&lt;BR /&gt;| rex "Status\W+\d{1,2}\/\d{1,2}\/\d+\s+\d+\W+\d+\W+\d+.*(?P&amp;lt;OR_NAME&amp;gt;[A-Z]{2}).*violated"],&lt;BR /&gt;"failed")&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 08:17:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-another-search-in-if-condition-using-eval/m-p/510374#M142845</guid>
      <dc:creator>mnarmada</dc:creator>
      <dc:date>2020-07-22T08:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to make another search in if condition using eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-another-search-in-if-condition-using-eval/m-p/510772#M143019</link>
      <description>&lt;P&gt;Please reply if someone know the how to figure it out..&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2020 03:44:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-another-search-in-if-condition-using-eval/m-p/510772#M143019</guid>
      <dc:creator>mnarmada</dc:creator>
      <dc:date>2020-07-24T03:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to make another search in if condition using eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-another-search-in-if-condition-using-eval/m-p/510804#M143031</link>
      <description>&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="Status--20/07/2020 12:18:15--CALC_RFS_TUE_PM--(KE)--0 : - Initializing Communications...
Status--20/07/2020 12:18:15--CALC_RFS_TUE_PM--(KE)--0 : - Sending Sender Information...
Status--20/07/2020 12:18:15--CALC_RFS_TUE_PM--(KE)--0 : - Sending Recipient Information...
Status--20/07/2020 12:18:15--CALC_RFS_TUE_PM--(KE)--0 : - Sending Message...
Status--20/07/2020 12:18:15--CALC_RFS_TUE_PM--(KE)--0 : - Transmission Complete
Success--20/07/2020 12:19:10--CALC_RFS_TUE_PM--(MY)---2207217873 :ORA-00001: unique constraint (WIMS.PK_TB_TRN_FCST_DAILY) violated
ORA-06512: at \"WIMS.SP_BUILD_FCST\", line 573
- ForeCast data committed successfully.
Failed--20/07/2020 12:19:10--CALC_RFS_TUE_PM--(MY)---2207217873 :ORA-00001: unique constraint (WIMS.PK_TB_TRN_FCST_DAILY) violated
ORA-06512: at \"WIMS.SP_BUILD_FCST\", line 573
- RFS calculation failed
Trace--20/07/2020 12:19:10--CALC_RFS_TUE_PM--(MY)---2207217873 :ORA-00001: unique constraint (WIMS.PK_TB_TRN_FCST_DAILY) violated
ORA-06512: at \"WIMS.SP_BUILD_FCST\", line 573
- Connecting to SMTP server for attempt:1
Status--20/07/2020 12:19:10--CALC_RFS_TUE_PM--(MY)---2207217873 :ORA-00001: unique constraint (WIMS.PK_TB_TRN_FCST_DAILY) violated
ORA-06512: at \"WIMS.\", line 573
- Connecting to SMTP Server (notesGWEUR.MICHELIN.com )...
Status--20/07/2020 12:19:10--CALC_RFS_TUE_PM--(MY)---2207217873 :ORA-00001: unique constraint (WIMS.PK_TB_TRN_FCST_DAILY) violated
ORA-06512: at \"WIMS.SP_BUILD_FCST\", line 573
- Initializing Communications..."
| rex mode=sed "s/(?ms)^(\w+--)/#\1/g"
| makemv delim="#" _raw
| rename _raw as raw
| mvexpand raw
| rename raw as _raw
| rex "(?ms)(?&amp;lt;status&amp;gt;\w+)\-\-(?&amp;lt;date&amp;gt;\S+ \S+)\-\-\w+\-\-\((?&amp;lt;country&amp;gt;\w\w)\)\-\-\-?\d+ :.*\- (?&amp;lt;message&amp;gt;[^-]+)"
| eval _time=strptime(date,"%d/%m/%Y %T")&lt;/LI-CODE&gt;&lt;P&gt;I'm not sure the status and condition.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2020 08:27:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-another-search-in-if-condition-using-eval/m-p/510804#M143031</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-07-24T08:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to make another search in if condition using eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-another-search-in-if-condition-using-eval/m-p/510812#M143035</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/184221"&gt;@to4kawa&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for the response!&lt;/P&gt;&lt;P&gt;Let me put the question more clear.&lt;/P&gt;&lt;P&gt;For example, I have 10 countries, for which I have to check whether the transmission is successful or not.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the transmission is not success the I have to show, what error has been occurred.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the log, Successful transmission can be determined by the below line:&lt;/P&gt;&lt;PRE&gt;Status--20/07/2020 12:18:15--CALC_RFS_TUE_PM--(KE)--0 : - Transmission Complete&lt;/PRE&gt;&lt;P&gt;If this line is not available for any of the countries, it should show the status as failed and show the error message in the reason column.&lt;/P&gt;&lt;P&gt;Expected Output:&lt;/P&gt;&lt;P&gt;SNo&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Country&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Status&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Reason&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;KE&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;2020-07-20 12:18:15&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Successful&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AU&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2020-07-20 12:18:15&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Successful&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SI&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2020-07-20 12:18:15&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Successful&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MY&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2020-07-20 12:18:15&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Failed&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Failed--20/07/2020 12:19:10--CALC_RFS_TUE_PM--(MY)---2207217873 :ORA-00001: unique constraint (WIMS.PK_TB_TRN_FCST_DAILY) violated&lt;BR /&gt;ORA-06512: at "WIMS.SP_BUILD_FCST", line 573&lt;BR /&gt;- RFS calculation failed&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TD&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2020-07-20 12:18:15&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Failed&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;Failed--20/07/2020 12:19:10--CALC_RFS_TUE_PM--(TD)---2207217873 :ORA-00001: unique constraint (WIMS.PK_TB_TRN_FCST_DAILY) violated&lt;BR /&gt;ORA-06512: at "WIMS.SP_BUILD_FCST", line 573&lt;BR /&gt;- RFS calculation failed&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2020 09:18:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-another-search-in-if-condition-using-eval/m-p/510812#M143035</guid>
      <dc:creator>mnarmada</dc:creator>
      <dc:date>2020-07-24T09:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to make another search in if condition using eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-another-search-in-if-condition-using-eval/m-p/510813#M143036</link>
      <description>&lt;P&gt;| where searchmatch("Transmission Complete") OR status="Failed"&lt;BR /&gt;| eval Status=if(status="Failed",status,"&lt;SPAN&gt;Successful")&lt;BR /&gt;&lt;/SPAN&gt;| eval Reason = if(status="Failed",_raw,"NA")&lt;BR /&gt;&lt;BR /&gt;add above.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2020 09:32:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-another-search-in-if-condition-using-eval/m-p/510813#M143036</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-07-24T09:32:19Z</dc:date>
    </item>
  </channel>
</rss>

