<?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 edit my search to return events where Field2 has both values 'foo' AND 'bar' in multivalue Field1? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-events-where-Field2-has-both/m-p/216572#M63560</link>
    <description>&lt;P&gt;I have events in which Field1 contains multiple values, but I only need to look for two values (foo AND bar) and tie them to Field2. What's the most efficient way to craft this search?&lt;/P&gt;

&lt;P&gt;I'm basically looking for events to be returned in which Field2 has both 'foo' AND 'bar' in Field1.&lt;/P&gt;

&lt;P&gt;Thx&lt;/P&gt;</description>
    <pubDate>Tue, 23 Feb 2016 16:20:56 GMT</pubDate>
    <dc:creator>jwalzerpitt</dc:creator>
    <dc:date>2016-02-23T16:20:56Z</dc:date>
    <item>
      <title>How to edit my search to return events where Field2 has both values 'foo' AND 'bar' in multivalue Field1?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-events-where-Field2-has-both/m-p/216572#M63560</link>
      <description>&lt;P&gt;I have events in which Field1 contains multiple values, but I only need to look for two values (foo AND bar) and tie them to Field2. What's the most efficient way to craft this search?&lt;/P&gt;

&lt;P&gt;I'm basically looking for events to be returned in which Field2 has both 'foo' AND 'bar' in Field1.&lt;/P&gt;

&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2016 16:20:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-events-where-Field2-has-both/m-p/216572#M63560</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2016-02-23T16:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return events where Field2 has both values 'foo' AND 'bar' in multivalue Field1?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-events-where-Field2-has-both/m-p/216573#M63561</link>
      <description>&lt;P&gt;I do have the following query:&lt;/P&gt;

&lt;P&gt;index=indexname Field1=foo OR Field1=bar | stats values(Field1), dc(Field1) by Field2&lt;/P&gt;

&lt;P&gt;But if I change the 'OR' to 'AND' it kills the query&lt;/P&gt;

&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2016 16:53:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-events-where-Field2-has-both/m-p/216573#M63561</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2016-02-23T16:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return events where Field2 has both values 'foo' AND 'bar' in multivalue Field1?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-events-where-Field2-has-both/m-p/216574#M63562</link>
      <description>&lt;P&gt;I'm guessing that field1 in its original context is not a multivalue field. So what you need is an additional search command after your stats command. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=indexname Field1=foo OR Field1=bar | stats values(Field1), dc(Field1) by Field2 | search (Field1=foo AND Field1=bar)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Feb 2016 17:43:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-events-where-Field2-has-both/m-p/216574#M63562</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2016-02-23T17:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return events where Field2 has both values 'foo' AND 'bar' in multivalue Field1?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-events-where-Field2-has-both/m-p/216575#M63563</link>
      <description>&lt;P&gt;Thx for the reply - actually Field1 is the multivalue field (it has seven total values, but I'm only looking to pull two)&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2016 18:04:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-events-where-Field2-has-both/m-p/216575#M63563</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2016-02-23T18:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return events where Field2 has both values 'foo' AND 'bar' in multivalue Field1?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-events-where-Field2-has-both/m-p/216576#M63564</link>
      <description>&lt;P&gt;And i just realized one flaw in my logic in that Field1 will always be an 'OR' as the even though Field2 can have one of the two Field1 values, it will be one value per event. Field2 will never have 'foo' and 'bar' in the same event.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2016 18:09:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-events-where-Field2-has-both/m-p/216576#M63564</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2016-02-23T18:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return events where Field2 has both values 'foo' AND 'bar' in multivalue Field1?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-events-where-Field2-has-both/m-p/216577#M63565</link>
      <description>&lt;P&gt;I've been running the following query below and I believe I'm getting the results I need. Would be interested to see if someone could runt he same query and check if they're getting the results they'd expect as well.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=indexname Field1=foo OR Field1=bar | stats values(Field1), dc(Field1) as Total by Field2 | where Total &amp;gt;=2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 14:42:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-events-where-Field2-has-both/m-p/216577#M63565</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2016-02-24T14:42:30Z</dc:date>
    </item>
  </channel>
</rss>

