<?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 evaluate multiple fields and replace field output with new string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-evaluate-multiple-fields-and-replace-field-output-with/m-p/463375#M130630</link>
    <description>&lt;P&gt;Here's one way to do that.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval field7 = if(field5="success", field7, "string of my choice")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 09 Dec 2019 16:46:58 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2019-12-09T16:46:58Z</dc:date>
    <item>
      <title>How to evaluate multiple fields and replace field output with new string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-evaluate-multiple-fields-and-replace-field-output-with/m-p/463374#M130629</link>
      <description>&lt;P&gt;I have an issue where events are displaying incorrect information for a particular field in my search. &lt;/P&gt;

&lt;P&gt;Example:          &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mySearch | table field 1, field 2, field 3, field 4, field 5, field 6, field 7
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My problem is fields 4, 6, and 7 somewhat correspond with one another. &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;field 5 = errorCode&lt;BR /&gt;
field 6 = errorMessage &lt;BR /&gt;
field 7 = output string&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;If "field 5" = success ----------then "field 6" is null----------- and "field 7" shows the correct output string&lt;BR /&gt;
HOWEVER&lt;BR /&gt;
If "field 5" = an error code------- then "field 6" will show the error message-------BUT "field 7" shows the incorrect output string&lt;/P&gt;

&lt;P&gt;What I am trying to do is evaluate  "field 5", and if "Field 5" equals anything other than "success" string then "field 7" will equal a new string of my choice. If "field 5" equals "success" than leave "field 7" alone. &lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 16:22:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-evaluate-multiple-fields-and-replace-field-output-with/m-p/463374#M130629</guid>
      <dc:creator>garciajbg</dc:creator>
      <dc:date>2019-12-09T16:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to evaluate multiple fields and replace field output with new string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-evaluate-multiple-fields-and-replace-field-output-with/m-p/463375#M130630</link>
      <description>&lt;P&gt;Here's one way to do that.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval field7 = if(field5="success", field7, "string of my choice")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Dec 2019 16:46:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-evaluate-multiple-fields-and-replace-field-output-with/m-p/463375#M130630</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-12-09T16:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to evaluate multiple fields and replace field output with new string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-evaluate-multiple-fields-and-replace-field-output-with/m-p/463376#M130631</link>
      <description>&lt;P&gt;Richagalloway,&lt;/P&gt;

&lt;P&gt;I’ve tried this already but I can’t seem to get field 7 to show its default string. In the example given field 7 would show the name of field 7 rather than its original string if the search was run without the eval.&lt;/P&gt;

&lt;P&gt;For example, ran WITHOUT “eval” listed above.&lt;BR /&gt;
Field 5     Field 6     Field 7&lt;BR /&gt;
Success     null                success&lt;BR /&gt;
Error       ErrroMSG    success&lt;/P&gt;

&lt;P&gt;Where field 5 shows the incorrect field 7 string&lt;/P&gt;

&lt;P&gt;For example WITH “eval” listed above&lt;BR /&gt;
Field 5     Field 6     Field 7&lt;BR /&gt;
Success     null        Field 7&lt;BR /&gt;
Error       ErrorMSG    MyString&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 17:16:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-evaluate-multiple-fields-and-replace-field-output-with/m-p/463376#M130631</guid>
      <dc:creator>garciajbg</dc:creator>
      <dc:date>2019-12-09T17:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to evaluate multiple fields and replace field output with new string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-evaluate-multiple-fields-and-replace-field-output-with/m-p/463377#M130632</link>
      <description>&lt;P&gt;Please share your query.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 18:11:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-evaluate-multiple-fields-and-replace-field-output-with/m-p/463377#M130632</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-12-09T18:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to evaluate multiple fields and replace field output with new string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-evaluate-multiple-fields-and-replace-field-output-with/m-p/463378#M130633</link>
      <description>&lt;P&gt;richgalloway,&lt;/P&gt;

&lt;P&gt;So I was able to correct any issues by first renaming field 7 to something simple with no periods, spaces, etc. Once I did that and ran the search with the eval it worked as I wanted it to. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 19:09:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-evaluate-multiple-fields-and-replace-field-output-with/m-p/463378#M130633</guid>
      <dc:creator>garciajbg</dc:creator>
      <dc:date>2019-12-09T19:09:49Z</dc:date>
    </item>
  </channel>
</rss>

