<?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: If / Then Conditional. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/If-Then-Conditional/m-p/514590#M144441</link>
    <description>&lt;P&gt;what's the logs.&lt;BR /&gt;your regex is not good.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Aug 2020 05:13:54 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-08-18T05:13:54Z</dc:date>
    <item>
      <title>If / Then Conditional.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Then-Conditional/m-p/514588#M144440</link>
      <description>&lt;P&gt;Heres what i'm trying to accomplish:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;requestID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;status&lt;BR /&gt;123456&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;errored&lt;BR /&gt;321654&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Success&lt;BR /&gt;789456&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;errored&lt;BR /&gt;&lt;BR /&gt;I'm Newbie, Maybe i'm going about this all wrong, and there maybe another way....but i don't think so based on what info i have. but heres what i got so far. I'm probably over-thinking this.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;index=someindex sourcetype=sometype "request syntax" OR "error syntax" OR "success syntax"&lt;BR /&gt;| rex field=_raw "request id: '(?&amp;lt;requestID&amp;gt;\d+)',\text"&lt;BR /&gt;| rex field=_raw ".*(?&amp;lt;error&amp;gt;Error response received)\stext"&lt;BR /&gt;| rex field=_raw ".*(?&amp;lt;Success&amp;gt;Database request executed):\stext"&lt;BR /&gt;| eval requestID =if(requestID=(error),"Errored", "Success")&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 04:24:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Then-Conditional/m-p/514588#M144440</guid>
      <dc:creator>codichulo</dc:creator>
      <dc:date>2020-08-18T04:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: If / Then Conditional.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Then-Conditional/m-p/514590#M144441</link>
      <description>&lt;P&gt;what's the logs.&lt;BR /&gt;your regex is not good.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 05:13:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Then-Conditional/m-p/514590#M144441</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-08-18T05:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: If / Then Conditional.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Then-Conditional/m-p/514592#M144443</link>
      <description>&lt;P&gt;There are a couple of oddities/errors in your query, e.g. there is no 's' after the \ in the request ID rex statement and the if statement would not need the () round error, however, it depends on your data as to what your query should look like - can you provide a sample?&lt;/P&gt;&lt;P&gt;However,&amp;nbsp; from your example query, this might be better (I have removed the trailing data outside the field capture group&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=someindex sourcetype=sometype "request syntax" OR "error syntax" OR "success syntax"
| rex field=_raw "request id: '(?&amp;lt;requestID&amp;gt;\d+)'"
| rex field=_raw ".*(?&amp;lt;error&amp;gt;Error response received)"
| rex field=_raw ".*(?&amp;lt;Success&amp;gt;Database request executed)"
| eval status=if(requestID=error,"Errored", "Success")&lt;/LI-CODE&gt;&lt;P&gt;this is assuming that the rex statement extracting the field 'error' will give the same value as the requestID field. What is your intention with Success field extraction&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 05:16:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Then-Conditional/m-p/514592#M144443</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-08-18T05:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: If / Then Conditional.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-Then-Conditional/m-p/514697#M144473</link>
      <description>&lt;P&gt;oh sorry, the rex statements are working fine, i just removed identifiable info to make them look generic, and in doing so made them look in error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;it was the eval statement that i couldn't get to work right. I'll try your suggestion. Thanks so much.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 13:21:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-Then-Conditional/m-p/514697#M144473</guid>
      <dc:creator>codichulo</dc:creator>
      <dc:date>2020-08-18T13:21:40Z</dc:date>
    </item>
  </channel>
</rss>

