<?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 To find the count of specific fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/To-find-the-count-of-specific-fields/m-p/683806#M233460</link>
    <description>&lt;P&gt;Hi Team&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to know if it is possible to find the count of specific fields and show them in different columns.&lt;/P&gt;&lt;P&gt;Example :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Real_captain_0-1712743767116.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/30346iCAC562370C9D2B77/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Real_captain_0-1712743767116.png" alt="Real_captain_0-1712743767116.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the above example, i want the result in the below format:&lt;/P&gt;&lt;P&gt;| Date | File RPWARDA | Count of File SPWARAA |&amp;nbsp;&amp;nbsp;Count of File SPWARAA |&amp;nbsp;Count of File SPWARRA | Diff (RPWARDA &amp;nbsp; - ( SPWARAA +SPWARRA ) ) |&lt;/P&gt;&lt;P&gt;|2024/04/10 |&amp;nbsp;49 |&amp;nbsp;38 | 5 | 6 |&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible using a splunk query ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Original query :&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=events_prod_cdp_penalty_esa source="SYSLOG"&lt;BR /&gt;(TERM(NIDF=RPWARDA) OR TERM(NIDF=SPWARAA) OR TERM(NIDF=SPWARRA))&lt;BR /&gt;| rex field=TEXT "NIDF=(?&amp;lt;file&amp;gt;[^\\s]+)"&lt;BR /&gt;| eval DIR = if(file="RPWARDA" ,"IN","OUT")&lt;BR /&gt;| convert timeformat="%Y/%m/%d" ctime(_time) AS Date&lt;BR /&gt;| stats count by Date , file , DIR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Apr 2024 10:13:47 GMT</pubDate>
    <dc:creator>Real_captain</dc:creator>
    <dc:date>2024-04-10T10:13:47Z</dc:date>
    <item>
      <title>To find the count of specific fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/To-find-the-count-of-specific-fields/m-p/683806#M233460</link>
      <description>&lt;P&gt;Hi Team&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to know if it is possible to find the count of specific fields and show them in different columns.&lt;/P&gt;&lt;P&gt;Example :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Real_captain_0-1712743767116.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/30346iCAC562370C9D2B77/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Real_captain_0-1712743767116.png" alt="Real_captain_0-1712743767116.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the above example, i want the result in the below format:&lt;/P&gt;&lt;P&gt;| Date | File RPWARDA | Count of File SPWARAA |&amp;nbsp;&amp;nbsp;Count of File SPWARAA |&amp;nbsp;Count of File SPWARRA | Diff (RPWARDA &amp;nbsp; - ( SPWARAA +SPWARRA ) ) |&lt;/P&gt;&lt;P&gt;|2024/04/10 |&amp;nbsp;49 |&amp;nbsp;38 | 5 | 6 |&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible using a splunk query ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Original query :&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=events_prod_cdp_penalty_esa source="SYSLOG"&lt;BR /&gt;(TERM(NIDF=RPWARDA) OR TERM(NIDF=SPWARAA) OR TERM(NIDF=SPWARRA))&lt;BR /&gt;| rex field=TEXT "NIDF=(?&amp;lt;file&amp;gt;[^\\s]+)"&lt;BR /&gt;| eval DIR = if(file="RPWARDA" ,"IN","OUT")&lt;BR /&gt;| convert timeformat="%Y/%m/%d" ctime(_time) AS Date&lt;BR /&gt;| stats count by Date , file , DIR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2024 10:13:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/To-find-the-count-of-specific-fields/m-p/683806#M233460</guid>
      <dc:creator>Real_captain</dc:creator>
      <dc:date>2024-04-10T10:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: To find the count of specific fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/To-find-the-count-of-specific-fields/m-p/683809#M233462</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/263966"&gt;@Real_captain&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You can try below;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=events_prod_cdp_penalty_esa source="SYSLOG" (TERM(NIDF=RPWARDA) OR TERM(NIDF=SPWARAA) OR TERM(NIDF=SPWARRA))
| rex field=TEXT "NIDF=(?&amp;lt;file&amp;gt;[^\\s]+)"
| convert timeformat="%Y/%m/%d" ctime(_time) AS Date
| stats count(eval(file="RPWARDA")) AS RPWARDA, count(eval(file="SPWARAA")) AS SPWARAA, count(eval(file="SPWARRA")) AS SPWARRA by Date
| eval Diff=(RPWARDA-(SPWARAA+SPWARRA))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2024 11:01:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/To-find-the-count-of-specific-fields/m-p/683809#M233462</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2024-04-10T11:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: To find the count of specific fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/To-find-the-count-of-specific-fields/m-p/683815#M233464</link>
      <description>&lt;P&gt;1. I don't see why you calculate the IN/OUT parameter if you don't need this value in the end.&lt;/P&gt;&lt;P&gt;2. Assuming you don't need the DIR field, you can simply use xyseries to... put your values into a x/y table.&lt;/P&gt;&lt;PRE&gt;| xyseries Date file count&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Now you can just calculate your sum/difference of various files as you have them as separate fields. (you might have to fillnull with zero if you have blank spaces).&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2024 12:16:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/To-find-the-count-of-specific-fields/m-p/683815#M233464</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-04-10T12:16:15Z</dc:date>
    </item>
  </channel>
</rss>

