<?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: Splitting a field after combining fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682641#M233199</link>
    <description>&lt;P&gt;I used this search and it did work, however, something that I probably should have mentioned earlier is that multiple hosts and users are linked to the same external ip, so I am now getting multivalue fields for the Hostnames and Users. Anything that can be done for that? Or should I combine the two fields beforehand, then split them after the eventstats command?&lt;/P&gt;</description>
    <pubDate>Mon, 01 Apr 2024 16:56:13 GMT</pubDate>
    <dc:creator>psomeshwar</dc:creator>
    <dc:date>2024-04-01T16:56:13Z</dc:date>
    <item>
      <title>Splitting a field after combining fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682631#M233194</link>
      <description>&lt;P&gt;So, I have two indexes and sourcetypes with the following fields:&lt;/P&gt;
&lt;P&gt;index1 and sourcetype1:&lt;/P&gt;
&lt;P&gt;aip = 34.465.45.234&lt;/P&gt;
&lt;P&gt;AppVendor = vendor1, vendor2, vendor3 (These are all from different events)&lt;/P&gt;
&lt;P&gt;AppName = app2, app3, app1 (All from different events corresponding to position of the vendors above)&lt;/P&gt;
&lt;P&gt;AppVersion = 3.0343, 1.354, 2.5465 (Same convention)&lt;/P&gt;
&lt;P&gt;index2 and sourcetype2:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;jsonevent.external_ip = 34.465.45.234

jsonevent.hostname = Host1

jsonevent.Username = User1

&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;I use the following search:&lt;/P&gt;
&lt;P&gt;(index=index1 sourcetype=sourcetype1) OR (index=index2 sourcetype=sourcetype2)&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| rename jsonevent.external_ip as exip
| rename aip as agentip
| eval external_ip = coalesce(agentip, exip)
| stats values(jsonevent.hostname) as Hostnames, values(jsonevent.Username) as Users, values(AppVendor) as Vendors, values(AppName) as Applications, values(AppVersion) as Version by external_ip
| search Hostnames=* Users=* Vendors=* Applications=* Version=*

&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;I get the following:&lt;/P&gt;
&lt;P&gt;external_ip&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Hostnames&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Usernames&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Vendors&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Applications&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Version&lt;/P&gt;
&lt;P&gt;34.465.45.234&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Host1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; User1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Vendor1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;app1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.354&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Vendor2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;app2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;2.5465&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Vendor3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;app3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;3.0343&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I want is the following:&lt;/P&gt;
&lt;P&gt;external_ip&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Hostnames&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Usernames&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Vendors&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Applications&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Version&lt;/P&gt;
&lt;P&gt;34.465.45.234&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Host1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; User1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Vendor1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;app2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3.0343&lt;BR /&gt;34.465.45.234&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Host1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;User1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Vendor2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;app3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.354&amp;nbsp;&lt;BR /&gt;34.465.45.234&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Host1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; User1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Vendor3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;app1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;2.5465&lt;/P&gt;
&lt;P&gt;Does anyone have any ideas how to achieve this?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 17:12:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682631#M233194</guid>
      <dc:creator>psomeshwar</dc:creator>
      <dc:date>2024-04-01T17:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a field after combining fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682634#M233195</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=index1 sourcetype=sourcetype1) OR (index=index2 sourcetype=sourcetype2)

