<?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 use AND operation with multivalue fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362890#M107210</link>
    <description>&lt;P&gt;I have a two multivalued fields &lt;BR /&gt;
1)segment_status -with values &lt;/P&gt;

&lt;P&gt;SUCCEEDED-100&lt;BR /&gt;
FAILED-100&lt;/P&gt;

&lt;P&gt;2)segment_provider_id-with values&lt;/P&gt;

&lt;P&gt;abc.com-10&lt;BR /&gt;
ddd.com-20&lt;BR /&gt;
ccc.com-30&lt;/P&gt;

&lt;P&gt;I am trying to find the following counts&lt;/P&gt;

&lt;P&gt;1) total count of segement_status(SUCCEDED+FAILED) with segment_provider_id=abc.com&lt;/P&gt;

&lt;P&gt;index=ggg..... &lt;BR /&gt;
segment_provider_id="abc.com"  segment_status=*&lt;BR /&gt;
 | eval abc=mvcount(segment_status) |stats sum(abc) as "Total"&lt;/P&gt;

&lt;P&gt;The above query I tried is taking all the segment_provider_id instead of only abc.com&lt;/P&gt;

&lt;P&gt;2)SUCCEDED COUNT AND FAILED COUNT &lt;/P&gt;

&lt;P&gt;index=ggg....segment_provider_id="abc.com"  segment_status=*&lt;BR /&gt;
| eval succeeded=mvfilter(match(segment_status, "SUCCEEDED")) | eval failed=mvfilter(match(segment_status, "FAILED")) | stats count(succeeded) AS succeeded_count, count(failed) AS failed_count&lt;/P&gt;

&lt;P&gt;The above is also considering all other providers instead of abc.com&lt;/P&gt;

&lt;P&gt;I tried using mvexpand but that is taking a lot of space&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 17:24:50 GMT</pubDate>
    <dc:creator>vrmandadi</dc:creator>
    <dc:date>2020-09-29T17:24:50Z</dc:date>
    <item>
      <title>How to use AND operation with multivalue fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362890#M107210</link>
      <description>&lt;P&gt;I have a two multivalued fields &lt;BR /&gt;
1)segment_status -with values &lt;/P&gt;

&lt;P&gt;SUCCEEDED-100&lt;BR /&gt;
FAILED-100&lt;/P&gt;

&lt;P&gt;2)segment_provider_id-with values&lt;/P&gt;

&lt;P&gt;abc.com-10&lt;BR /&gt;
ddd.com-20&lt;BR /&gt;
ccc.com-30&lt;/P&gt;

&lt;P&gt;I am trying to find the following counts&lt;/P&gt;

&lt;P&gt;1) total count of segement_status(SUCCEDED+FAILED) with segment_provider_id=abc.com&lt;/P&gt;

&lt;P&gt;index=ggg..... &lt;BR /&gt;
segment_provider_id="abc.com"  segment_status=*&lt;BR /&gt;
 | eval abc=mvcount(segment_status) |stats sum(abc) as "Total"&lt;/P&gt;

&lt;P&gt;The above query I tried is taking all the segment_provider_id instead of only abc.com&lt;/P&gt;

&lt;P&gt;2)SUCCEDED COUNT AND FAILED COUNT &lt;/P&gt;

&lt;P&gt;index=ggg....segment_provider_id="abc.com"  segment_status=*&lt;BR /&gt;
| eval succeeded=mvfilter(match(segment_status, "SUCCEEDED")) | eval failed=mvfilter(match(segment_status, "FAILED")) | stats count(succeeded) AS succeeded_count, count(failed) AS failed_count&lt;/P&gt;

&lt;P&gt;The above is also considering all other providers instead of abc.com&lt;/P&gt;

&lt;P&gt;I tried using mvexpand but that is taking a lot of space&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:24:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362890#M107210</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2020-09-29T17:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to use AND operation with multivalue fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362891#M107211</link>
      <description>&lt;P&gt;Will there be only 3 segment_provider_id or there may be others?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:24:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362891#M107211</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T17:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use AND operation with multivalue fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362892#M107212</link>
      <description>&lt;P&gt;there are many like 50+..&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 02:44:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362892#M107212</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2018-01-05T02:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to use AND operation with multivalue fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362893#M107213</link>
      <description>&lt;P&gt;For 1): It seems that you have events with both multivalue fields: &lt;CODE&gt;segment_provider_id&lt;/CODE&gt; and &lt;CODE&gt;segment_status&lt;/CODE&gt;.  What's happening when you search for &lt;CODE&gt;segment_provider_id=&amp;lt;value&amp;gt;&lt;/CODE&gt; is you probably get some results with &lt;CODE&gt;segment_provider_id&lt;/CODE&gt; values that aren't what you searched for.&lt;/P&gt;

