<?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 How do you concatenate two values within a log into one field within a field transformation? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-concatenate-two-values-within-a-log-into-one-field/m-p/390175#M113648</link>
    <description>&lt;P&gt;I have a log source that breaks up a URL into different chunks (ie: domain, uri string, uri query, etc) within the log. All parts are getting parsed correctly and are labeled correctly... however, I would like the ability to create an &lt;STRONG&gt;additional field&lt;/STRONG&gt; with all the parts of the URL combined together in the correct order to make a complete URL... and then name that new field "url".&lt;/P&gt;

&lt;P&gt;Here's a sample log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2019-04-03 16:47:49 4 10.10.10.10 200 TCP_MISS 5005 723 GET https some.example.com 443 /1023/random/url_picture.png ?u=3892342034 UUser - some.example.com image/png &lt;A href="https://cdn.example.com/343/index.html" target="test_blank"&gt;https://cdn.example.com/343/index.html&lt;/A&gt; "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko" OBSERVED "Web Ads/Analytics;Content Servers" - 10.10.10.11 random-guid-string - - - 203.0.113.0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this log, there is a URL that is broken up into 3 main chunks. &lt;BR /&gt;
There is the main domain, &lt;STRONG&gt;some.example.com&lt;/STRONG&gt;, then the uri path, &lt;STRONG&gt;/1023/random/url_picture.png&lt;/STRONG&gt;, and then the uri query, &lt;STRONG&gt;?u=3892342034&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;I want to create an additional field called "url" that combines (concatenates) these 3 values together within the field so that the end result is "&lt;STRONG&gt;url=some.example.com/1023/random/url_picture.png?u=3892342034&lt;/STRONG&gt;"&lt;/P&gt;

&lt;P&gt;I do not have access to SSH on this Splunk instance, so I have to do it through the GUI.&lt;/P&gt;

&lt;P&gt;I have gone within the &lt;CODE&gt;Fields&amp;gt;Field transformations&lt;/CODE&gt; section and have attempted to create the new field by creating a regex-based transformation.&lt;/P&gt;

&lt;P&gt;I have the following expression:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^\d{4}\x2d\d{2}\x2d\d{2}\s\d{2}\x3a\d{2}\x3a\d{2}\s\d+\s(?:\S+\s){6}\S+\s(\S+)\s\S+\s(?:\x2d|(\S+))\s(?:\x2d|(\S+))\s
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This expression gets all the desired information within each capture group.&lt;/P&gt;

&lt;P&gt;So then, within the &lt;STRONG&gt;Format&lt;/STRONG&gt; section, I would normally put something like field_name::$1 (and so on)... but in this case I want to concatenate multiple captures and assign them to a single field named "url"&lt;/P&gt;

&lt;P&gt;So, I put &lt;CODE&gt;url::$1$2$3&lt;/CODE&gt; and hoped to see all three captures brought together... but instead, all I get is a statically set value for the new field named "url" of "$1$2$3".&lt;/P&gt;

&lt;P&gt;Does Splunk have a way to concatenate multiple captures from within a regular expression into a single field name?&lt;/P&gt;

&lt;P&gt;Hopefully this makes sense, and thanks for any help provided. &lt;/P&gt;</description>
    <pubDate>Wed, 03 Apr 2019 20:39:09 GMT</pubDate>
    <dc:creator>iomega311</dc:creator>
    <dc:date>2019-04-03T20:39:09Z</dc:date>
    <item>
      <title>How do you concatenate two values within a log into one field within a field transformation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-concatenate-two-values-within-a-log-into-one-field/m-p/390175#M113648</link>
      <description>&lt;P&gt;I have a log source that breaks up a URL into different chunks (ie: domain, uri string, uri query, etc) within the log. All parts are getting parsed correctly and are labeled correctly... however, I would like the ability to create an &lt;STRONG&gt;additional field&lt;/STRONG&gt; with all the parts of the URL combined together in the correct order to make a complete URL... and then name that new field "url".&lt;/P&gt;

&lt;P&gt;Here's a sample log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2019-04-03 16:47:49 4 10.10.10.10 200 TCP_MISS 5005 723 GET https some.example.com 443 /1023/random/url_picture.png ?u=3892342034 UUser - some.example.com image/png &lt;A href="https://cdn.example.com/343/index.html" target="test_blank"&gt;https://cdn.example.com/343/index.html&lt;/A&gt; "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko" OBSERVED "Web Ads/Analytics;Content Servers" - 10.10.10.11 random-guid-string - - - 203.0.113.0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this log, there is a URL that is broken up into 3 main chunks. &lt;BR /&gt;
There is the main domain, &lt;STRONG&gt;some.example.com&lt;/STRONG&gt;, then the uri path, &lt;STRONG&gt;/1023/random/url_picture.png&lt;/STRONG&gt;, and then the uri query, &lt;STRONG&gt;?u=3892342034&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;I want to create an additional field called "url" that combines (concatenates) these 3 values together within the field so that the end result is "&lt;STRONG&gt;url=some.example.com/1023/random/url_picture.png?u=3892342034&lt;/STRONG&gt;"&lt;/P&gt;

&lt;P&gt;I do not have access to SSH on this Splunk instance, so I have to do it through the GUI.&lt;/P&gt;

