<?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 Re: get all fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/get-all-fields/m-p/661314#M228316</link>
    <description>&lt;P&gt;sure.&lt;/P&gt;&lt;P&gt;attached the valueCount and Pct.&lt;/P&gt;&lt;P&gt;also the number of events:&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;1,380,350&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;events&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Oct 2023 07:29:29 GMT</pubDate>
    <dc:creator>Shakira1</dc:creator>
    <dc:date>2023-10-19T07:29:29Z</dc:date>
    <item>
      <title>get all fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-all-fields/m-p/661005#M228214</link>
      <description>&lt;P&gt;&lt;SPAN&gt;HI&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I need to get the count of all fields in some index and then calculate how many times in percentage it occurred out of all events.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hope its clear.&lt;/P&gt;&lt;P&gt;thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 11:59:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-all-fields/m-p/661005#M228214</guid>
      <dc:creator>Shakira1</dc:creator>
      <dc:date>2023-10-17T11:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: get all fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-all-fields/m-p/661016#M228219</link>
      <description>&lt;P&gt;Use the &lt;FONT face="courier new,courier"&gt;fieldsummary&lt;/FONT&gt; command to get the field info then calculate the percentage from that info.&amp;nbsp; It's not clear which percentage is sought so modify the &lt;FONT face="courier new,courier"&gt;eventstats&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt; commands below as necessary.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal
| fieldsummary
``` Get the total number of fields ```
| eventstats sum(count) as Total,sum(distinct_count) as TotalDistinct
``` Compute the percentages ```
| eval Pct=round(count*100/Total,2), DistPct=round(distinct_count*100/TotalDistinct,2)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 13:13:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-all-fields/m-p/661016#M228219</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-10-17T13:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: get all fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-all-fields/m-p/661029#M228228</link>
      <description>&lt;P&gt;I would like to get the percentage of some count field from the total count&lt;/P&gt;&lt;P&gt;for example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;after using fieldsummary I got this:&amp;nbsp;&lt;SPAN&gt;[{"value":"/System/Library/LaunchAgents/com.apple.mdworker.shared.plist","count":61372} under value&amp;nbsp;key&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and the total count events is1,039,803, so in a new field I want to get the calculate&amp;nbsp;for how much in percentage the count (61372) is from the total (1,039,803), this result I want to get to all my fields.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 13:52:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-all-fields/m-p/661029#M228228</guid>
      <dc:creator>Shakira1</dc:creator>
      <dc:date>2023-10-17T13:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: get all fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-all-fields/m-p/661031#M228229</link>
      <description>&lt;P&gt;Is this more like what you envision?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal
| fieldsummary
| eventstats sum(count) as Total
``` Get rid of fields we don't need ```
| fields - max mean min stdev is_exact
``` Convert the values array to a multi-value field ```
| eval mv_values=json_array_to_mv(values)
``` Put each value into a separate event ```
| mvexpand mv_values
``` Extract value and its count ```
| rex field=mv_values "value\\\":\\\"(?&amp;lt;value&amp;gt;[^\"]+)\\\",\\\"count\\\":(?&amp;lt;valueCount&amp;gt;\d+)"
| eval Pct=round(valueCount*100/Total,2)
| table field value valueCount Pct&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 17 Oct 2023 14:25:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-all-fields/m-p/661031#M228229</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-10-17T14:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: get all fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-all-fields/m-p/661143#M228262</link>
      <description>&lt;P&gt;its looking very good! thank you.&lt;/P&gt;&lt;P&gt;I just dont understand the calculate results.&amp;nbsp;&lt;/P&gt;&lt;P&gt;for example: in valueCount I have 294723 from the total which is&amp;nbsp;&lt;SPAN&gt;1360007 should be&amp;nbsp;≈ 21.67% but in Pct field value I have&amp;nbsp;0.33, Do you know why?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;all my results in Pct are not correct.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 07:31:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-all-fields/m-p/661143#M228262</guid>
      <dc:creator>Shakira1</dc:creator>
      <dc:date>2023-10-18T07:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: get all fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-all-fields/m-p/661215#M228282</link>
      <description>&lt;P&gt;I don't get it, either.&amp;nbsp; When I plug your numbers into the query I get the expected 21.67.&amp;nbsp; Can you share a screenshot just so we're sure we're looking at the right numbers?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 15:05:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-all-fields/m-p/661215#M228282</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-10-18T15:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: get all fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/get-all-fields/m-p/661314#M228316</link>
      <description>&lt;P&gt;sure.&lt;/P&gt;&lt;P&gt;attached the valueCount and Pct.&lt;/P&gt;&lt;P&gt;also the number of events:&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;1,380,350&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;events&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 07:29:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/get-all-fields/m-p/661314#M228316</guid>
      <dc:creator>Shakira1</dc:creator>
      <dc:date>2023-10-19T07:29:29Z</dc:date>
    </item>
  </channel>
</rss>