| rename jsonevent.external_ip as exip
| rename aip as agentip
| eval external_ip = coalesce(agentip, exip)
| eventstats values(jsonevent.hostname) as Hostnames, values(jsonevent.Username) as Usernames by external_ip
| rename AppVendor as Vendors, AppName as Applications, AppVersion as Version
| where isnotnull(Vendors)
| table external_ip Hostnames Usernames Vendors Applications Version&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 01 Apr 2024 16:19:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682634#M233195</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-04-01T16:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a field after combining fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682635#M233196</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;mvexpand&lt;/FONT&gt; command will split the multi-value fields into separate events.&amp;nbsp; The problem is doing so breaks the relationships with other multi-value fields.&amp;nbsp; To work around that, combine the three multi-value fields into a single multi-value field, use &lt;FONT face="courier new,courier"&gt;mvexpand&lt;/FONT&gt;, then split the fields apart.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rename jsonevent.external_ip as exip
| rename aip as agentip
| eval external_ip = coalesce(agentip, exip)
| stats values(jsonevent.hostname) as Hostnames, values(jsonevent.Username) as Users, values(AppVendor) as Vendors, values(AppName) as Applications, values(AppVersion) as Version by external_ip
| eval tuple=mvzip(Hostnames, mvzip(Usernames, mvzip(Vendors, mvzip(Applications, Version))))
| mvexpand tuple
| eval tuple=split(tuple, ",")
| eval Hostnames=mvindex(tuple, 0), Usernames=mvindex(tuple, 1), Vendors=mvindex(tuple, 2), Applications=mvindex(tuple, 3),Version=mvindex(tuple, 4)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 01 Apr 2024 16:24:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682635#M233196</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-04-01T16:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a field after combining fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682637#M233197</link>
      <description>&lt;P&gt;The problem with using values() is that the multivalue fields are each sorted lexicographically independently and the original relationship between the values from the events is lost before the mvzip/mvexpand/mvindex fixup.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 16:28:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682637#M233197</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-04-01T16:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a field after combining fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682641#M233199</link>
      <description>&lt;P&gt;I used this search and it did work, however, something that I probably should have mentioned earlier is that multiple hosts and users are linked to the same external ip, so I am now getting multivalue fields for the Hostnames and Users. Anything that can be done for that? Or should I combine the two fields beforehand, then split them after the eventstats command?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 16:56:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682641#M233199</guid>
      <dc:creator>psomeshwar</dc:creator>
      <dc:date>2024-04-01T16:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a field after combining fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682642#M233200</link>
      <description>&lt;P&gt;Excellent point.&amp;nbsp; My answer should use &lt;FONT face="courier new,courier"&gt;list&lt;/FONT&gt; rather than &lt;FONT face="courier new,courier"&gt;values&lt;/FONT&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 16:57:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682642#M233200</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-04-01T16:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a field after combining fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682654#M233202</link>
      <description>&lt;P&gt;So,&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;.&amp;nbsp; I combined both offered solutions into the following which did end up working:&lt;/P&gt;
&lt;P&gt;(index=index1 sourcetype=sourcetype1) OR (index=index2 sourcetype=sourcetype2)&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| rename jsonevent.external_ip as exip
| rename aip as agentip
| eval external_ip = coalesce(agentip, exip)
| eventstats list(jsonevent.hostname) as Hostnames, list(jsonevent.Username) as Users by external_ip
| eval hostuser = mvzip(Hostnames, Users)
| mvexpand hostuser
| eval HostUser = split(hostuser, ",")
| eval Hostnames=mvindex(HostUser, 0), Users=mvindex(HostUser, 1)
| rename AppVendor as Vendors, AppName as Applications, AppVersion as Version
| where isnotnull(Vendors)
| search Hostnames=*, Users=*
| table external_ip, Hostnames, Users, Vendors, Applications, Version

&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;This gave me the result I wanted, but I also ended up with a caution that the list command reached a limit of 100 and had to truncate some events, and the search as a whole slows to a crawl. Is the list command that resource intensive?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 19:18:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682654#M233202</guid>
      <dc:creator>psomeshwar</dc:creator>
      <dc:date>2024-04-01T19:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a field after combining fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682655#M233203</link>
      <description>&lt;P&gt;Yes, the &lt;FONT face="courier new,courier"&gt;list&lt;/FONT&gt; function is resource-intensive.&amp;nbsp; It makes a list of every value for the specified field so that takes time and memory.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 19:18:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682655#M233203</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-04-01T19:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a field after combining fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682664#M233206</link>
      <description>&lt;P&gt;Since your sample data doesn't show more than one host or user for each ip address, guessing that list would be useful to get what you needed was beyond my knowledge. Perhaps you could provide a more representative example of the events you are dealing with next time so we might be able to suggest a suitable solution (hopefully avoiding memory issues if possible).&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 22:06:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-field-after-combining-fields/m-p/682664#M233206</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-04-01T22:06:49Z</dc:date>
    </item>
  </channel>
</rss>

