<?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 split an event into parts and recombine with a common header? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-an-event-into-parts-and-recombine-with-a-common/m-p/646978#M223939</link>
    <description>&lt;P&gt;This works and I am now focused on renaming the fields within the path mv-object -&amp;gt; the last part of the index(2) is what has fields appended with '1' that need to be removed.&lt;BR /&gt;&lt;BR /&gt;After running the mvexpand on path, I tried to do "rename var1 as var vary1 as vary" etc... but to no avail. I may be out of my scope of understanding on how Multi-Value commands manipulate or stream data. I am going to be searching for that answer on how to modify those field names with this mvindex and mvexpand then mvjoin answer... If I can't seem to find what I want I will accept this as a solution in the coming days.&lt;/P&gt;&lt;P&gt;Thanks to you both, &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;____________________________&lt;BR /&gt;Edit:&lt;BR /&gt;I think when doing my renames I recognized my mistake; they are not extracted fields. So I either have to get it to recognize there are Path and Path1, ValidHits and ValidHits1, etc. for every field or change the data when doing the MV stuff.&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;Does mvindex just "look at" or "copy" data into new, mutable sections? If It just looks at, then I can understand how renaming (read: editing raw data) isn't possible. But If it's copying into a new field and then we're rejoining, shouldn't I be able to manipulate those internal values -- &lt;EM&gt;not&lt;/EM&gt; using rename (as they are not extracted fields)? By using a combo of rex and something else?&lt;/P&gt;</description>
    <pubDate>Wed, 14 Jun 2023 13:59:27 GMT</pubDate>
    <dc:creator>curtisjester</dc:creator>
    <dc:date>2023-06-14T13:59:27Z</dc:date>
    <item>
      <title>How to split an event into parts and recombine with a common header?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-an-event-into-parts-and-recombine-with-a-common/m-p/646843#M223875</link>
      <description>&lt;P&gt;Hey all - thanks in advance!&lt;/P&gt;&lt;P&gt;I have _raw log data that contains a header section and then what appears to be two entries within itself. I want to split these entries (they are formatted the same, except the latter appends a '1' onto each fieldname) and then create two events from this one event, like so:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Before&lt;/EM&gt;&lt;BR /&gt;_raw = HEADER|PART1|PART2&lt;BR /&gt;&lt;EM&gt;After&lt;BR /&gt;event1&lt;/EM&gt; = HEADER|PART1&lt;BR /&gt;&lt;EM&gt;event2 &lt;/EM&gt;= HEADER|PART2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An event will come from the same IP and device name; the parts are paths and simple fields. Here is a sample log (bracketed to show how I want it split, but these brackets &lt;EM&gt;are not in &lt;/EM&gt;the raw data):&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;[Jun 12 23:00:09 server.i.j WRD: 0|AName|Named Application Server|1|0|Rule|0|ClientTime=7:02:28-PM CompName=sparse.info.given.here IPv4=x.x.x.x] [Path=No-Results-Found MD5= Size= Modified= RuleID= ValidHits= InvalidHits= NoValidationHits=] [Path1=No-Results-Found MD51= Size1= Modified1= RuleID1= ValidHits1= InvalidHits1= NoValidationHits1= Count=1]&lt;/P&gt;&lt;P&gt;I would like the final results to be:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;Jun 12 23:00:09 server.i.j WRD: 0|AName|Named Application Server|1|0|Rule|0|ClientTime=7:02:28-PM CompName=sparse.info.given.here IPv4=x.x.x.x Path=No-Results-Found MD5= Size= Modified= RuleID= ValidHits= InvalidHits= NoValidationHits=&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;Jun 12 23:00:09 server.i.j WRD: 0|AName|Named Application Server|1|0|Rule|0|ClientTime=7:02:28-PM CompName=sparse.info.given.here IPv4=x.x.x.x Path1=No-Results-Found MD51= Size1= Modified1= RuleID1= ValidHits1= InvalidHits1= NoValidationHits1= &lt;EM&gt;Count=1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Count is not really a big deal here, it can be on either log (the latter by default as it is the final field in the log)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;I have the regex to perform the part-splitting if rex is the move here&lt;/U&gt;:&lt;/P&gt;&lt;P&gt;| rex field=_raw "(?&amp;lt;header&amp;gt;.*IPv4Address=\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}) (?&amp;lt;part1&amp;gt;Path.*) (?&amp;lt;part2&amp;gt;Path.*)"&lt;/P&gt;&lt;P&gt;Once recombined, I will still perform manipulation on the resulting logs, and I do not need to write to file or CSV. The issue this is causing relates to finding accurate hits on files (the ValidHits1 field is annoying; same with Path1). I can happily rename fields after rejoining my Parts to the header so I can then correlate on top of all data with common field names.&lt;/P&gt;&lt;P&gt;Please feel free to ask for more information to help me out with this, and I appreciate any help you can give for this project!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 15:58:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-an-event-into-parts-and-recombine-with-a-common/m-p/646843#M223875</guid>
      <dc:creator>curtisjester</dc:creator>
      <dc:date>2023-06-13T15:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to split an event into parts and recombine with a common header?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-an-event-into-parts-and-recombine-with-a-common/m-p/646913#M223907</link>
      <description>&lt;P&gt;How about this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval data = split(_raw, "] [")
