<?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 combine two fields into one after if without losing values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-fields-into-one-after-if-without-losing/m-p/568865#M198267</link>
    <description>&lt;P&gt;Yes, but all the field values are overwritten by the uri field value from the eval if&lt;/P&gt;</description>
    <pubDate>Wed, 29 Sep 2021 01:16:22 GMT</pubDate>
    <dc:creator>ebs</dc:creator>
    <dc:date>2021-09-29T01:16:22Z</dc:date>
    <item>
      <title>How to combine two fields into one after if without losing values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-fields-into-one-after-if-without-losing/m-p/568857#M198262</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a uri_path that I want to combine into a single value, and put the combined value back into the original field and I have achieved that with the below search:&lt;/P&gt;&lt;P&gt;index=ping_sandbox uri_path=/as/*/resume/as/authorization&lt;BR /&gt;| eval uri=if(like(uri_path, "/as/%/resume/as/authorization"), "resume/as/authorization", uri)&lt;BR /&gt;| eval uri_path=mvappend(uri, url_path)&lt;/P&gt;&lt;P&gt;However, not every uri_path is&amp;nbsp;/as/*/resume/as/authorization, and when I remove the uri_path search value, all the other uri_path values are gone.&lt;/P&gt;&lt;P&gt;For example, here's 3 values /1 /2 /3, and if I do the above eval statements for&amp;nbsp;/as/*/resume/as/authorization I don't have /1 /2 or /3 anymore.&lt;/P&gt;&lt;P&gt;Does anyone have any advice on how to do the above eval statements while still retaining the rest of the field values? I only want the eval statements applied if&amp;nbsp;/as/*/resume/as/authorization is present as well&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 23:57:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-fields-into-one-after-if-without-losing/m-p/568857#M198262</guid>
      <dc:creator>ebs</dc:creator>
      <dc:date>2021-09-28T23:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two fields into one after if without losing values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-fields-into-one-after-if-without-losing/m-p/568861#M198264</link>
      <description>&lt;P&gt;Have you tried this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=ping_sandbox uri_path=*
| eval uri=if(like(uri_path, "/as/%/resume/as/authorization"), "resume/as/authorization", uri)
| eval uri_path=mvappend(uri, url_path)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 29 Sep 2021 00:25:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-fields-into-one-after-if-without-losing/m-p/568861#M198264</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-09-29T00:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two fields into one after if without losing values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-fields-into-one-after-if-without-losing/m-p/568865#M198267</link>
      <description>&lt;P&gt;Yes, but all the field values are overwritten by the uri field value from the eval if&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 01:16:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-fields-into-one-after-if-without-losing/m-p/568865#M198267</guid>
      <dc:creator>ebs</dc:creator>
      <dc:date>2021-09-29T01:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two fields into one after if without losing values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-fields-into-one-after-if-without-losing/m-p/568870#M198271</link>
      <description>&lt;P&gt;It looks like you have 2 typos in your SPL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval uri=if(like(uri_path, "/as/%/resume/as/authorization"), "resume/as/authorization", uri_path)
| eval uri_path=mvappend(uri, uri_path)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3rd param to if should be uri_path - you had uri&lt;/P&gt;&lt;P&gt;2nd param to mvappend() was url_path, should be uri_path&lt;/P&gt;&lt;P&gt;HOWEVER, you can do this with a single line&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval uri_path=if(like(uri_path, "/as/%/resume/as/authorization"), mvappend("resume/as/authorization", uri_path), uri_path)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 04:48:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-fields-into-one-after-if-without-losing/m-p/568870#M198271</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-09-29T04:48:37Z</dc:date>
    </item>
  </channel>
</rss>

