<?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 How to filter multiple values with pivot command - is the 'in' operator broken? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-multiple-values-with-pivot-command-is-the-in/m-p/348184#M103104</link>
    <description>&lt;P&gt;Based on the Splunk pivot command documentation, one should be able to use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| pivot .....
   splitrow fieldname
   filter fieldname in ("some text1", "some text2") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, this doesn't work for me - it only returns the first value in the list, not both of them.  Even if I remove the quotes from the strings which seems like it works ok, it still just return the first value.  However, this works:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| pivot .....
   splitrow fieldname
   filter fieldname contains some
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This isn't ideal because it returns a lot of stuff I don't want.  So the question is how do I do a simple OR logical to filter on multiple values with the pivot command?  &lt;/P&gt;

&lt;P&gt;Does the pivot command have a bug where the 'in' comparison operator doesn't work?&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jun 2017 20:18:47 GMT</pubDate>
    <dc:creator>wcooper003</dc:creator>
    <dc:date>2017-06-15T20:18:47Z</dc:date>
    <item>
      <title>How to filter multiple values with pivot command - is the 'in' operator broken?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-multiple-values-with-pivot-command-is-the-in/m-p/348184#M103104</link>
      <description>&lt;P&gt;Based on the Splunk pivot command documentation, one should be able to use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| pivot .....
   splitrow fieldname
   filter fieldname in ("some text1", "some text2") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, this doesn't work for me - it only returns the first value in the list, not both of them.  Even if I remove the quotes from the strings which seems like it works ok, it still just return the first value.  However, this works:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| pivot .....
   splitrow fieldname
   filter fieldname contains some
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This isn't ideal because it returns a lot of stuff I don't want.  So the question is how do I do a simple OR logical to filter on multiple values with the pivot command?  &lt;/P&gt;

&lt;P&gt;Does the pivot command have a bug where the 'in' comparison operator doesn't work?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 20:18:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-multiple-values-with-pivot-command-is-the-in/m-p/348184#M103104</guid>
      <dc:creator>wcooper003</dc:creator>
      <dc:date>2017-06-15T20:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter multiple values with pivot command - is the 'in' operator broken?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-multiple-values-with-pivot-command-is-the-in/m-p/348185#M103105</link>
      <description>&lt;P&gt;what version of splunk are you on?  I believe "in" is brand new.&lt;/P&gt;

&lt;P&gt;For older versions, try.... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (fieldname ="some text1" OR fieldname ="some text2") 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Jun 2017 03:34:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-multiple-values-with-pivot-command-is-the-in/m-p/348185#M103105</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-06-16T03:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter multiple values with pivot command - is the 'in' operator broken?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-multiple-values-with-pivot-command-is-the-in/m-p/348186#M103106</link>
      <description>&lt;P&gt;Thanks for the response.  Using 6.5.2 soon to be on 6.6.1.&lt;/P&gt;

&lt;P&gt;I tried that as:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| pivot .....
    splitrow fieldname
    filter (fieldname ="some text1" OR fieldname="some text2") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But that didn't execute.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 12:59:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-multiple-values-with-pivot-command-is-the-in/m-p/348186#M103106</guid>
      <dc:creator>wcooper003</dc:creator>
      <dc:date>2017-06-16T12:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter multiple values with pivot command - is the 'in' operator broken?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-multiple-values-with-pivot-command-is-the-in/m-p/348187#M103107</link>
      <description>&lt;P&gt;Interesting... no, 6.5 should be fine for &lt;CODE&gt;in&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;Documentation for FILTER is kind of bizarre.  The &lt;CODE&gt;=&lt;/CODE&gt; operator doesn't work with strings, you have to use &lt;CODE&gt;is&lt;/CODE&gt;?  &lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Okay, I added the bug tag, because this is apparently a bug, but here's a couple more shots in the dark for potential workarounds.  If either one works, it will be a minor miracle.&lt;/P&gt;

&lt;P&gt;A)  try using FILTER and IN in all caps.  The doc shows it in lower case, but what the heck.&lt;/P&gt;

&lt;P&gt;B) try &lt;CODE&gt;filter fieldname is "some text" OR fieldname is "some text2"&lt;/CODE&gt; .&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jun 2017 18:25:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-multiple-values-with-pivot-command-is-the-in/m-p/348187#M103107</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-06-17T18:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter multiple values with pivot command - is the 'in' operator broken?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-multiple-values-with-pivot-command-is-the-in/m-p/348188#M103108</link>
      <description>&lt;P&gt;I finally found a working answer! I am using Splunk 7.0 and above.&lt;/P&gt;

&lt;P&gt;This was what I did cause I couldn't find any working answer for passing multiselect tokens into Pivot FILTER command in the search query. (For a better understanding of how the SPL works)&lt;BR /&gt;
Step 1: Make a pivot table and add a filter using "is in list", add it as a inline search report into a dashboard.&lt;BR /&gt;
Step 2: Open the search query in Edit mode. TADA. you can see the cotde that they used. &lt;BR /&gt;
Step 3: Breathe a huge sigh of relief. The answer is simpler than what has been given ...&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Using the Multiselect token:&lt;/STRONG&gt;&lt;BR /&gt;
Set the following:&lt;BR /&gt;
token prefix and suffix as (  and )&lt;BR /&gt;
values prefix and suffix with "&lt;BR /&gt;
delimiter with ,&lt;/P&gt;

&lt;P&gt;("value1", "value2", value3"...) &amp;lt;- this is what u should see in their preview.&lt;/P&gt;

&lt;P&gt;**In search query""&lt;/P&gt;

&lt;P&gt;Simply type&lt;BR /&gt;
FILTER XXX in $xxx_token|s$&lt;BR /&gt;
Note that the token escape is the life saver. the values originally r kinda messed up.&lt;/P&gt;

&lt;P&gt;Please let  me know if it works for you guys.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 05:47:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-multiple-values-with-pivot-command-is-the-in/m-p/348188#M103108</guid>
      <dc:creator>valerie_tan</dc:creator>
      <dc:date>2018-03-10T05:47:56Z</dc:date>
    </item>
  </channel>
</rss>

