<?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 Search all fields for value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153450#M43060</link>
    <description>&lt;P&gt;Hello All&lt;/P&gt;

&lt;P&gt;I am looking to search a number of fields (31) that may have the same value then count the number of times the value appears in that search.&lt;/P&gt;

&lt;P&gt;I am using KVSTORE with a collection named DOJO_DEV.&lt;/P&gt;

&lt;P&gt;Any thoughts?&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Ed&lt;/P&gt;</description>
    <pubDate>Mon, 03 Aug 2015 22:36:26 GMT</pubDate>
    <dc:creator>edroche3rd</dc:creator>
    <dc:date>2015-08-03T22:36:26Z</dc:date>
    <item>
      <title>Search all fields for value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153450#M43060</link>
      <description>&lt;P&gt;Hello All&lt;/P&gt;

&lt;P&gt;I am looking to search a number of fields (31) that may have the same value then count the number of times the value appears in that search.&lt;/P&gt;

&lt;P&gt;I am using KVSTORE with a collection named DOJO_DEV.&lt;/P&gt;

&lt;P&gt;Any thoughts?&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Ed&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2015 22:36:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153450#M43060</guid>
      <dc:creator>edroche3rd</dc:creator>
      <dc:date>2015-08-03T22:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Search all fields for value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153451#M43061</link>
      <description>&lt;P&gt;I believe that this most excellent answer will give you all that you need to build your own solution.  If not, post a followup comment as to how far you got and we will help you get from there to the end:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://answers.splunk.com/answers/269855/searching-a-number-of-fields-with-the-same-keyword.html"&gt;http://answers.splunk.com/answers/269855/searching-a-number-of-fields-with-the-same-keyword.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2015 22:56:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153451#M43061</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-03T22:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Search all fields for value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153452#M43062</link>
      <description>&lt;P&gt;Thanks worked great, had to tweak to fit my needs but it laid the groundwork that I was trying to figure out all afternoon.&lt;/P&gt;

&lt;P&gt;Here is what I used:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;| stats count as fields | eval fields = "netq, bmc, ehlth, netdoc, hpnnm, splunk, trident" | eval values = "None" | makemv fields | makemv values | mvexpand fields | mvexpand values | eval {fields} = values | fields - fields values | stats count&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 04 Aug 2015 01:41:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153452#M43062</guid>
      <dc:creator>edroche3rd</dc:creator>
      <dc:date>2015-08-04T01:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Search all fields for value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153453#M43063</link>
      <description>&lt;P&gt;Follow up: after further testing this morning this gives me the fields that have a certain value BUT not the total number of times the value is used.....example...the value of field1=red but there might be 20 record where field1=red but only getting the one entry that just confirming that the field has AT LEAST one red value.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2015 15:20:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153453#M43063</guid>
      <dc:creator>edroche3rd</dc:creator>
      <dc:date>2015-08-04T15:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: Search all fields for value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153454#M43064</link>
      <description>&lt;P&gt;The images below show you the 2 views that I get. Like I said it is only show if the field has a certain value not how many time the value appears.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/527i0D4CC0E3169908E2/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/528iC89FAA80EAD96B13/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2015 15:29:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153454#M43064</guid>
      <dc:creator>edroche3rd</dc:creator>
      <dc:date>2015-08-04T15:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: Search all fields for value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153455#M43065</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup dojo_dev [| noop | stats count as fields | eval fields = "netq bmc ehlth netdoc hpnnm splunk trident" | eval values = "None" | makemv fields | makemv values | mvexpand fields | mvexpand values | eval {fields} = values | fields - fields values | format "| eval fieldsWithValueCount=" "if((" "OR" "),1,0)" "+" ""] | fields values fieldsWithValueCount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To understand what it is doing, remove everything before &lt;CODE&gt;[&lt;/CODE&gt; and after &lt;CODE&gt;]&lt;/CODE&gt; including the brackets themselves.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2015 18:52:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153455#M43065</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-04T18:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Search all fields for value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153456#M43066</link>
      <description>&lt;P&gt;That gives me all the fields for all the records...it doesn't calculate the number of time a value is list.&lt;/P&gt;

&lt;P&gt;example: field1=Blue and field2=Red and field3=Blue....how many times was blue used....2 times.&lt;/P&gt;

