<?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 can I eval a new field using only partial values from existing field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-eval-a-new-field-using-only-partial-values-from/m-p/295668#M89204</link>
    <description>&lt;P&gt;Try &lt;CODE&gt;case&lt;/CODE&gt;.  This example sets action to "success" and "failure" as you want.  Other values for vendor_action will assign NULL to action.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index sourcetype=sourcetype | eval action=case(vendor_action == "Passed_Authentications", "success", vendor_action=="Failed_Attempts", "failure") 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 15 Feb 2018 17:32:15 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2018-02-15T17:32:15Z</dc:date>
    <item>
      <title>How can I eval a new field using only partial values from existing field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-eval-a-new-field-using-only-partial-values-from/m-p/295667#M89203</link>
      <description>&lt;P&gt;Apologies if my question's title is non-descriptive. I am working through extracting an 'action' field from an existing values in the vendor_action field. Right now, there are multiple value results in the field 'vendor_action' and I'm looking to limit those results to only 2. &lt;/P&gt;

&lt;P&gt;vendor_action field has values of  "Radius Accounting, Passed_Authentications, Failed_Attempts, Administrative_and_Operational Audit.. etc.. etc..&lt;/P&gt;

&lt;P&gt;I'm trying to just focus on "Passed_Authentications, and Failed_Attempts" and ultimately eval 'success' and 'failure' as the values of the action field. This is where I've gotten so far:&lt;/P&gt;

&lt;P&gt;index=index sourcetype=sourcetype | eval action=if(vendor_action == "Passed_Authentications", "success", "failure") - this successfully extracts the action field and gives me 'success' where 'Passed_Authentications' is found but unfortunately defaults all other events to failure. I'm hoping to devise a way to ultimately create the action field and have it translate to success when vendor_action is equal to Passed_Authentications and failure when vendor_action is equal to Failed_Attemps and disregard all other vendor_action values. &lt;/P&gt;

&lt;P&gt;Any help would be much appreciated! &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:07:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-eval-a-new-field-using-only-partial-values-from/m-p/295667#M89203</guid>
      <dc:creator>SMWickman</dc:creator>
      <dc:date>2020-09-29T18:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: How can I eval a new field using only partial values from existing field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-eval-a-new-field-using-only-partial-values-from/m-p/295668#M89204</link>
      <description>&lt;P&gt;Try &lt;CODE&gt;case&lt;/CODE&gt;.  This example sets action to "success" and "failure" as you want.  Other values for vendor_action will assign NULL to action.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index sourcetype=sourcetype | eval action=case(vendor_action == "Passed_Authentications", "success", vendor_action=="Failed_Attempts", "failure") 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 17:32:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-eval-a-new-field-using-only-partial-values-from/m-p/295668#M89204</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-02-15T17:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I eval a new field using only partial values from existing field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-eval-a-new-field-using-only-partial-values-from/m-p/295669#M89205</link>
      <description>&lt;P&gt;Thank you very much!!!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 17:36:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-eval-a-new-field-using-only-partial-values-from/m-p/295669#M89205</guid>
      <dc:creator>SMWickman</dc:creator>
      <dc:date>2018-02-15T17:36:24Z</dc:date>
    </item>
  </channel>
</rss>

