<?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: What is the best way to concatenate multiple separate field values into a combined new field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-way-to-concatenate-multiple-separate-field/m-p/258485#M77436</link>
    <description>&lt;P&gt;Bravo, It works great!!!&lt;/P&gt;

&lt;P&gt;However, I lose the additional time values (because there are multiple second values per email occurrence) but I can live with that.&lt;/P&gt;</description>
    <pubDate>Fri, 29 Jan 2016 18:15:58 GMT</pubDate>
    <dc:creator>packet_hunter</dc:creator>
    <dc:date>2016-01-29T18:15:58Z</dc:date>
    <item>
      <title>What is the best way to concatenate multiple separate field values into a combined new field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-way-to-concatenate-multiple-separate-field/m-p/258483#M77434</link>
      <description>&lt;P&gt;Scenario background : I am searching email logs for all senders and recipients of specific subject.  Each email is a chain of event logs that share a Unique ID (UID) for that specific email occurrence.&lt;/P&gt;

&lt;P&gt;Here is my current code:&lt;/P&gt;

&lt;P&gt;index=mail sourcetype=xemail&lt;BR /&gt;
[search index=mail sourcetype=xemail subject = "Blah" |stats count by UID| fields UID] &lt;/P&gt;

&lt;P&gt;|stats list(subject) as subj list(sender) as sender list(recipient) as recp values(time_hour) as Hour values(time_minute) as Minute values(time_second) as Second  by UID &lt;/P&gt;

&lt;P&gt;current result headers are:&lt;BR /&gt;
UID Subj sender recp Hour Minute Second&lt;/P&gt;

&lt;P&gt;I would like to combine the Hour Minute Second values into a new field called Time.   One caveat is that there are multiple time_second values as the events are separate and correlated by UID.  So ideally I would like the Time field to contain complete time information (HH:MM:SS) in each row  for each email occurrence.  In other words each email has multiple event times because of the multiple event logs, the email events chain.&lt;/P&gt;

&lt;P&gt;I know there are a number of ways to do this but I am looking for the best way given my previous code.&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:37:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-way-to-concatenate-multiple-separate-field/m-p/258483#M77434</guid>
      <dc:creator>packet_hunter</dc:creator>
      <dc:date>2020-09-29T08:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best way to concatenate multiple separate field values into a combined new field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-way-to-concatenate-multiple-separate-field/m-p/258484#M77435</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=mail sourcetype=xemail
[search index=mail sourcetype=xemail subject = "Blah" |stats count by UID| fields UID]
|stats list(subject) as subj list(sender) as sender list(recipient) as recp values(time_hour) as Hour values(time_minute) as Minute values(time_second) as Second by UID | eval Time=mvzip(mvzip(Hour,Minute,":"),Second,":") | fields - Hour Minute Second
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Approach2 (should handle multiple seconds as well)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=mail sourcetype=xemail
    [search index=mail sourcetype=xemail subject = "Blah" |stats count by UID| fields UID] | eval Time=time_hour.":".time_minute.":".time_second |stats list(subject) as subj list(sender) as sender list(recipient) as recp values(Time) as Time by UID
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Jan 2016 18:00:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-way-to-concatenate-multiple-separate-field/m-p/258484#M77435</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-01-29T18:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best way to concatenate multiple separate field values into a combined new field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-way-to-concatenate-multiple-separate-field/m-p/258485#M77436</link>
      <description>&lt;P&gt;Bravo, It works great!!!&lt;/P&gt;

&lt;P&gt;However, I lose the additional time values (because there are multiple second values per email occurrence) but I can live with that.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jan 2016 18:15:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-way-to-concatenate-multiple-separate-field/m-p/258485#M77436</guid>
      <dc:creator>packet_hunter</dc:creator>
      <dc:date>2016-01-29T18:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best way to concatenate multiple separate field values into a combined new field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-way-to-concatenate-multiple-separate-field/m-p/258486#M77437</link>
      <description>&lt;P&gt;Try the 2nd query.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jan 2016 18:23:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-way-to-concatenate-multiple-separate-field/m-p/258486#M77437</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-01-29T18:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best way to concatenate multiple separate field values into a combined new field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-way-to-concatenate-multiple-separate-field/m-p/258487#M77438</link>
      <description>&lt;P&gt;even better!   did you write an SPL book?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jan 2016 20:25:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-best-way-to-concatenate-multiple-separate-field/m-p/258487#M77438</guid>
      <dc:creator>packet_hunter</dc:creator>
      <dc:date>2016-01-29T20:25:02Z</dc:date>
    </item>
  </channel>
</rss>