&lt;P&gt;Sorry if I sound like a smart ass not trying to be. I am just trying to explain the best I can &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2015 19:47:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153456#M43066</guid>
      <dc:creator>edroche3rd</dc:creator>
      <dc:date>2015-08-04T19:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: Search all fields for value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153457#M43067</link>
      <description>&lt;P&gt;The answer should be in the field &lt;CODE&gt;fieldsWithValueCount&lt;/CODE&gt; because this &lt;CODE&gt;subsearch&lt;/CODE&gt; part...:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| noop | stats count as fields | eval fields = "netq bmc ehlth netdoc hpnnm splunk trident" | eval values = "None" | makemv fields | makemv values | mvexpand fields | mvexpand values | eval {fields} = values | fields - fields values | format "| eval fieldsWithValueCount=" "if((" "" "),1,0)" "+" ""
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...evaluates into this search clause...:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval fieldsWithValueCount= if(( netq="None" ),1,0) + if(( bmc="None" ),1,0) + if(( ehlth="None" ),1,0) + if(( netdoc="None" ),1,0) + if(( hpnnm="None" ),1,0) + if(( splunk="None" ),1,0) + if(( trident="None" ),1,0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...and that is the part that does the calculation.  If you put this into a macro then you can call it programatically like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | `countFieldsWithValues("netq bmc ehlth netdoc hpnnm splunk trident", "None", fieldsWithValueCount)`
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Aug 2015 20:00:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153457#M43067</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-04T20:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: Search all fields for value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153458#M43068</link>
      <description>&lt;P&gt;Here is the full code I am using (with all fields), what it is giving me (I would do a screenshot but it is only letting me do a comment instead of answer) is a table layout with all fields across top, a line for each record and then value for each field in each record. Which is fine but I am trying dwindle it down to a single field with the total number of times "Black" was used. This will go into a Single Digit Dashboard. What you think?&lt;/P&gt;

&lt;P&gt;| inputlookup dojo_dev [| noop  | stats count as fields  | eval fields = "netq bmc ehlth netdoc hpnnm splunk trident aternity ngenius sniffer airwave vidconf brocade rivrbd clrpass dns dhcp cisco ciscoworks bna asafwalls paltoaltofwalls xnet certadmin bluecat ldbalf5 webservx150 raisedflrserv"  | eval values = "Black"  | makemv fields  | makemv values  | mvexpand fields  | mvexpand values  | eval {fields} = values  |  format "| eval fieldsWithValueCount=" "if((" "OR" "),1,0)" "+" ""]&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2015 21:29:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153458#M43068</guid>
      <dc:creator>edroche3rd</dc:creator>
      <dc:date>2015-08-04T21:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Search all fields for value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153459#M43069</link>
      <description>&lt;P&gt;Let's back up from this rabbit trail and take a completely different (and simpler) approach.  Assuming you are trying to count the number of fields that have the value &lt;CODE&gt;None&lt;/CODE&gt; try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup dojo_dev | eval matchCount=0 | foreach * [eval matchCount = matchCount + if(match(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;, "^None$"), 1, 0) ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Aug 2015 22:47:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153459#M43069</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-04T22:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: Search all fields for value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153460#M43070</link>
      <description>&lt;P&gt;This worked perfect!!! Sorry for delayed response.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2015 14:55:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153460#M43070</guid>
      <dc:creator>edroche3rd</dc:creator>
      <dc:date>2015-08-11T14:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: Search all fields for value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153461#M43071</link>
      <description>&lt;P&gt;This worked perfect!!! Sorry for delayed response.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2015 14:56:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153461#M43071</guid>
      <dc:creator>edroche3rd</dc:creator>
      <dc:date>2015-08-11T14:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Search all fields for value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153462#M43072</link>
      <description>&lt;P&gt;I believe you accepted the wrong answer &lt;span class="lia-unicode-emoji" title=":grinning_squinting_face:"&gt;😆&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2015 14:58:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153462#M43072</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-11T14:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Search all fields for value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153463#M43073</link>
      <description>&lt;P&gt;Works Perfect!&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2015 19:46:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153463#M43073</guid>
      <dc:creator>edroche3rd</dc:creator>
      <dc:date>2015-08-11T19:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: Search all fields for value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153464#M43074</link>
      <description>&lt;P&gt;Thanks.  I am glad you got a solution.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2015 21:01:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-all-fields-for-value/m-p/153464#M43074</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-11T21:01:48Z</dc:date>
    </item>
  </channel>
</rss>

