<?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: Regex search on multiple lines and displaying only if not matching a particular string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622117#M216245</link>
    <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp; thanks for the quick reply.&lt;/P&gt;&lt;P&gt;i think i need more help to further clarify.&lt;/P&gt;&lt;P&gt;so this is the Raw data (but splunk under verbose mode, it was able to consider this as a field named "core dumps"&lt;/P&gt;&lt;P&gt;node0:&lt;BR /&gt;--------------------------------------------------------------------------&lt;BR /&gt;/var/: No such file or directory&lt;BR /&gt;/var/tmp/: No such file or directory&lt;BR /&gt;/var/: blablablaba.txt&lt;/P&gt;&lt;P&gt;node1:&lt;BR /&gt;--------------------------------------------------------------------------&lt;BR /&gt;/var/: No such file or directory&lt;BR /&gt;/var/tmp/: No such file or directory&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what i would like to do, is do a rex max_match where it would create values that would look like this first.&lt;/P&gt;&lt;P&gt;FIRST OUTPUT:&lt;/P&gt;&lt;P&gt;node0,/var/: No such file or directory&lt;BR /&gt;node0,/var/tmp/: No such file or directory&lt;BR /&gt;node0,/var/: blablablaba.txt&lt;/P&gt;&lt;P&gt;node1,/var/: No such file or directory&lt;BR /&gt;node1,/var/tmp/: No such file or directory&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from here i would like to then display all lines that do not have "No such file or directory"&lt;/P&gt;&lt;P&gt;so the final output will be:&lt;/P&gt;&lt;P&gt;node0,/var/: blablablaba.txt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i hope this makes it more clearer. i do apologize for making it confusing.&lt;/P&gt;</description>
    <pubDate>Fri, 25 Nov 2022 15:23:48 GMT</pubDate>
    <dc:creator>tha_ghost99</dc:creator>
    <dc:date>2022-11-25T15:23:48Z</dc:date>
    <item>
      <title>Help with regex search on multiple lines and displaying only if not matching a particular string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622025#M216203</link>
      <description>&lt;P&gt;Below is the current out put (raw) - specific field&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;node0:&lt;BR /&gt;--------------------------------------------------------------------------&lt;BR /&gt;/var/: No such file or directory&lt;BR /&gt;/var/tmp/: No such file or directory&lt;BR /&gt;/var/: blablablaba.txt&lt;/P&gt;
&lt;P&gt;node1:&lt;BR /&gt;--------------------------------------------------------------------------&lt;BR /&gt;/var/: No such file or directory&lt;BR /&gt;/var/tmp/: No such file or directory&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what i need help on, is to group Node0 and Node1 as their own group, and only show IF the row below it (after the "/var") if its anything BUT "No such file or directory"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so the output will end up being:&lt;/P&gt;
&lt;P&gt;NODE0:&lt;/P&gt;
&lt;P&gt;/var/: blablablaba.txt&lt;/P&gt;
&lt;P&gt;NODE1:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks for the help in advance.&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2022 15:55:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622025#M216203</guid>
      <dc:creator>tha_ghost99</dc:creator>
      <dc:date>2022-11-27T15:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Regex search on multiple lines and displaying only if not matching a particular string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622030#M216206</link>
      <description>&lt;P&gt;Assuming the field name is data, you can do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval data = replace(data, "\n(.*: No such file or directory|---*)", "")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;data&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;node0:&lt;/P&gt;&lt;P&gt;/var/: blablablaba.txt&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;node1:&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 25 Nov 2022 00:25:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622030#M216206</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-11-25T00:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: Regex search on multiple lines and displaying only if not matching a particular string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622117#M216245</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp; thanks for the quick reply.&lt;/P&gt;&lt;P&gt;i think i need more help to further clarify.&lt;/P&gt;&lt;P&gt;so this is the Raw data (but splunk under verbose mode, it was able to consider this as a field named "core dumps"&lt;/P&gt;&lt;P&gt;node0:&lt;BR /&gt;--------------------------------------------------------------------------&lt;BR /&gt;/var/: No such file or directory&lt;BR /&gt;/var/tmp/: No such file or directory&lt;BR /&gt;/var/: blablablaba.txt&lt;/P&gt;&lt;P&gt;node1:&lt;BR /&gt;--------------------------------------------------------------------------&lt;BR /&gt;/var/: No such file or directory&lt;BR /&gt;/var/tmp/: No such file or directory&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what i would like to do, is do a rex max_match where it would create values that would look like this first.&lt;/P&gt;&lt;P&gt;FIRST OUTPUT:&lt;/P&gt;&lt;P&gt;node0,/var/: No such file or directory&lt;BR /&gt;node0,/var/tmp/: No such file or directory&lt;BR /&gt;node0,/var/: blablablaba.txt&lt;/P&gt;&lt;P&gt;node1,/var/: No such file or directory&lt;BR /&gt;node1,/var/tmp/: No such file or directory&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from here i would like to then display all lines that do not have "No such file or directory"&lt;/P&gt;&lt;P&gt;so the final output will be:&lt;/P&gt;&lt;P&gt;node0,/var/: blablablaba.txt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i hope this makes it more clearer. i do apologize for making it confusing.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Nov 2022 15:23:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622117#M216245</guid>
      <dc:creator>tha_ghost99</dc:creator>
      <dc:date>2022-11-25T15:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: Regex search on multiple lines and displaying only if not matching a particular string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622120#M216247</link>
      <description>&lt;P&gt;this is my current search but it does not seem to get the other lines below..&lt;/P&gt;&lt;P&gt;its only checking 1 line from each group of node0 and node1 &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;|data&lt;BR /&gt;| rex field="core_dump" max_match=0 "(?s)(?&amp;lt;nodeNum&amp;gt;node\d+):.*?------------------------*[\n](?&amp;lt;coredumpoutput&amp;gt;[^\n]*)"&lt;BR /&gt;|table nodeNum coredumpoutput&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;output:&lt;/P&gt;&lt;P&gt;nodeNum coredumpoutput&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;node0&lt;/DIV&gt;&lt;DIV class=""&gt;node1&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;/var/crash/*core*: No such file or directory&lt;/DIV&gt;&lt;DIV class=""&gt;/var/crash/*core*: No such file or directory&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 25 Nov 2022 16:43:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622120#M216247</guid>
      <dc:creator>tha_ghost99</dc:creator>
      <dc:date>2022-11-25T16:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: Regex search on multiple lines and displaying only if not matching a particular string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622128#M216251</link>
      <description>&lt;P&gt;I mistook node0 and node1 as separate event. &amp;nbsp;But no matter. &amp;nbsp;You can use the same approach: Just split the two components into separate events.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval core_dump = split(core_dump, "

")
| mvexpand core_dump
| eval core_dump = replace(core_dump, "\n(.*: No such file or directory|---*)", "")&lt;/LI-CODE&gt;&lt;P&gt;If you don't want to display the node that has no file, &amp;nbsp;add a filter, like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval core_dump = split(core_dump, "

")
| mvexpand core_dump
| eval core_dump = replace(core_dump, "\n(.*: No such file or directory|---*)", "")
| where match(core_dump, ": *\w+")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Nov 2022 22:22:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622128#M216251</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-11-25T22:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: Regex search on multiple lines and displaying only if not matching a particular string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622288#M216313</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; hi appreciate the help but didnt seem to work.&lt;/P&gt;&lt;P&gt;can i bug you for an easier but similar help? maybe it will help me better understand since i am a novice with splunks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is my data:&lt;/P&gt;&lt;P&gt;node0:&lt;BR /&gt;/hello&lt;BR /&gt;/hi&lt;BR /&gt;-rw-rw---- bad1.gz&lt;BR /&gt;-rw-rw---- bad2.gz&lt;BR /&gt;/bye&lt;/P&gt;&lt;P&gt;node1:&lt;BR /&gt;/hello/hello&lt;BR /&gt;/hi/hi&lt;BR /&gt;-rw-rw---- bad3.gz&lt;BR /&gt;/bye/bye&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can i simply group them based on node0 and node1? using rex and mvzip for example or some other variations.&lt;/P&gt;&lt;P&gt;output would be:&lt;/P&gt;&lt;P&gt;node0:/hello&lt;BR /&gt;node0:/hi&lt;BR /&gt;node0:-rw-rw---- bad1.gz&lt;BR /&gt;node0:-rw-rw---- bad2.gz&lt;BR /&gt;node0:/bye&lt;BR /&gt;node1,/hello/hello&lt;BR /&gt;node1,/hi/hi&lt;BR /&gt;node1,-rw-rw---- bad3.gz&lt;BR /&gt;node1,/bye/bye&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hope this helps. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; again really thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2022 16:50:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622288#M216313</guid>
      <dc:creator>tha_ghost99</dc:creator>
      <dc:date>2022-11-28T16:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Regex search on multiple lines and displaying only if not matching a particular string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622343#M216328</link>
      <description>&lt;P&gt;Let me demonstrate from your original dataset (which is not really different from this simplified set) first because that's exactly how I came to the code. &amp;nbsp;You can follow along by copying into your search window (and compare data and data flow with your actual data, check my assumptions). &amp;nbsp;I will also link to official documentation of key commands/functions.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;core_dump&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE&gt;node0:
--------------------------------------------------------------------------
/var/: No such file or directory
/var/tmp/: No such file or directory
/var/: blablablaba.txt

node1:
--------------------------------------------------------------------------
/var/: No such file or directory
/var/tmp/: No such file or directory&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Obviously if the above data are considerably different from the real one, the code will not give expected result in the real world. &amp;nbsp;(For example: Is there a line completely made of dashes?) &amp;nbsp;The above is simulated using the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval core_dump = "node0:
--------------------------------------------------------------------------
/var/: No such file or directory
/var/tmp/: No such file or directory
/var/: blablablaba.txt

node1:
--------------------------------------------------------------------------
/var/: No such file or directory
/var/tmp/: No such file or directory"
| fields - _time
``` data emulation above ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/MultivalueEvalFunctions#split.28X.2C.22Y.22.29" target="_blank" rel="noopener"&gt;split&lt;/A&gt; core_dump after data emulation&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval core_dump = split(core_dump, "

") ``` splits two nodes into multivalue ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: There is a blank line between the two quotation marks; there is no trailing space after the first quotation mark, and no leading space before the second one. &amp;nbsp;This does not seem to do much from a first glance, but core_dump is now multivalue. &amp;nbsp;Next, add &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Mvexpand" target="_blank" rel="noopener"&gt;mvexpand&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mvexpand core_dump&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The search results now look like thus:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;core_dump&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE&gt;node0:
--------------------------------------------------------------------------
/var/: No such file or directory
/var/tmp/: No such file or directory
/var/: blablablaba.txt&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE&gt;node1:
--------------------------------------------------------------------------
/var/: No such file or directory
/var/tmp/: No such file or directory&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;In other words, the two nodes are in their own events.&lt;/P&gt;&lt;P&gt;Next, do some regex magic with &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/TextFunctions#replace.28X.2CY.2CZ.29" target="_blank" rel="noopener"&gt;replace&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval core_dump = replace(core_dump, "\n(.*: No such file or directory|---*)", "") ``` vanish unwanted lines ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you get&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;core_dump&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE&gt;node0:
/var/: blablablaba.txt&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE&gt;node1:&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Lastly, filter out nodes that do not have real files using &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Where" target="_blank" rel="noopener"&gt;where&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where match(core_dump, ": *\w+")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The end result is&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;core_dump&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE&gt;node0:
/var/: blablablaba.txt&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;As you can see, every step in the above is moving toward your initial mockup of desired output. &amp;nbsp;And it matches your mockup exactly.&lt;/P&gt;&lt;H2&gt;After you changed requirement&lt;/H2&gt;&lt;P&gt;Now, you changed your desired output, so we will do a little more. (As is always in SPL, code depends tremendously on input data as well as desired output.) &amp;nbsp;You also changed your input to remove that line composed of all dashes. &amp;nbsp;So emulation will be a little different. &amp;nbsp;Let's&amp;nbsp;add in node split, and mvexpand as a start point.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval core_dump = "node0:
/var/: No such file or directory
/var/tmp/: No such file or directory
/var/: blablablaba.txt

node1:
/var/: No such file or directory
/var/tmp/: No such file or directory"
| fields - _time
``` data emulation above, no ---- ```
| eval core_dump = split(core_dump, "

") ``` split two nodes ```
| mvexpand core_dump ``` split events according to node ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;core_dump&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE&gt;node0:
/var/: No such file or directory
/var/tmp/: No such file or directory
/var/: blablablaba.txt&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE&gt;node1:
/var/: No such file or directory
/var/tmp/: No such file or directory&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;After this, run split again&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval core_dump = split(core_dump, "
") ``` split by line ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Again, you may not see the difference with a casual glance. &amp;nbsp;But if you run &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/MultivalueEvalFunctions#mvcount.28MVFIELD.29" target="_blank" rel="noopener"&gt;mvcount&lt;/A&gt; before and after split, you'll see the difference.) &amp;nbsp;Next, render this one field into two separate fields:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval node = mvindex(core_dump, 0)
| eval core_dump = mvindex(core_dump, 1, mvcount(core_dump))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;core_dump&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;node&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;/var/: No such file or directory&lt;/DIV&gt;&lt;DIV class=""&gt;/var/tmp/: No such file or directory&lt;/DIV&gt;&lt;DIV class=""&gt;/var/: blablablaba.txt&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;node0:&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;/var/: No such file or directory&lt;/DIV&gt;&lt;DIV class=""&gt;/var/tmp/: No such file or directory&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;node1:&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Finally, smooch the two fields to make one final display:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval core_dump = mvmap(core_dump, node . core_dump) ``` print the desired pattern ```
| fields - node&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/MultivalueEvalFunctions#mvmap.28X.2CY.29" target="_blank" rel="noopener"&gt;mvmap&lt;/A&gt; is needed because a string cannot be added to a multivalue field even if each value is a string.)&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;core_dump&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;node0:/var/: No such file or directory&lt;/DIV&gt;&lt;DIV class=""&gt;node0:/var/tmp/: No such file or directory&lt;/DIV&gt;&lt;DIV class=""&gt;node0:/var/: blablablaba.txt&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;node1:/var/: No such file or directory&lt;/DIV&gt;&lt;DIV class=""&gt;node1:/var/tmp/: No such file or directory&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Does this help?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 05:34:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622343#M216328</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-11-29T05:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Regex search on multiple lines and displaying only if not matching a particular string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622451#M216372</link>
      <description>&lt;P&gt;hi &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;i was able to follow it when the data is from what i pasted. here is the raw output. i was wondering if you can work your magic, it just dont work for me when i use the raw data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oct 11 11:32:45&lt;BR /&gt;node0:&lt;BR /&gt;--------------------------------------------------------------------------&lt;BR /&gt;/var/crash/*core*: No such file or directory&lt;BR /&gt;-rw-rw---- 1 nobody wheel 1251399200 Oct 11 10:29 /var/tmp/C1.core.0.gz&lt;BR /&gt;-rw-rw---- 1 nobody wheel 1254654282 Oct 11 10:27 /var/tmp/C3.core.0.gz&lt;BR /&gt;-rw-rw---- 1 nobody wheel 1093812660 Mar 11 2022 /var/tmp/C0.core.0.gz&lt;BR /&gt;-rw-rw---- 1 nobody wheel 1255530083 Oct 11 10:24 /var/tmp/IC1.core.0.gz&lt;BR /&gt;-rw-rw---- 1 nobody wheel 184401920 Mar 11 2022 /var/tmp/IC2.core.0.gz&lt;BR /&gt;-rw-rw---- 1 nobody wheel 1251262474 Mar 1 2022 /var/tmp/IC3.core.0.gz&lt;BR /&gt;-rw-rw---- 1 nobody wheel 1256350152 Oct 12 10:21 /var/tmp/IC3.core.1.gz&lt;BR /&gt;/var/tmp/pics/*core*: No such file or directory&lt;BR /&gt;/var/crash/kernel.*: No such file or directory&lt;BR /&gt;/var/jails/rest-api/tmp/*core*: No such file or directory&lt;BR /&gt;/tftpboot/corefiles/*core*: No such file or directory&lt;BR /&gt;/jail/var/tmp/*core*: No such file or directory&lt;BR /&gt;total files: 7&lt;/P&gt;&lt;P&gt;node1:&lt;BR /&gt;--------------------------------------------------------------------------&lt;BR /&gt;/var/crash/*core*: No such file or directory&lt;BR /&gt;-rw-rw---- 1 nobody wheel 34766848 Mar 2 2022 /var/tmp/IC3.core.0.gz&lt;BR /&gt;-rw-rw---- 1 nobody wheel 1151312299 Mar 1 2022 /var/tmp/IC0.core.0.gz&lt;BR /&gt;-rw-rw---- 1 nobody wheel 1153074056 Mar 1 2022 /var/tmp/IC1.core.0.gz&lt;BR /&gt;-rw-rw---- 1 nobody wheel 1158385356 Mar 1 2022 /var/tmp/IC2.core.0.gz&lt;BR /&gt;-rw-rw---- 1 nobody wheel 1150786252 Mar 1 2022 /var/tmp/IC3.core.0.gz&lt;BR /&gt;-rw-rw---- 1 root wheel 140366826 Dec 14 2021 /var/tmp/2d.core-tarball.0.tgz&lt;BR /&gt;-rw-rw---- 1 root wheel 140020614 Feb 12 2022 /var/tmp/b2d.core-tarball.1.tgz&lt;BR /&gt;/var/tmp/pics/*core*: No such file or directory&lt;BR /&gt;/var/crash/kernel.*: No such file or directory&lt;BR /&gt;/var/jails/rest-api/tmp/*core*: No such file or directory&lt;BR /&gt;/tftpboot/corefiles/*core*: No such file or directory&lt;BR /&gt;/jail/var/tmp/*core*: No such file or directory&lt;BR /&gt;total files: 7&lt;/P&gt;&lt;P&gt;{primary:node0}&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 15:57:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622451#M216372</guid>
      <dc:creator>tha_ghost99</dc:creator>
      <dc:date>2022-11-29T15:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: Regex search on multiple lines and displaying only if not matching a particular string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622466#M216383</link>
      <description>&lt;P&gt;You previously stated that you have a field called "core_dump" that only contain the dump data. &amp;nbsp;To work from _raw, you need to get to that field first.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex mode=sed "s/.*//" ``` get rid of first line ```
| eval core_dump = mvindex(split(_raw, "

"), 0, 1) ``` split two nodes ```
| mvexpand core_dump ``` split events according to node ```
| eval core_dump = split(core_dump, "
")
| rex mode=sed field=core_dump "s/(.*: No such file or directory|---*|total files:.*)//" ``` remove unwanted lines ```&lt;/LI-CODE&gt;&lt;P&gt;(Somehow replace doesn't work with this set of data. &amp;nbsp;But rex still works.)&lt;/P&gt;&lt;P&gt;Here is data emulation you can compare against.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw = "Oct 11 11:32:45
node0:
--------------------------------------------------------------------------
/var/crash/*core*: No such file or directory
-rw-rw---- 1 nobody wheel 1251399200 Oct 11 10:29 /var/tmp/C1.core.0.gz
-rw-rw---- 1 nobody wheel 1254654282 Oct 11 10:27 /var/tmp/C3.core.0.gz
-rw-rw---- 1 nobody wheel 1093812660 Mar 11 2022 /var/tmp/C0.core.0.gz
-rw-rw---- 1 nobody wheel 1255530083 Oct 11 10:24 /var/tmp/IC1.core.0.gz
-rw-rw---- 1 nobody wheel 184401920 Mar 11 2022 /var/tmp/IC2.core.0.gz
-rw-rw---- 1 nobody wheel 1251262474 Mar 1 2022 /var/tmp/IC3.core.0.gz
-rw-rw---- 1 nobody wheel 1256350152 Oct 12 10:21 /var/tmp/IC3.core.1.gz
/var/tmp/pics/*core*: No such file or directory
/var/crash/kernel.*: No such file or directory
/var/jails/rest-api/tmp/*core*: No such file or directory
/tftpboot/corefiles/*core*: No such file or directory
/jail/var/tmp/*core*: No such file or directory
total files: 7

node1:
--------------------------------------------------------------------------
/var/crash/*core*: No such file or directory
-rw-rw---- 1 nobody wheel 34766848 Mar 2 2022 /var/tmp/IC3.core.0.gz
-rw-rw---- 1 nobody wheel 1151312299 Mar 1 2022 /var/tmp/IC0.core.0.gz
-rw-rw---- 1 nobody wheel 1153074056 Mar 1 2022 /var/tmp/IC1.core.0.gz
-rw-rw---- 1 nobody wheel 1158385356 Mar 1 2022 /var/tmp/IC2.core.0.gz
-rw-rw---- 1 nobody wheel 1150786252 Mar 1 2022 /var/tmp/IC3.core.0.gz
-rw-rw---- 1 root wheel 140366826 Dec 14 2021 /var/tmp/2d.core-tarball.0.tgz
-rw-rw---- 1 root wheel 140020614 Feb 12 2022 /var/tmp/b2d.core-tarball.1.tgz
/var/tmp/pics/*core*: No such file or directory
/var/crash/kernel.*: No such file or directory
/var/jails/rest-api/tmp/*core*: No such file or directory
/tftpboot/corefiles/*core*: No such file or directory
/jail/var/tmp/*core*: No such file or directory
total files: 7

{primary:node0}"
| fields - _time
``` data emulation above ```&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 29 Nov 2022 17:53:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622466#M216383</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-11-29T17:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Regex search on multiple lines and displaying only if not matching a particular string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622475#M216387</link>
      <description>&lt;P&gt;&lt;SPAN&gt;You previously stated that you have a field called "core_dump" that only contain the dump data. &amp;nbsp;To work from _raw, you need to get to that field first.&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;LI-CODE lang="markup"&gt;| rex mode=sed "s/.*//" ``` get rid of first line ```
| eval core_dump = mvindex(split(_raw, "

"), 0, 1) ``` split two nodes ```
| mvexpand core_dump ``` split events according to node ```
| eval core_dump = mvmap(core_dump, replace(core_dump, "\n(.*: No such file or directory|---*|total files:.*)", "")) ``` remove unwanted lines ```&lt;/LI-CODE&gt;&lt;P&gt;(I assume that you don't want that total files line, either.)&lt;/P&gt;&lt;P&gt;Again, I tested against this emulation.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw = "Oct 11 11:32:45
node0:
--------------------------------------------------------------------------
/var/crash/*core*: No such file or directory
-rw-rw---- 1 nobody wheel 1251399200 Oct 11 10:29 /var/tmp/C1.core.0.gz
-rw-rw---- 1 nobody wheel 1254654282 Oct 11 10:27 /var/tmp/C3.core.0.gz
-rw-rw---- 1 nobody wheel 1093812660 Mar 11 2022 /var/tmp/C0.core.0.gz
-rw-rw---- 1 nobody wheel 1255530083 Oct 11 10:24 /var/tmp/IC1.core.0.gz
-rw-rw---- 1 nobody wheel 184401920 Mar 11 2022 /var/tmp/IC2.core.0.gz
-rw-rw---- 1 nobody wheel 1251262474 Mar 1 2022 /var/tmp/IC3.core.0.gz
-rw-rw---- 1 nobody wheel 1256350152 Oct 12 10:21 /var/tmp/IC3.core.1.gz
/var/tmp/pics/*core*: No such file or directory
/var/crash/kernel.*: No such file or directory
/var/jails/rest-api/tmp/*core*: No such file or directory
/tftpboot/corefiles/*core*: No such file or directory
/jail/var/tmp/*core*: No such file or directory
total files: 7

node1:
--------------------------------------------------------------------------
/var/crash/*core*: No such file or directory
-rw-rw---- 1 nobody wheel 34766848 Mar 2 2022 /var/tmp/IC3.core.0.gz
-rw-rw---- 1 nobody wheel 1151312299 Mar 1 2022 /var/tmp/IC0.core.0.gz
-rw-rw---- 1 nobody wheel 1153074056 Mar 1 2022 /var/tmp/IC1.core.0.gz
-rw-rw---- 1 nobody wheel 1158385356 Mar 1 2022 /var/tmp/IC2.core.0.gz
-rw-rw---- 1 nobody wheel 1150786252 Mar 1 2022 /var/tmp/IC3.core.0.gz
-rw-rw---- 1 root wheel 140366826 Dec 14 2021 /var/tmp/2d.core-tarball.0.tgz
-rw-rw---- 1 root wheel 140020614 Feb 12 2022 /var/tmp/b2d.core-tarball.1.tgz
/var/tmp/pics/*core*: No such file or directory
/var/crash/kernel.*: No such file or directory
/var/jails/rest-api/tmp/*core*: No such file or directory
/tftpboot/corefiles/*core*: No such file or directory
/jail/var/tmp/*core*: No such file or directory
total files: 7

{primary:node0}"
| fields - _time
``` data emulation above ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 18:09:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-search-on-multiple-lines-and-displaying-only-if/m-p/622475#M216387</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-11-29T18:09:26Z</dc:date>
    </item>
  </channel>
</rss>

