<?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: Is there any way that I can calculate the byte size for each field value based on count? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-there-any-way-that-I-can-calculate-the-byte-size-for-each/m-p/394855#M114688</link>
    <description>&lt;P&gt;hello there,&lt;/P&gt;

&lt;P&gt;hope i understand your question / requirement&lt;BR /&gt;
try the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = YOUR_INDEX_HERE sourcetype = YOUR_SUORCETYPE_HERE
field_A!="A" AND (field_B="abc" OR field_B="def" OR field_B="ghi" OR field_B="jkl" OR field_B="mno" ) 
|s tats count by field_B
| eval event_size_bytes =  len(field_B)
| eval event_size_kb = event_size_bytes/1024
| eval event_size_mb = event_size_bytes_kb/1024/1024
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;hope it helps&lt;/P&gt;</description>
    <pubDate>Wed, 09 May 2018 20:17:53 GMT</pubDate>
    <dc:creator>adonio</dc:creator>
    <dc:date>2018-05-09T20:17:53Z</dc:date>
    <item>
      <title>Is there any way that I can calculate the byte size for each field value based on count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-any-way-that-I-can-calculate-the-byte-size-for-each/m-p/394854#M114687</link>
      <description>&lt;P&gt;I have a query as below &lt;/P&gt;

&lt;P&gt;field_A!="A" AND (field_B="abc" OR field_B="def" OR field_B="ghi" OR field_B="jkl" OR field_B="mno" ) | stats count by field_B&lt;/P&gt;

&lt;P&gt;Which gives the result as follows &lt;/P&gt;

&lt;P&gt;field_B          count&lt;BR /&gt;
abc                548464&lt;BR /&gt;
def                 546546&lt;BR /&gt;
ghi                  845654&lt;BR /&gt;
jkl                    694855&lt;BR /&gt;
mno               354845&lt;/P&gt;

&lt;P&gt;Now how to modify my query to get the number_of_bytes, MB like below&lt;/P&gt;

&lt;P&gt;field_B          count         number_of_bytes                MB&lt;BR /&gt;
abc                548464           768723                             768&lt;BR /&gt;
def                 546546           434555                             456&lt;BR /&gt;
ghi                  845654          321545                              321&lt;BR /&gt;
jkl                    694855          243445                             267 &lt;BR /&gt;
mno               354845           645667                             689&lt;/P&gt;

&lt;P&gt;Is there any way that I can calculate the byte size for each field value based on count?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:30:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-any-way-that-I-can-calculate-the-byte-size-for-each/m-p/394854#M114687</guid>
      <dc:creator>pavanae</dc:creator>
      <dc:date>2020-09-29T19:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way that I can calculate the byte size for each field value based on count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-any-way-that-I-can-calculate-the-byte-size-for-each/m-p/394855#M114688</link>
      <description>&lt;P&gt;hello there,&lt;/P&gt;

&lt;P&gt;hope i understand your question / requirement&lt;BR /&gt;
try the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = YOUR_INDEX_HERE sourcetype = YOUR_SUORCETYPE_HERE
field_A!="A" AND (field_B="abc" OR field_B="def" OR field_B="ghi" OR field_B="jkl" OR field_B="mno" ) 
|s tats count by field_B
| eval event_size_bytes =  len(field_B)
| eval event_size_kb = event_size_bytes/1024
| eval event_size_mb = event_size_bytes_kb/1024/1024
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;hope it helps&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 20:17:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-any-way-that-I-can-calculate-the-byte-size-for-each/m-p/394855#M114688</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-05-09T20:17:53Z</dc:date>
    </item>
  </channel>
</rss>

