<?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 do I concatenate two fields into a string? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/73364#M18354</link>
    <description>&lt;P&gt;Well...a typo did it.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;eval fullName=applicationName. "-" .servletName&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Turns out that not putting the right name of a field causes the entire operation to return nada.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Oct 2010 01:10:29 GMT</pubDate>
    <dc:creator>brettgladys</dc:creator>
    <dc:date>2010-10-20T01:10:29Z</dc:date>
    <item>
      <title>How do I concatenate two fields into a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/73363#M18353</link>
      <description>&lt;P&gt;I have two fields, application and servletName.  I'd like to have them as column names in a chart.  I'm currently trying to use eval to make a new variable named fullName, and concatenate the values for application and servletName with a dash(-) in the middle.  How do I do this?&lt;/P&gt;

&lt;P&gt;Thanks,
Brett&lt;/P&gt;</description>
      <pubDate>Wed, 20 Oct 2010 01:04:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/73363#M18353</guid>
      <dc:creator>brettgladys</dc:creator>
      <dc:date>2010-10-20T01:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I concatenate two fields into a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/73364#M18354</link>
      <description>&lt;P&gt;Well...a typo did it.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;eval fullName=applicationName. "-" .servletName&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Turns out that not putting the right name of a field causes the entire operation to return nada.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Oct 2010 01:10:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/73364#M18354</guid>
      <dc:creator>brettgladys</dc:creator>
      <dc:date>2010-10-20T01:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I concatenate two fields into a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/73365#M18355</link>
      <description>&lt;P&gt;You can use the &lt;A href="http://www.splunk.com/base/Documentation/latest/SearchReference/Eval"&gt;eval&lt;/A&gt; search command for this.&lt;/P&gt;

&lt;P&gt;Concatenate fieldA, a dash, and fieldB into newField:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval newField= fieldA."-".fieldB
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Oct 2010 01:12:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/73365#M18355</guid>
      <dc:creator>ftk</dc:creator>
      <dc:date>2010-10-20T01:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I concatenate two fields into a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/73366#M18356</link>
      <description>&lt;P&gt;This is a question that has many hits. I just wanted to point out that there is another possibility&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;basesearch&amp;gt; | strcat field1 " some text: " field2 " more text: " field3 newField
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will concatenate fields and text to the new field 'newField'&lt;/P&gt;

&lt;P&gt;strcat has the advantage that it will still create the new field if one of the fields that are concatenated are empty/missing&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/strcat"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/strcat&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 10:54:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/73366#M18356</guid>
      <dc:creator>chris</dc:creator>
      <dc:date>2016-07-07T10:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I concatenate two fields into a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/73367#M18357</link>
      <description>&lt;P&gt;Amazing, this is exactly what I've been looking for, ty!&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 18:44:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/73367#M18357</guid>
      <dc:creator>bcronrath</dc:creator>
      <dc:date>2016-07-27T18:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I concatenate two fields into a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/73368#M18358</link>
      <description>&lt;P&gt;Excellent! This is what I needed to concatenate a tag to another string.  Eval is not working for this, but this is :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| strcat host "(" tag::host ")" label
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Aug 2019 08:14:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/73368#M18358</guid>
      <dc:creator>simonverzijl</dc:creator>
      <dc:date>2019-08-23T08:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I concatenate two fields into a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/512606#M143778</link>
      <description>&lt;P&gt;You can concatenate two fields using eval&lt;/P&gt;&lt;P&gt;ex: eval Full_Name= 'First Name'. " " .'Last Name'&lt;/P&gt;</description>
      <pubDate>Wed, 05 Aug 2020 15:49:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/512606#M143778</guid>
      <dc:creator>raghuramj</dc:creator>
      <dc:date>2020-08-05T15:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I concatenate two fields into a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/603214#M209928</link>
      <description>&lt;P&gt;'strcat' works great for more than two fields as well. The 'allrequired=f' flag also allows you to concatenate the fields that exist and ignore those that don't.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;| strcat allrequired=f email "|" uname "|" secondaryuname identity&lt;BR /&gt;&lt;BR /&gt;The above will combine the three fields, 'email', 'uname', and 'secondaryuname' into the single field 'identity', delimitating by the pipe character.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 20:11:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/603214#M209928</guid>
      <dc:creator>hoben</dc:creator>
      <dc:date>2022-06-24T20:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I concatenate two fields into a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/629125#M218532</link>
      <description>&lt;P&gt;I accepted this as the solution because it was the earliest one that mentioned eval with periods/dots for the concatenation which is the most common approach I've seen in the last 12 years since this answer was written.&lt;/P&gt;&lt;P&gt;Nice work!&lt;/P&gt;&lt;P&gt;I do believe the | strcat works too, but didnt check before writing this.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 12:00:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-concatenate-two-fields-into-a-string/m-p/629125#M218532</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2023-02-01T12:00:51Z</dc:date>
    </item>
  </channel>
</rss>