&lt;P&gt;I have gone within the &lt;CODE&gt;Fields&amp;gt;Field transformations&lt;/CODE&gt; section and have attempted to create the new field by creating a regex-based transformation.&lt;/P&gt;

&lt;P&gt;I have the following expression:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^\d{4}\x2d\d{2}\x2d\d{2}\s\d{2}\x3a\d{2}\x3a\d{2}\s\d+\s(?:\S+\s){6}\S+\s(\S+)\s\S+\s(?:\x2d|(\S+))\s(?:\x2d|(\S+))\s
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This expression gets all the desired information within each capture group.&lt;/P&gt;

&lt;P&gt;So then, within the &lt;STRONG&gt;Format&lt;/STRONG&gt; section, I would normally put something like field_name::$1 (and so on)... but in this case I want to concatenate multiple captures and assign them to a single field named "url"&lt;/P&gt;

&lt;P&gt;So, I put &lt;CODE&gt;url::$1$2$3&lt;/CODE&gt; and hoped to see all three captures brought together... but instead, all I get is a statically set value for the new field named "url" of "$1$2$3".&lt;/P&gt;

&lt;P&gt;Does Splunk have a way to concatenate multiple captures from within a regular expression into a single field name?&lt;/P&gt;

&lt;P&gt;Hopefully this makes sense, and thanks for any help provided. &lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 20:39:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-concatenate-two-values-within-a-log-into-one-field/m-p/390175#M113648</guid>
      <dc:creator>iomega311</dc:creator>
      <dc:date>2019-04-03T20:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do you concatenate two values within a log into one field within a field transformation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-concatenate-two-values-within-a-log-into-one-field/m-p/390176#M113649</link>
      <description>&lt;P&gt;You could do that in the search time, say &lt;CODE&gt;your search | eval url=domain_name.uri_path.uri_query&lt;/CODE&gt;  using concatenation. would this be acceptable? You can also put that in to a macro, if you use it more often.  There are also URL tools and parser in splunk base if you are interested - &lt;A href="https://splunkbase.splunk.com/app/2734/"&gt;https://splunkbase.splunk.com/app/2734/&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2019 05:52:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-concatenate-two-values-within-a-log-into-one-field/m-p/390176#M113649</guid>
      <dc:creator>lakshman239</dc:creator>
      <dc:date>2019-04-04T05:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do you concatenate two values within a log into one field within a field transformation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-concatenate-two-values-within-a-log-into-one-field/m-p/390177#M113650</link>
      <description>&lt;P&gt;You cannot do concatenated values in search time field extractions like you tried.&lt;/P&gt;

&lt;P&gt;For this you create a calculated field (which is similar to eval expressions in the search bar). In the GUI you find that under Settings -&amp;gt; Fields -&amp;gt; Calculated Fields.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2019 06:59:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-concatenate-two-values-within-a-log-into-one-field/m-p/390177#M113650</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-04-04T06:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do you concatenate two values within a log into one field within a field transformation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-concatenate-two-values-within-a-log-into-one-field/m-p/390178#M113651</link>
      <description>&lt;P&gt;If the field is extracted via inline or REPORT, search time extract will still work for concatenate, as per the precedence rule. However , using EVAL-url=domain_name.uri_path.uri_query  in props, could be better option.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:01:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-concatenate-two-values-within-a-log-into-one-field/m-p/390178#M113651</guid>
      <dc:creator>lakshman239</dc:creator>
      <dc:date>2020-09-30T00:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do you concatenate two values within a log into one field within a field transformation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-concatenate-two-values-within-a-log-into-one-field/m-p/390179#M113652</link>
      <description>&lt;P&gt;Not sure what you mean, transforms.conf spec is very clear about using FORMAT to create concatenated fields:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  * At index time only, you can use FORMAT to create concatenated fields:
    * Example: FORMAT = ipaddress::$1.$2.$3.$4
...
  * NOTE: You cannot create concatenated fields with FORMAT at search time.
    That functionality is only available at index time.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Using an EVAL (which can be defined from GUI as a Calculated Field) is the only option (apart from doing something similar in the query itself).&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2019 12:20:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-concatenate-two-values-within-a-log-into-one-field/m-p/390179#M113652</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-04-04T12:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do you concatenate two values within a log into one field within a field transformation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-concatenate-two-values-within-a-log-into-one-field/m-p/390180#M113653</link>
      <description>&lt;P&gt;Yeah, that was working great added to a search, but what I wanted was a parsed field all ready to go without having to add that search into every spot.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2019 14:32:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-concatenate-two-values-within-a-log-into-one-field/m-p/390180#M113653</guid>
      <dc:creator>iomega311</dc:creator>
      <dc:date>2019-04-05T14:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do you concatenate two values within a log into one field within a field transformation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-concatenate-two-values-within-a-log-into-one-field/m-p/390181#M113654</link>
      <description>&lt;P&gt;Thanks for pointing me to the calculated field section, I was able to get the result without using a regex, but instead just created the eval expression to say "domain_name + uri_path + uri_query" and called it "url".&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:02:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-concatenate-two-values-within-a-log-into-one-field/m-p/390181#M113654</guid>
      <dc:creator>iomega311</dc:creator>
      <dc:date>2020-09-30T00:02:31Z</dc:date>
    </item>
  </channel>
</rss>

