<?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: stats count by  fieldnames (not field strings) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/stats-count-by-fieldnames-not-field-strings/m-p/476244#M133762</link>
    <description>&lt;P&gt;You almost had it.  Try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   your base search
   | table data.*
   | rename data.* as *
   | eval junk=1
   | untable junk fieldname fieldvalue
   | stats count by fieldname
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 15 Apr 2020 15:29:16 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2020-04-15T15:29:16Z</dc:date>
    <item>
      <title>stats count by  fieldnames (not field strings)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-count-by-fieldnames-not-field-strings/m-p/476242#M133760</link>
      <description>&lt;P&gt;hi all, &lt;/P&gt;

&lt;P&gt;bit of a strange one... &lt;/P&gt;

&lt;P&gt;The business has put a descriptor of the product as a field name and it would be really useful to stats count by all field names (multiple parent and child categories.  I don't really care about the string within the field at this point, i just care that the field appears. &lt;/P&gt;

&lt;P&gt;For example&lt;/P&gt;

&lt;P&gt;events and field{string} could be:&lt;BR /&gt;
 - name = {testName}&lt;BR /&gt;
- address = {testAddress}&lt;BR /&gt;
- address = {testAddress}&lt;BR /&gt;
- postcode = {testPC}&lt;BR /&gt;
- name = {testName}&lt;BR /&gt;
- product = {testProduct}&lt;/P&gt;

&lt;P&gt;So my search should produce the following results&lt;/P&gt;

&lt;P&gt;eventName statscount&lt;BR /&gt;
name             2&lt;BR /&gt;
address         2&lt;BR /&gt;
postcode       1&lt;BR /&gt;
product         1&lt;/P&gt;

&lt;P&gt;any ideas would be great...&lt;/P&gt;

&lt;P&gt;just to add complexity.... there are child categories which goto 3 levels&lt;BR /&gt;
i.e. product.group.entity = {test entity}&lt;/P&gt;

&lt;P&gt;so ideally i'd capture ALL fieldnames in the one search (i will clean it later as long as i can get the logic right.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 08:57:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-count-by-fieldnames-not-field-strings/m-p/476242#M133760</guid>
      <dc:creator>stephenreece</dc:creator>
      <dc:date>2020-04-15T08:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: stats count by  fieldnames (not field strings)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-count-by-fieldnames-not-field-strings/m-p/476243#M133761</link>
      <description>&lt;P&gt;hi all... its almost like i need to do a fieldsummary table but only look at counting fields that sit under a parent field of say data.&lt;/P&gt;

&lt;P&gt;for example:&lt;BR /&gt;
data.name&lt;BR /&gt;
data.address&lt;BR /&gt;
data.address.postcode&lt;BR /&gt;
data.product&lt;BR /&gt;
data.product.group.entity&lt;/P&gt;

&lt;P&gt;(i need to count all those fields about by their fieldname&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 09:13:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-count-by-fieldnames-not-field-strings/m-p/476243#M133761</guid>
      <dc:creator>stephenreece</dc:creator>
      <dc:date>2020-04-15T09:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: stats count by  fieldnames (not field strings)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-count-by-fieldnames-not-field-strings/m-p/476244#M133762</link>
      <description>&lt;P&gt;You almost had it.  Try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   your base search
   | table data.*
   | rename data.* as *
   | eval junk=1
   | untable junk fieldname fieldvalue
   | stats count by fieldname
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Apr 2020 15:29:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-count-by-fieldnames-not-field-strings/m-p/476244#M133762</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2020-04-15T15:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: stats count by  fieldnames (not field strings)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-count-by-fieldnames-not-field-strings/m-p/476245#M133763</link>
      <description>&lt;P&gt;fantastic... thanks very much.... i was going to go along the spath route just for quickness but that would mean writing out each variation by hand... this is such an efficient was to searchl.... KUDOS&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 05:18:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-count-by-fieldnames-not-field-strings/m-p/476245#M133763</guid>
      <dc:creator>stephenreece</dc:creator>
      <dc:date>2020-04-16T05:18:21Z</dc:date>
    </item>
  </channel>
</rss>

