<?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 concatenate two fields and display as one new field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-two-fields-and-display-as-one-new-field/m-p/194751#M56161</link>
    <description>&lt;P&gt;Well, for one thing you can get rid of your &lt;CODE&gt;rename&lt;/CODE&gt; clauses at the end by putting the &lt;CODE&gt;as&lt;/CODE&gt; bits directly in your &lt;CODE&gt;chart&lt;/CODE&gt; command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;chart values(posixgroup) as "Groups" values(given) as "Given Name" values(sn) as Surname latest(login_time) as "Last Login" by user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Beyond that, the lookup should not be causing you any problems, really. What happens if you put the &lt;CODE&gt;eval full_name=given." ".sn&lt;/CODE&gt; clause directly after the &lt;CODE&gt;lookup&lt;/CODE&gt; clause, and then include &lt;CODE&gt;values(full_name)&lt;/CODE&gt; as a field in your &lt;CODE&gt;chart&lt;/CODE&gt; command? I'm running a similar search locally (pulling fields out of lookups and using them in concatenations), and it's working fine.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jan 2015 13:52:23 GMT</pubDate>
    <dc:creator>aweitzman</dc:creator>
    <dc:date>2015-01-23T13:52:23Z</dc:date>
    <item>
      <title>How to concatenate two fields and display as one new field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-two-fields-and-display-as-one-new-field/m-p/194745#M56155</link>
      <description>&lt;P&gt;I know this question has been asked numerous times but for some reason the solutions don't appear to work for me.&lt;BR /&gt;
I want to display a field as Full_Name where the field is made up of two other fields that I have on hand, given &amp;amp; sn.&lt;BR /&gt;
    eval full_name = given." ".sn&lt;BR /&gt;
    eval full_name = given+" "sn&lt;/P&gt;

&lt;P&gt;The above I have seen as solution but neither work for me.&lt;BR /&gt;
eval full_name=given &amp;amp; eval full_name=sn both display their individual fields but when I try and combine them like above, nothing...&lt;/P&gt;

&lt;P&gt;It may be with the way I am displaying the results which is by chart.&lt;BR /&gt;
chart values(given), values(sn), latest(login_time), values(full_name) by user&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:41:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-two-fields-and-display-as-one-new-field/m-p/194745#M56155</guid>
      <dc:creator>ulankford</dc:creator>
      <dc:date>2020-09-28T18:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate two fields and display as one new field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-two-fields-and-display-as-one-new-field/m-p/194746#M56156</link>
      <description>&lt;P&gt;I have lots of issues when using values(), if ever I'm trying to only display a single result and not too concerned that the actual value will change, I tend to use latest() instead. Your eval looks correct though.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 00:05:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-two-fields-and-display-as-one-new-field/m-p/194746#M56156</guid>
      <dc:creator>dolivasoh</dc:creator>
      <dc:date>2015-01-16T00:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate two fields and display as one new field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-two-fields-and-display-as-one-new-field/m-p/194747#M56157</link>
      <description>&lt;P&gt;Thanks for the tip. Unfortunately, using latest() instead of values() does not produce anything either.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 00:33:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-two-fields-and-display-as-one-new-field/m-p/194747#M56157</guid>
      <dc:creator>ulankford</dc:creator>
      <dc:date>2015-01-16T00:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate two fields and display as one new field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-two-fields-and-display-as-one-new-field/m-p/194748#M56158</link>
      <description>&lt;P&gt;Can you display the output from using &lt;CODE&gt;eval full_name = given." ".sn&lt;/CODE&gt; ?&lt;/P&gt;

&lt;P&gt;That &lt;EM&gt;should&lt;/EM&gt; work.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.1/SearchReference/Eval"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.1/SearchReference/Eval&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 02:27:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-two-fields-and-display-as-one-new-field/m-p/194748#M56158</guid>
      <dc:creator>eddit0r</dc:creator>
      <dc:date>2015-01-16T02:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate two fields and display as one new field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-two-fields-and-display-as-one-new-field/m-p/194749#M56159</link>
      <description>&lt;P&gt;So this "run anywhere" example works for me:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 
| eval data="[u1,given1,surname1] [u2,given2,surname2] [u3,given3,surname3]" 
| makemv delim=" " data 
| mvexpand data 
| rex field=data "\[(?&amp;lt;user&amp;gt;.*),(?&amp;lt;given&amp;gt;.*),(?&amp;lt;sn&amp;gt;.*)\]" 
| eval full_name=given." ".sn 
| chart values(given) values(sn) values(full_name) by user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Everything prior to the &lt;CODE&gt;eval full_name&lt;/CODE&gt; clause is just to generate the proper data. (You can run just that part to see what the result is.) Once I have that, the &lt;CODE&gt;eval&lt;/CODE&gt; followed by the &lt;CODE&gt;chart&lt;/CODE&gt; (similar to the way you have it) works just fine.&lt;/P&gt;

&lt;P&gt;Hopefully seeing this work will help you identify what's not going right with your search.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 14:35:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-two-fields-and-display-as-one-new-field/m-p/194749#M56159</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2015-01-16T14:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate two fields and display as one new field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-two-fields-and-display-as-one-new-field/m-p/194750#M56160</link>
      <description>&lt;P&gt;Thanks for that.&lt;BR /&gt;
 My full query is the following.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=linux_syslog netgroup=sap* process="sshd" "session opened for user" | rex field=_raw "session opened for user (?&amp;lt;user&amp;gt;.*) by" | lookup groupLookup user OUTPUTNEW gid posixgroup given sn | convert timeformat="%d/%m/%y" ctime(_time) as login_time | search posixgroup="groupname" | chart values(posixgroup), values(given), values(sn), latest(login_time) by user | rename user AS "User" | rename values(posixgroup) AS "Groups" | rename values(given) AS "Given Name" | rename values(sn) AS Surname | rename latest(login_time) AS "Last Login" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I think the reason this is not working is because the firstname (given) and the surname (sn) are being generated only by the lookup, not take from the actual log itself, therefore it fails. &lt;/P&gt;

&lt;P&gt;Now unless there is some nifty way I can do this the only other way to get around this is to just export the data into the lookup &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;lookup groupLookup user OUTPUTNEW gid posixgroup given sn fullname
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Jan 2015 05:10:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-two-fields-and-display-as-one-new-field/m-p/194750#M56160</guid>
      <dc:creator>ulankford</dc:creator>
      <dc:date>2015-01-23T05:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate two fields and display as one new field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-two-fields-and-display-as-one-new-field/m-p/194751#M56161</link>
      <description>&lt;P&gt;Well, for one thing you can get rid of your &lt;CODE&gt;rename&lt;/CODE&gt; clauses at the end by putting the &lt;CODE&gt;as&lt;/CODE&gt; bits directly in your &lt;CODE&gt;chart&lt;/CODE&gt; command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;chart values(posixgroup) as "Groups" values(given) as "Given Name" values(sn) as Surname latest(login_time) as "Last Login" by user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Beyond that, the lookup should not be causing you any problems, really. What happens if you put the &lt;CODE&gt;eval full_name=given." ".sn&lt;/CODE&gt; clause directly after the &lt;CODE&gt;lookup&lt;/CODE&gt; clause, and then include &lt;CODE&gt;values(full_name)&lt;/CODE&gt; as a field in your &lt;CODE&gt;chart&lt;/CODE&gt; command? I'm running a similar search locally (pulling fields out of lookups and using them in concatenations), and it's working fine.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2015 13:52:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-two-fields-and-display-as-one-new-field/m-p/194751#M56161</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2015-01-23T13:52:23Z</dc:date>
    </item>
  </channel>
</rss>

