<?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: makemv with tokenizer while keeping non-matching events? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-makemv-with-tokenizers-while-keeping-non-matching/m-p/506826#M141775</link>
    <description>&lt;P&gt;Hi bowesmana,&lt;/P&gt;&lt;P&gt;great idea - this put me on the right track.&lt;/P&gt;&lt;P&gt;What I do now is to use an eval before the makemv that creates an ID value if empty, that matches my tokenizer but cannot occur in the real data.&lt;/P&gt;&lt;P&gt;After the the mvexpand I use another eval to remove this dummy-ID again.&lt;/P&gt;&lt;P&gt;Seems to work fine. And two evals should be better than two searches.&lt;/P&gt;&lt;P&gt;Thank you very much and kind regards,&lt;/P&gt;&lt;P&gt;Gunnar&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jul 2020 07:34:47 GMT</pubDate>
    <dc:creator>Gunnar</dc:creator>
    <dc:date>2020-07-01T07:34:47Z</dc:date>
    <item>
      <title>How to use makemv with tokenizers while keeping non-matching events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-makemv-with-tokenizers-while-keeping-non-matching/m-p/506523#M141714</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have events similar to this example:&lt;/P&gt;
&lt;P&gt;1) date1, id1, misc&lt;/P&gt;
&lt;P&gt;2) date2, id2, misc&lt;/P&gt;
&lt;P&gt;3) date3, , misc&lt;/P&gt;
&lt;P&gt;4) date4, id3 and id4, misc&lt;/P&gt;
&lt;P&gt;The ids in 4) should be split into two separate lines.&amp;nbsp; The result should look like this:&lt;/P&gt;
&lt;P&gt;1) date1, id1, misc&lt;/P&gt;
&lt;P&gt;2) date2, id2, misc&lt;/P&gt;
&lt;P&gt;3) date3, , misc&lt;/P&gt;
&lt;P&gt;4) date4, id3 , misc&lt;/P&gt;
&lt;P&gt;5) date4, id4, misc&lt;/P&gt;
&lt;P&gt;But when using makemv with tokenizer lines which do not match, the tokenizers are skipped in the result, e.g.:&lt;/P&gt;
&lt;P&gt;... | makemv tokenizer="(id\d)" ID | mvexpand ID | ...&lt;/P&gt;
&lt;P&gt;Results in:&lt;/P&gt;
&lt;P&gt;1) date1, id1, misc&lt;/P&gt;
&lt;P&gt;2) date2, id2, misc&lt;/P&gt;
&lt;P&gt;3) date4, id3 , misc&lt;/P&gt;
&lt;P&gt;4) date4, id4, misc&lt;/P&gt;
&lt;P&gt;How can I keep the non-matching lines? Is there a way to only use makemv where it is necessary?&lt;/P&gt;
&lt;P&gt;My workaround at the moment is to append a second search that looks for events with an empty ID and adds those events again after the makemv, e,g,:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;first search | ...  |  makemv tokenizer="(id\d)" ID | mvexpand ID | append [ first search again | ... | search NOT ID="*" | ... ] | ...&lt;/LI-CODE&gt;
&lt;P&gt;But searching twice can't be an optimal solution.&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Gunnar&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 18:17:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-makemv-with-tokenizers-while-keeping-non-matching/m-p/506523#M141714</guid>
      <dc:creator>Gunnar</dc:creator>
      <dc:date>2020-07-01T18:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: makemv with tokenizer while keeping non-matching events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-makemv-with-tokenizers-while-keeping-non-matching/m-p/506797#M141767</link>
      <description>&lt;P&gt;Not sure of the exact format of your data, but look at this example using split/mvexpand where fillnull is used to ensure the missing id gets preserved in the mvexpand&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=4
| eval t=1 
| accum t
| eval _time=now() - (random() % 86400)
| eval id=case(t=1,"id1",t=2,"id2",t=3,null,t=4,"id3 id4")
| eval misc=random()
| fields - t
| eval id=split(id," ")
| fillnull value="" id
| mvexpand id&lt;/LI-CODE&gt;&lt;P&gt;It's likely that fillnull will solve your problem in your example makemv case also - set the value to whatever makes sense in your context.&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 22:33:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-makemv-with-tokenizers-while-keeping-non-matching/m-p/506797#M141767</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-06-30T22:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: makemv with tokenizer while keeping non-matching events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-makemv-with-tokenizers-while-keeping-non-matching/m-p/506826#M141775</link>
      <description>&lt;P&gt;Hi bowesmana,&lt;/P&gt;&lt;P&gt;great idea - this put me on the right track.&lt;/P&gt;&lt;P&gt;What I do now is to use an eval before the makemv that creates an ID value if empty, that matches my tokenizer but cannot occur in the real data.&lt;/P&gt;&lt;P&gt;After the the mvexpand I use another eval to remove this dummy-ID again.&lt;/P&gt;&lt;P&gt;Seems to work fine. And two evals should be better than two searches.&lt;/P&gt;&lt;P&gt;Thank you very much and kind regards,&lt;/P&gt;&lt;P&gt;Gunnar&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 07:34:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-makemv-with-tokenizers-while-keeping-non-matching/m-p/506826#M141775</guid>
      <dc:creator>Gunnar</dc:creator>
      <dc:date>2020-07-01T07:34:47Z</dc:date>
    </item>
  </channel>
</rss>