&lt;P&gt;There is no internal relationship between the first value of &lt;CODE&gt;segment_provider_id&lt;/CODE&gt; and the first value of &lt;CODE&gt;segment_status&lt;/CODE&gt;.  If these fields are the same length, and value1 of one is associated with value1 of the other, you may need to make use of &lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/6.6.3/SearchReference/MultivalueEvalFunctions#mvzip.28X.2CY.2C.22Z.22.29"&gt;mvzip&lt;/A&gt; to create a new field that looks like: &lt;CODE&gt;abc.com:SUCCEEDED&lt;/CODE&gt;, then perform additional logic against that field, perhaps something like:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| table mvzipfield | mvexpand mvzipfield | rex field=mvzipfield "(?&amp;lt;segment_provider_id&amp;gt;[^:]+):(?&amp;lt;segment_status&amp;gt;.*)" | search segment_provider_id=abc.com | stats count&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Having events with multiple multi-value fields that are expected to relate to each other is certainly less than optimal, but sometimes can't be avoided.  And it should be stated that mvexpand can be a bad idea when there are a lot of events and/or a lot of field combinations (which is why my example uses &lt;CODE&gt;| table &amp;lt;one field only&amp;gt;&lt;/CODE&gt; prior to calling mvexpand).&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 04:16:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362893#M107213</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-05T04:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to use AND operation with multivalue fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362894#M107214</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
Can you check if below query works for you?&lt;BR /&gt;
index=ggg..... &lt;BR /&gt;
segment_provider_id=* segment_status=*&lt;BR /&gt;
| eval abc=mvcount(segment_status)| search segment_provider_id="abc.com" |stats sum(abc) as "Total"&lt;/P&gt;

&lt;P&gt;index=ggg....segment_provider_id=* segment_status=*&lt;BR /&gt;
| eval succeeded=mvfilter(match(segment_status, "SUCCEEDED")) | eval failed=mvfilter(match(segment_status, "FAILED"))| search segment_provider_id="abc.com"   | stats count(succeeded) AS succeeded_count, count(failed) AS failed_count&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:29:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362894#M107214</guid>
      <dc:creator>nikita_p</dc:creator>
      <dc:date>2020-09-29T17:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to use AND operation with multivalue fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362895#M107215</link>
      <description>&lt;P&gt;It did not work,the problem is ,it is taking all the provider_id instead of abc.com&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 14:41:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362895#M107215</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2018-01-05T14:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to use AND operation with multivalue fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362896#M107216</link>
      <description>&lt;P&gt;hello &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/96090"&gt;@micahkemp&lt;/a&gt;&lt;/P&gt;

&lt;P&gt;Thanks for the reply ,I tried the below query&lt;/P&gt;

&lt;P&gt;index=ggg | eval abc=mvzip(segment_status,segment_provider_id,":")&lt;BR /&gt;
|eval sss=mvzip(abc,segment_type,":") |table sss |mvexpand sss  | search sss=SUCCEEDED:abc.com:AD |stats count&lt;/P&gt;

&lt;P&gt;This gives me the result correctly but the problem is when I expand time range it is taking forever and its reaching the limit.&lt;/P&gt;

&lt;P&gt;Is there any other way other than using mvexpand?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:34:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362896#M107216</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2020-09-29T17:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to use AND operation with multivalue fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362897#M107217</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ggg
| eval abc=mvzip(segment_status,segment_provider_id,":")
| eval sss=mvzip(abc,segment_type,":")
| eval filtered_sss=mvfilter(match(sss, "SUCCEEDED:abc.com:AD"))
| stats count(filtered_sss) AS count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ggg
| eval abc=mvzip(segment_status,segment_provider_id,":")
| eval sss=mvzip(abc,segment_type,":")
| stats count(eval(filtered_sss="SUCCEEDED:abc.com:AD")) AS count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Jan 2018 17:17:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362897#M107217</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-05T17:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use AND operation with multivalue fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362898#M107218</link>
      <description>&lt;P&gt;@ micahkemp&lt;/P&gt;

&lt;P&gt;Thanks for the query,one small question is there a way to calculate the average of success and failure percentage of it&lt;/P&gt;

&lt;P&gt;| eval abc=mvzip(segment_status,segment_provider_id,":")&lt;BR /&gt;
|eval sss=mvzip(abc,segment_type,":") | eval filtered_sss=mvfilter(match(sss, ".*:abc.com:AD")) |stats count(filtered_sss) as Total,count(eval(filtered_sss="SUCCEEDED:abc.com:AD")) as S_Count |eval Success_Per=S_Count/Total * 100 |fields Success_Per&lt;/P&gt;

&lt;P&gt;I am trying this but not giving the correct results &lt;/P&gt;

&lt;P&gt;Total   S_Count Success_Per&lt;BR /&gt;
34206   10610   31.017950&lt;/P&gt;

&lt;P&gt;The S_Count is showing wrong as the original value is 27,359 .but it is not taking this value.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:35:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362898#M107218</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2020-09-29T17:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to use AND operation with multivalue fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362899#M107219</link>
      <description>&lt;P&gt;I'm not seeing any glaring issues in your search.  Is your search time the same? What method of verification did you use to assert that the value should be different than what is shown?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 21:44:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-operation-with-multivalue-fields/m-p/362899#M107219</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-08T21:44:20Z</dc:date>
    </item>
  </channel>
</rss>

