<?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 Combining two fields with a constant string between in Splunk Enterprise Security</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482740#M7816</link>
    <description>&lt;P&gt;I am pulling two fields from a CSV based off of a field in live logs, then combining them into one field with a constant string in between them.&lt;BR /&gt;
What I have tried thus far :&lt;/P&gt;

&lt;P&gt;|eval field3=field1." - ".field2&lt;BR /&gt;
|eval field3=field1 + " - " + field2&lt;BR /&gt;
|eval field3=if(field1="&lt;EM&gt;", field1." - ".field2, "didnt work")&lt;BR /&gt;
|eval field3=if(field1="&lt;/EM&gt;", field1 + " - " + field2, "didnt work")&lt;BR /&gt;
|eval field3=if(NOT (field1=""), field1." - ".field2, "didnt work")&lt;BR /&gt;
|eval field3=if( NOT (field1=""), field1 + " - " + field2, "didnt work")&lt;/P&gt;

&lt;P&gt;None of these work. Even with a fillnull before them.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Feb 2020 16:55:04 GMT</pubDate>
    <dc:creator>Braagi</dc:creator>
    <dc:date>2020-02-25T16:55:04Z</dc:date>
    <item>
      <title>Combining two fields with a constant string between</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482740#M7816</link>
      <description>&lt;P&gt;I am pulling two fields from a CSV based off of a field in live logs, then combining them into one field with a constant string in between them.&lt;BR /&gt;
What I have tried thus far :&lt;/P&gt;

&lt;P&gt;|eval field3=field1." - ".field2&lt;BR /&gt;
|eval field3=field1 + " - " + field2&lt;BR /&gt;
|eval field3=if(field1="&lt;EM&gt;", field1." - ".field2, "didnt work")&lt;BR /&gt;
|eval field3=if(field1="&lt;/EM&gt;", field1 + " - " + field2, "didnt work")&lt;BR /&gt;
|eval field3=if(NOT (field1=""), field1." - ".field2, "didnt work")&lt;BR /&gt;
|eval field3=if( NOT (field1=""), field1 + " - " + field2, "didnt work")&lt;/P&gt;

&lt;P&gt;None of these work. Even with a fillnull before them.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2020 16:55:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482740#M7816</guid>
      <dc:creator>Braagi</dc:creator>
      <dc:date>2020-02-25T16:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two fields with a constant string between</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482741#M7817</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Try field1 and field2 with a single quote&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval field1="test",field2="test2" 
| eval field3='field1'."-".'field2'
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Feb 2020 17:24:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482741#M7817</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2020-02-25T17:24:20Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two fields with a constant string between</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482742#M7818</link>
      <description>&lt;P&gt;Even though it was basically the first option that was attempted, I tried it with the single-quotes...&lt;BR /&gt;
...to no avail.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2020 18:11:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482742#M7818</guid>
      <dc:creator>Braagi</dc:creator>
      <dc:date>2020-02-25T18:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two fields with a constant string between</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482743#M7819</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;|eval field3=mvappend(field1,field2)
|eval field3=mvjoin(field3,"-")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;maybe, some fields has null.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2020 21:04:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482743#M7819</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-25T21:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two fields with a constant string between</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482744#M7820</link>
      <description>&lt;P&gt;This one had some rather unexpected results. "field1" repeated a random number of times, followed by the same number of "field2". The "-" seems to be at the front of every entry but the first.&lt;/P&gt;

&lt;P&gt;A bit closer, things are showing up but still not quite -&amp;gt; "data - data"&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2020 22:02:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482744#M7820</guid>
      <dc:creator>Braagi</dc:creator>
      <dc:date>2020-02-25T22:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two fields with a constant string between</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482745#M7821</link>
      <description>&lt;P&gt;the fields are multivalue.&lt;BR /&gt;
First, you should convert them to single values&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2020 22:13:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482745#M7821</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-25T22:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two fields with a constant string between</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482746#M7822</link>
      <description>&lt;P&gt;Can you please provide some samples of field1 and field2?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 03:34:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482746#M7822</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2020-02-26T03:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two fields with a constant string between</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482747#M7823</link>
      <description>&lt;P&gt;I think what the underlying issue is that its coming from a CSV. I can get them to display individually, but when I try to combine them in the query... its a no-go.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 15:05:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482747#M7823</guid>
      <dc:creator>Braagi</dc:creator>
      <dc:date>2020-02-27T15:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two fields with a constant string between</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482748#M7824</link>
      <description>&lt;P&gt;I faced this issue in recent past&lt;/P&gt;

&lt;P&gt;To appraise if you are using above SPL with datamodel , I would suggest you use  &lt;CODE&gt;drop_dm_object_name("datamodel_name")&lt;/CODE&gt; before using &lt;CODE&gt;eval&lt;/CODE&gt; condition &lt;/P&gt;

&lt;P&gt;Example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| `drop_dm_object_name("datamodel_name")` 
| eval field3= field1 + ";" + field2
| makemv delim=";" field3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Reference: &lt;A href="https://answers.splunk.com/answers/49394/merge-two-fields-into-one-field.html"&gt;https://answers.splunk.com/answers/49394/merge-two-fields-into-one-field.html&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 17:00:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482748#M7824</guid>
      <dc:creator>sumanssah</dc:creator>
      <dc:date>2020-02-27T17:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two fields with a constant string between</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482749#M7825</link>
      <description>&lt;P&gt;There no datamodel, straight index and sourcetype.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 20:17:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Combining-two-fields-with-a-constant-string-between/m-p/482749#M7825</guid>
      <dc:creator>Braagi</dc:creator>
      <dc:date>2020-02-27T20:17:34Z</dc:date>
    </item>
  </channel>
</rss>

