<?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: Counting multiple values in a single query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Counting-multiple-values-in-a-single-query/m-p/55601#M13567</link>
    <description>&lt;P&gt;Do you want to distinguish jpg from png, or any files ?&lt;BR /&gt;
Here is a way , let's suppose your filename is in the field "path", you can extract the extension using a regex.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sc_status=200 | rex field=path "\.(?&amp;lt;type&amp;gt;\w+)$" |   eval Mbytes-out=sc_bytes/1024/1024 | timechart sum(Mbytes-out) span=24h by type&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Dec 2012 02:11:39 GMT</pubDate>
    <dc:creator>yannK</dc:creator>
    <dc:date>2012-12-06T02:11:39Z</dc:date>
    <item>
      <title>Counting multiple values in a single query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Counting-multiple-values-in-a-single-query/m-p/55600#M13566</link>
      <description>&lt;P&gt;Newbie to Splunk.  &lt;/P&gt;

&lt;P&gt;From a server farm of web servers, I'd like to get the total of sc_bytes (bytes from server to client) for all file types, then a subtotal of all .jpg files and a separate subtotal of .png files.&lt;/P&gt;

&lt;P&gt;Search to calculate total bytes out per day:&lt;BR /&gt;
"&lt;EM&gt;.jpg" or "&lt;/EM&gt;.png" sc_status=200 | eval Mbytes-out=sc_bytes/1024/1024 | timechart sum(Mbytes-out) span=24h&lt;/P&gt;

&lt;P&gt;I can't figure out how to get the subcount by file type in a single query.&lt;/P&gt;

&lt;P&gt;Sample webserver log:&lt;BR /&gt;
2012-11-14 13:41:19 W3SVC12345 172.16.3.1 GET /img/site-page-block.jpg - 80 – 8.8.8.8 Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+6.1;+WOW64;+Trident/4.0;+SLCC2;+.NET+CLR+2.0.50727;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729;+MS-RTC+LM+8;+InfoPath.3) &lt;A href="http://server.com/" target="_blank"&gt;http://server.com/&lt;/A&gt; 200 0 0 48604 2210 31&lt;BR /&gt;
2012-11-14 13:41:19 W3SVC12345 172.16.3.1 GET /img/site-page-block.png - 80 – 8.8.8.8 Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+6.1;+WOW64;+Trident/4.0;+SLCC2;+.NET+CLR+2.0.50727;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729;+MS-RTC+LM+8;+InfoPath.3) &lt;A href="http://server.com/" target="_blank"&gt;http://server.com/&lt;/A&gt; 200 0 0 48604 2210 31&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:55:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Counting-multiple-values-in-a-single-query/m-p/55600#M13566</guid>
      <dc:creator>umiotoko</dc:creator>
      <dc:date>2020-09-28T12:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Counting multiple values in a single query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Counting-multiple-values-in-a-single-query/m-p/55601#M13567</link>
      <description>&lt;P&gt;Do you want to distinguish jpg from png, or any files ?&lt;BR /&gt;
Here is a way , let's suppose your filename is in the field "path", you can extract the extension using a regex.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sc_status=200 | rex field=path "\.(?&amp;lt;type&amp;gt;\w+)$" |   eval Mbytes-out=sc_bytes/1024/1024 | timechart sum(Mbytes-out) span=24h by type&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Dec 2012 02:11:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Counting-multiple-values-in-a-single-query/m-p/55601#M13567</guid>
      <dc:creator>yannK</dc:creator>
      <dc:date>2012-12-06T02:11:39Z</dc:date>
    </item>
  </channel>
</rss>

