<?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: Apache Access Log Extract Byte Size in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Apache-Access-Log-Extract-Byte-Size/m-p/486911#M83393</link>
    <description>&lt;P&gt;Mayurr98, that won't work, size is not defined.&lt;/P&gt;

&lt;P&gt;After a bit of testing, I've ended up creating my own query, that takes everything after the last empty space (after 9th character we have a size in bytes) and used it like this to get the bandwidth that is used by .js or .css files, plotting it on 1-hour based timechart:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;GET 200 (.js OR .css)
| rex ^(\S*\s){9}(?&amp;lt;byte_size&amp;gt;.*)$
| bucket _time span=1h
| timechart sum(byte_size) as "Bandwidth (GB)"
| eval "Bandwidth (GB)"=round('Bandwidth (GB)'/1024/1024/1024/6,2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This works like a charm, I hope someone finds this useful.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2019 12:30:04 GMT</pubDate>
    <dc:creator>doprocess</dc:creator>
    <dc:date>2019-11-20T12:30:04Z</dc:date>
    <item>
      <title>Apache Access Log Extract Byte Size</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Apache-Access-Log-Extract-Byte-Size/m-p/486909#M83391</link>
      <description>&lt;P&gt;I have tons of log lines coming from the Apache access log that look something like this:&lt;/P&gt;

&lt;P&gt;11/19/19 1:39:01.000 PM 192.168.1.1 - - [19/Nov/2019:13:39:01 -0500] "GET /jquery/jquery-ui.min.js HTTP/1.1" 200 &lt;STRONG&gt;240427&lt;/STRONG&gt;&lt;BR /&gt;
11/19/19 1:38:36.000 PM 192.168.1.1 - - [19/Nov/2019:13:38:36 -0500] "GET /21ab251b74e7f7c26.js HTTP/1.1" 200 &lt;STRONG&gt;11331980&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;The last number on each line represents the size of the file in bytes.&lt;BR /&gt;
I need to extract that last number and chart it, to find the total bandwidth going through my server.&lt;BR /&gt;
How do I go about this?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 18:44:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Apache-Access-Log-Extract-Byte-Size/m-p/486909#M83391</guid>
      <dc:creator>doprocess</dc:creator>
      <dc:date>2019-11-19T18:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Apache Access Log Extract Byte Size</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Apache-Access-Log-Extract-Byte-Size/m-p/486910#M83392</link>
      <description>&lt;P&gt;hi to extract it try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "(?&amp;lt;size&amp;gt;\d+$)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to calculate the total size by server try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | rex "(?&amp;lt;size&amp;gt;\d+$)" | stats sum(size) as size_in_bytes by server
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Nov 2019 20:28:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Apache-Access-Log-Extract-Byte-Size/m-p/486910#M83392</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-11-19T20:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: Apache Access Log Extract Byte Size</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Apache-Access-Log-Extract-Byte-Size/m-p/486911#M83393</link>
      <description>&lt;P&gt;Mayurr98, that won't work, size is not defined.&lt;/P&gt;

&lt;P&gt;After a bit of testing, I've ended up creating my own query, that takes everything after the last empty space (after 9th character we have a size in bytes) and used it like this to get the bandwidth that is used by .js or .css files, plotting it on 1-hour based timechart:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;GET 200 (.js OR .css)
| rex ^(\S*\s){9}(?&amp;lt;byte_size&amp;gt;.*)$
| bucket _time span=1h
| timechart sum(byte_size) as "Bandwidth (GB)"
| eval "Bandwidth (GB)"=round('Bandwidth (GB)'/1024/1024/1024/6,2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This works like a charm, I hope someone finds this useful.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 12:30:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Apache-Access-Log-Extract-Byte-Size/m-p/486911#M83393</guid>
      <dc:creator>doprocess</dc:creator>
      <dc:date>2019-11-20T12:30:04Z</dc:date>
    </item>
  </channel>
</rss>