| eval header = ltrim(mvindex(data, 0), "["), path = mvappend(mvindex(data, 1), rtrim(mvindex(data, 2), "]"))
| mvexpand path
| eval _raw = mvjoin(mvappend(header, path), " ")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your sample data gives&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;_raw&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Jun 12 23:00:09 server.i.j WRD: 0|AName|Named Application Server|1|0|Rule|0|ClientTime=7:02:28-PM CompName=sparse.info.given.here IPv4=x.x.x.x Path=No-Results-Found MD5= Size= Modified= RuleID= ValidHits= InvalidHits= NoValidationHits=&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Jun 12 23:00:09 server.i.j WRD: 0|AName|Named Application Server|1|0|Rule|0|ClientTime=7:02:28-PM CompName=sparse.info.given.here IPv4=x.x.x.x Path1=No-Results-Found MD51= Size1= Modified1= RuleID1= ValidHits1= InvalidHits1= NoValidationHits1= Count=1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 14 Jun 2023 05:48:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-an-event-into-parts-and-recombine-with-a-common/m-p/646913#M223907</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-06-14T05:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to split an event into parts and recombine with a common header?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-an-event-into-parts-and-recombine-with-a-common/m-p/646930#M223915</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp; the brackets aren't in the data, but you are on the right lines&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval data = split(_raw, " Path")
| eval header = mvindex(data, 0), path = mvappend("Path".mvindex(data, 1), "Path".mvindex(data, 2))
| mvexpand path
| eval _raw = mvjoin(mvappend(header, path), " ")&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 14 Jun 2023 08:13:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-an-event-into-parts-and-recombine-with-a-common/m-p/646930#M223915</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-06-14T08:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to split an event into parts and recombine with a common header?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-an-event-into-parts-and-recombine-with-a-common/m-p/646978#M223939</link>
      <description>&lt;P&gt;This works and I am now focused on renaming the fields within the path mv-object -&amp;gt; the last part of the index(2) is what has fields appended with '1' that need to be removed.&lt;BR /&gt;&lt;BR /&gt;After running the mvexpand on path, I tried to do "rename var1 as var vary1 as vary" etc... but to no avail. I may be out of my scope of understanding on how Multi-Value commands manipulate or stream data. I am going to be searching for that answer on how to modify those field names with this mvindex and mvexpand then mvjoin answer... If I can't seem to find what I want I will accept this as a solution in the coming days.&lt;/P&gt;&lt;P&gt;Thanks to you both, &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;____________________________&lt;BR /&gt;Edit:&lt;BR /&gt;I think when doing my renames I recognized my mistake; they are not extracted fields. So I either have to get it to recognize there are Path and Path1, ValidHits and ValidHits1, etc. for every field or change the data when doing the MV stuff.&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;Does mvindex just "look at" or "copy" data into new, mutable sections? If It just looks at, then I can understand how renaming (read: editing raw data) isn't possible. But If it's copying into a new field and then we're rejoining, shouldn't I be able to manipulate those internal values -- &lt;EM&gt;not&lt;/EM&gt; using rename (as they are not extracted fields)? By using a combo of rex and something else?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 13:59:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-an-event-into-parts-and-recombine-with-a-common/m-p/646978#M223939</guid>
      <dc:creator>curtisjester</dc:creator>
      <dc:date>2023-06-14T13:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to split an event into parts and recombine with a common header?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-an-event-into-parts-and-recombine-with-a-common/m-p/646986#M223942</link>
      <description>&lt;P&gt;You could do this (although it only works for 1, 2 and 3, because IPv4 and MD5 complicate matters)!&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval data = split(_raw, " Path")
| eval header = mvindex(data, 0), path = mvappend("Path".mvindex(data, 1), "Path".mvindex(data, 2))
| mvexpand path
| eval _raw = mvjoin(mvappend(header, path), " ")
| rex mode=sed "s/(?&amp;lt;name&amp;gt;\w+)(?&amp;lt;digit&amp;gt;[1-3])=/\1=/g"&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 14 Jun 2023 14:24:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-an-event-into-parts-and-recombine-with-a-common/m-p/646986#M223942</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-06-14T14:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to split an event into parts and recombine with a common header?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-an-event-into-parts-and-recombine-with-a-common/m-p/646994#M223946</link>
      <description>&lt;P&gt;Thank you very much! That has got me what I needed!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 15:22:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-an-event-into-parts-and-recombine-with-a-common/m-p/646994#M223946</guid>
      <dc:creator>curtisjester</dc:creator>
      <dc:date>2023-06-14T15:22:55Z</dc:date>
    </item>
  </channel>
</rss>

