<?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 Split not working according to other commands in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Split-not-working-according-to-other-commands/m-p/169504#M48453</link>
    <description>&lt;P&gt;Here is a log file example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2015-06-22T09:54:42.767-0600 name=processTwo items="A123"
2015-06-20T21:23:03.279-0600 name=processOne items="OTHER-4, OTHER-3, OTHER-2, OTHER-1, A123"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I run the following query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="test.log" | eval item=split(items, ",") | stats count by item
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;item    count
A123    1
OTHER-1 1
OTHER-2 1
OTHER-3 1
A123    1
OTHER-4 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is what I expected:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;item    count
A123    2
OTHER-1 1
OTHER-2 1
OTHER-3 1
OTHER-4 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Why is &lt;CODE&gt;split&lt;/CODE&gt; doing this? I tried &lt;CODE&gt;mvexpand&lt;/CODE&gt; on &lt;CODE&gt;item&lt;/CODE&gt;, and that didn't work.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="test.log" | eval item=split(items, ",") | mvexpand item | search item="A123" | table _time, item, name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This only returns &lt;CODE&gt;processTwo&lt;/CODE&gt;, and I would expect it to return both &lt;CODE&gt;processOne&lt;/CODE&gt; and &lt;CODE&gt;processTwo&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I also tried the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="test.log" | makemv items delim="," | stats count by items
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which also does not work.&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jun 2015 19:43:33 GMT</pubDate>
    <dc:creator>lshatzer</dc:creator>
    <dc:date>2015-06-22T19:43:33Z</dc:date>
    <item>
      <title>Split not working according to other commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-not-working-according-to-other-commands/m-p/169504#M48453</link>
      <description>&lt;P&gt;Here is a log file example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2015-06-22T09:54:42.767-0600 name=processTwo items="A123"
2015-06-20T21:23:03.279-0600 name=processOne items="OTHER-4, OTHER-3, OTHER-2, OTHER-1, A123"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I run the following query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="test.log" | eval item=split(items, ",") | stats count by item
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;item    count
A123    1
OTHER-1 1
OTHER-2 1
OTHER-3 1
A123    1
OTHER-4 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is what I expected:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;item    count
A123    2
OTHER-1 1
OTHER-2 1
OTHER-3 1
OTHER-4 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Why is &lt;CODE&gt;split&lt;/CODE&gt; doing this? I tried &lt;CODE&gt;mvexpand&lt;/CODE&gt; on &lt;CODE&gt;item&lt;/CODE&gt;, and that didn't work.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="test.log" | eval item=split(items, ",") | mvexpand item | search item="A123" | table _time, item, name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This only returns &lt;CODE&gt;processTwo&lt;/CODE&gt;, and I would expect it to return both &lt;CODE&gt;processOne&lt;/CODE&gt; and &lt;CODE&gt;processTwo&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I also tried the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="test.log" | makemv items delim="," | stats count by items
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which also does not work.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2015 19:43:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-not-working-according-to-other-commands/m-p/169504#M48453</guid>
      <dc:creator>lshatzer</dc:creator>
      <dc:date>2015-06-22T19:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Split not working according to other commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-not-working-according-to-other-commands/m-p/169505#M48454</link>
      <description>&lt;P&gt;Hello! Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="test.log" | eval item=split(items, ",") |table item| stats count by item
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2015 23:11:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-not-working-according-to-other-commands/m-p/169505#M48454</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-06-22T23:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Split not working according to other commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-not-working-according-to-other-commands/m-p/169506#M48455</link>
      <description>&lt;P&gt;I forgot to mention I tried that as well, same results.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2015 23:23:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-not-working-according-to-other-commands/m-p/169506#M48455</guid>
      <dc:creator>lshatzer</dc:creator>
      <dc:date>2015-06-22T23:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Split not working according to other commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-not-working-according-to-other-commands/m-p/169507#M48456</link>
      <description>&lt;P&gt;Ok try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="test.log" | eval item=split(items, ",") | mvexpand item|table item| stats count by item 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Jun 2015 23:36:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-not-working-according-to-other-commands/m-p/169507#M48456</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-06-22T23:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: Split not working according to other commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-not-working-according-to-other-commands/m-p/169508#M48457</link>
      <description>&lt;P&gt;Same result as well.&lt;/P&gt;

&lt;P&gt;Also for fun I swapped the &lt;CODE&gt;table&lt;/CODE&gt; and &lt;CODE&gt;mvexpand&lt;/CODE&gt;. Still the same.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2015 23:44:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-not-working-according-to-other-commands/m-p/169508#M48457</guid>
      <dc:creator>lshatzer</dc:creator>
      <dc:date>2015-06-22T23:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Split not working according to other commands</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-not-working-according-to-other-commands/m-p/169509#M48458</link>
      <description>&lt;P&gt;Splunk is trimming the output it displays, which was throwing me off, but is not trimming it for the data it is processing. I needed to either add &lt;CODE&gt;|eval item=trim(item)&lt;/CODE&gt; or change to &lt;CODE&gt;|eval item=split(items, ", ")&lt;/CODE&gt; (with a space after the comma).&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2015 00:08:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-not-working-according-to-other-commands/m-p/169509#M48458</guid>
      <dc:creator>lshatzer</dc:creator>
      <dc:date>2015-06-23T00:08:12Z</dc:date>
    </item>
  </channel>
</rss>

