<?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 Log size in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Get-Log-size/m-p/334855#M160849</link>
    <description>&lt;P&gt;Thanks for your answer...let me try it .&lt;BR /&gt;
P&lt;/P&gt;</description>
    <pubDate>Sat, 03 Jun 2017 19:44:30 GMT</pubDate>
    <dc:creator>jw44250</dc:creator>
    <dc:date>2017-06-03T19:44:30Z</dc:date>
    <item>
      <title>Get Log size</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-Log-size/m-p/334851#M160845</link>
      <description>&lt;P&gt;I want to get the log size in MB and GB. I have used this command &lt;BR /&gt;
index=index1 |eval raw_len=(len(_raw)/1028) | stats sum(raw_len) by source&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:22:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-Log-size/m-p/334851#M160845</guid>
      <dc:creator>jw44250</dc:creator>
      <dc:date>2020-09-29T14:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Get Log size</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-Log-size/m-p/334852#M160846</link>
      <description>&lt;P&gt;check this out:&lt;BR /&gt;
&lt;A href="http://digital.ni.com/public.nsf/allkb/0F8C8B70234EBE308625708B00424DAD"&gt;http://digital.ni.com/public.nsf/allkb/0F8C8B70234EBE308625708B00424DAD&lt;/A&gt;&lt;BR /&gt;
here's a search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=alloyaudit_core
|eval raw_len=len(_raw)
| eval raw_len_kb = raw_len/1024
| eval raw_len_mb = raw_len/1024/1024
| eval raw_len_gb = raw_len/1024/1024/1024
| stats sum(raw_len) as Bytes sum(raw_len_kb) as KB sum(raw_len_mb) as MB sum(raw_len_gb) as GB by source
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;hope it helps&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jun 2017 01:31:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-Log-size/m-p/334852#M160846</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2017-06-03T01:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: Get Log size</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-Log-size/m-p/334853#M160847</link>
      <description>&lt;P&gt;That should be OK, what's the problem?  You just need to do more &lt;CODE&gt;/1028&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jun 2017 16:29:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-Log-size/m-p/334853#M160847</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-03T16:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Get Log size</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-Log-size/m-p/334854#M160848</link>
      <description>&lt;P&gt;Without much context as to why, using &lt;CODE&gt;len(_raw)&lt;/CODE&gt; is an ok &lt;EM&gt;approximation&lt;/EM&gt; of the size of a log... however you should know that len does not actually count &lt;EM&gt;bytes&lt;/EM&gt; but rather it counts &lt;EM&gt;characters&lt;/EM&gt;. If knowing bytes is crucial, I would refer you to looking at the &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.6.1/Admin/AboutSplunksLicenseUsageReportView"&gt;License Usage Report View&lt;/A&gt; or actually just running &lt;CODE&gt;ls -l&lt;/CODE&gt; or similar utilities on the box where the log comes from.&lt;/P&gt;

&lt;P&gt;To see this in action.... I made two files, one that contained &lt;CODE&gt;words&lt;/CODE&gt; and the other &lt;CODE&gt;كلمات&lt;/CODE&gt; I then put both in a directory and indexed them (taking good advantage of my &lt;A href="https://splunk.com/dev-test"&gt;dev-test&lt;/A&gt; license). Using &lt;CODE&gt;len()&lt;/CODE&gt; both come out to 5, but checking the index usage data, I can see that &lt;CODE&gt;words&lt;/CODE&gt; equals 5 bytes but  &lt;CODE&gt;كلمات&lt;/CODE&gt; is 10 bytes. (In this case, each character, encoded UTF-8 is 2 bytes wide). &lt;/P&gt;

&lt;P&gt;Now most system level logs, that you'd aggregate in Splunk tend to be US-ASCII so each character (UTF-8) happens to be 1 byte, but this might not be universally the case. &lt;/P&gt;

&lt;P&gt;EDIT: A bit more of a rabbit hole, but I had one file containing &lt;CODE&gt;كلمات&lt;/CODE&gt; encoded UTF-8 (10 bytes long), and another encoded ISO8859-6 (5 byte long file on disk). Ingesting the 8859-6 file using a sourcetype that specifies the encoding as such (so the text is readable in Splunk), the license impact is still 10 bytes, because translation to UTF-8 happens before counting license. &lt;/P&gt;</description>
      <pubDate>Sat, 03 Jun 2017 19:18:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-Log-size/m-p/334854#M160848</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2017-06-03T19:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: Get Log size</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-Log-size/m-p/334855#M160849</link>
      <description>&lt;P&gt;Thanks for your answer...let me try it .&lt;BR /&gt;
P&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jun 2017 19:44:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-Log-size/m-p/334855#M160849</guid>
      <dc:creator>jw44250</dc:creator>
      <dc:date>2017-06-03T19:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Get Log size</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-Log-size/m-p/334856#M160850</link>
      <description>&lt;P&gt;If you do /1024/1024/1024 you will go to 0 for small logs and it wont work. Just reuse the previously calculated value. then you save cycles and data&lt;/P&gt;</description>
      <pubDate>Thu, 23 Nov 2017 15:17:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-Log-size/m-p/334856#M160850</guid>
      <dc:creator>drnoah</dc:creator>
      <dc:date>2017-11-23T15:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Get Log size</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-Log-size/m-p/519020#M160851</link>
      <description>&lt;P&gt;it worked&lt;/P&gt;</description>
      <pubDate>Fri, 11 Sep 2020 08:29:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-Log-size/m-p/519020#M160851</guid>
      <dc:creator>sphiwee</dc:creator>
      <dc:date>2020-09-11T08:29:55Z</dc:date>
    </item>
  </channel>
</rss>

