<?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 multi-valued field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103097#M26655</link>
    <description>&lt;P&gt;I'm sorry, I lost you there. By left-hand side inspector, do you mean the search terms?&lt;/P&gt;</description>
    <pubDate>Tue, 24 Jul 2012 01:49:00 GMT</pubDate>
    <dc:creator>jaterlwj</dc:creator>
    <dc:date>2012-07-24T01:49:00Z</dc:date>
    <item>
      <title>Splitting a multi-valued field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103092#M26650</link>
      <description>&lt;P&gt;I was wondering if there's any possible way to split up a multi-valued field using Splunk.&lt;/P&gt;

&lt;P&gt;For example. I have field called "classifications" and it looks like this. &lt;/P&gt;

&lt;P&gt;classifications = 1;2;3;4;5;6&lt;/P&gt;

&lt;P&gt;Is there any way to split it so that when I search "classifications=2" it would understand and show accordingly? &lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2012 03:42:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103092#M26650</guid>
      <dc:creator>jaterlwj</dc:creator>
      <dc:date>2012-07-19T03:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a multi-valued field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103093#M26651</link>
      <description>&lt;P&gt;Easy.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;whatever search&amp;gt; | eval splitted=split(classifications, ";") | search splitted=&amp;lt;value&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Substitute field names as you see fit.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2012 04:00:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103093#M26651</guid>
      <dc:creator>csharp_splunk</dc:creator>
      <dc:date>2012-07-19T04:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a multi-valued field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103094#M26652</link>
      <description>&lt;P&gt;Hi. Thanks for your prompt reply! &lt;BR /&gt;
I have tried to replace the &lt;VALUE&gt; with 1 but it does not return any results. Is there anything I'm missing? I am assuming it's just 1 and not "1" or &amp;lt;1&amp;gt; for the values at the moment!&lt;/VALUE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2012 07:31:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103094#M26652</guid>
      <dc:creator>jaterlwj</dc:creator>
      <dc:date>2012-07-19T07:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a multi-valued field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103095#M26653</link>
      <description>&lt;P&gt;I am not sure if this is good solution for you, but I had a similar situation where I needed to get the splitted values from multivalued fields.&lt;/P&gt;

&lt;P&gt;Basicly the way to split the multivalued field was the same as the one posted by csharp_splunk.&lt;BR /&gt;
This was how I tested and is messy, but it worked.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* | head 1 | eval classifications = "1;2;3;4;5;6" | makemv delim=";" classifications | top classifications | fields classifications | search classifications=2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This returns 2 only.&lt;/P&gt;

&lt;P&gt;The part:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* | head 1 | eval classifications = "1;2;3;4;5;6"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;is just to create dummy fields...&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2012 14:20:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103095#M26653</guid>
      <dc:creator>melonman</dc:creator>
      <dc:date>2012-07-20T14:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a multi-valued field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103096#M26654</link>
      <description>&lt;P&gt;I'd use the left-hand side inspector to show the values of splitted in results, to get a better idea the behavior you're  getting.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2012 14:44:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103096#M26654</guid>
      <dc:creator>jrodman</dc:creator>
      <dc:date>2012-07-20T14:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a multi-valued field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103097#M26655</link>
      <description>&lt;P&gt;I'm sorry, I lost you there. By left-hand side inspector, do you mean the search terms?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2012 01:49:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103097#M26655</guid>
      <dc:creator>jaterlwj</dc:creator>
      <dc:date>2012-07-24T01:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a multi-valued field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103098#M26656</link>
      <description>&lt;P&gt;I'm not sure what am I missing.. Similar to csharp_splunk's method. I can't get it to work properly.&lt;/P&gt;

&lt;P&gt;My records usually either starts with a 0(0;1;2;3) or 2(2;3;4;5) etc.&lt;/P&gt;

&lt;P&gt;So after splitting, when I tried to list them out using stats count classifications. They only showed 0 and 2. &lt;/P&gt;

&lt;P&gt;Is it normal? I can't seem to search for values either.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2012 05:06:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103098#M26656</guid>
      <dc:creator>jaterlwj</dc:creator>
      <dc:date>2012-07-24T05:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a multi-valued field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103099#M26657</link>
      <description>&lt;P&gt;I have a field that has: value1,value2,value3. I was using split: split_value=split(field, ",")&lt;/P&gt;

&lt;P&gt;Afterwards, however, I was not able to search on just one of the items. My search string:&lt;/P&gt;

&lt;P&gt;| eval values=split(field, ",") | search values=foo**&lt;BR /&gt;
This search would show all of the results of values, instead of just foo.&lt;/P&gt;

&lt;P&gt;Using the makemv delim method, it works. Weird ...&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2015 21:22:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103099#M26657</guid>
      <dc:creator>rps462</dc:creator>
      <dc:date>2015-09-03T21:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a multi-valued field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103100#M26658</link>
      <description>&lt;P&gt;pfft .. nevermind, it does the same thing - this is driving me crazy. I cannot restrict the search to certain elements of a field after a split.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2015 21:25:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103100#M26658</guid>
      <dc:creator>rps462</dc:creator>
      <dc:date>2015-09-03T21:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a multi-valued field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103101#M26659</link>
      <description>&lt;P&gt;the left hand side inspector i suppose is the side panel where all interesting and extracted fields show up.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2016 03:04:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103101#M26659</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2016-10-07T03:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a multi-valued field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103102#M26660</link>
      <description>&lt;P&gt;I run into this problem and have a rough work around. I have to create an mv field using values for a paticular reason, and then match  a substring of that value to another field.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...|stats values(field) as fieldname by sourcetype 
| nomv fieldname
|rex mode=sed field=fieldname "s/ /,/g"
|rex mode=sed field=fieldname "s/^/,/"
|rex mode=sed field=fieldname "s/$/,/" 
|eval match=if(isnotnull(match(fieldname,",".matchfield.","),1,0) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I realize this isn't EXACTLY what you need to do, but it might help start you off. I did a nomv to get it into one row and then replaced my spaces with commas, however it looks like you're already ; delimited so you're a few steps ahead of me. You  might be able to get by with just doing something along the lines of&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...|eval match=if(isnotnull(match(fieldname,";".2.";"),1,0) |search match=1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Oct 2016 15:58:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splitting-a-multi-valued-field/m-p/103102#M26660</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2016-10-07T15:58:48Z</dc:date>
    </item>
  </channel>
</rss>

