<?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 Working with dynamically named fields (extract) in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/Working-with-dynamically-named-fields-extract/m-p/50731#M10249</link>
    <description>&lt;P&gt;I have a script which runs every minute to extract information from squid logs. I'm not interested in actually indexing the data from squid (far too much data) so instead I'm indexing a single line every minute showing the response code statistics from the last minute, for example:&lt;/P&gt;

&lt;P&gt;HTTP0:43 HTTP200:19 HTTP301:4 HTTP302:1 HTTP304:46 HTTP403:5 HTTP404:5&lt;/P&gt;

&lt;P&gt;Note that the inclusion of codes can vary line by line.&lt;/P&gt;

&lt;P&gt;Ultimately I'd like to generate total hits and percentage of hits for each status. I've gotten this far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype=squid | extract pairdelim=" ", kvdelim=":", auto=f | stats sum(HTTP*) | addtotals fieldname=TotalHits | rename sum(*) as *
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which returns something like (contrived output - generally there will be several more fields, HTTP404, 5XX, etc)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;HTTP0   HTTP200 HTTP206 HTTP301 TotalHits
4322    1234    777     555     6888
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I'd like to do is generate a percentage field for each of the HTTP* columns. I know that eval doesn't handle wildcards, so that doesn't appear to be an option.  Is there a way to simply tell splunk to multiply/divide all columns matching a prefix by a value from another field??&lt;/P&gt;</description>
    <pubDate>Tue, 05 Mar 2013 00:47:08 GMT</pubDate>
    <dc:creator>jbmchuck</dc:creator>
    <dc:date>2013-03-05T00:47:08Z</dc:date>
    <item>
      <title>Working with dynamically named fields (extract)</title>
      <link>https://community.splunk.com/t5/Reporting/Working-with-dynamically-named-fields-extract/m-p/50731#M10249</link>
      <description>&lt;P&gt;I have a script which runs every minute to extract information from squid logs. I'm not interested in actually indexing the data from squid (far too much data) so instead I'm indexing a single line every minute showing the response code statistics from the last minute, for example:&lt;/P&gt;

&lt;P&gt;HTTP0:43 HTTP200:19 HTTP301:4 HTTP302:1 HTTP304:46 HTTP403:5 HTTP404:5&lt;/P&gt;

&lt;P&gt;Note that the inclusion of codes can vary line by line.&lt;/P&gt;

&lt;P&gt;Ultimately I'd like to generate total hits and percentage of hits for each status. I've gotten this far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype=squid | extract pairdelim=" ", kvdelim=":", auto=f | stats sum(HTTP*) | addtotals fieldname=TotalHits | rename sum(*) as *
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which returns something like (contrived output - generally there will be several more fields, HTTP404, 5XX, etc)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;HTTP0   HTTP200 HTTP206 HTTP301 TotalHits
4322    1234    777     555     6888
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I'd like to do is generate a percentage field for each of the HTTP* columns. I know that eval doesn't handle wildcards, so that doesn't appear to be an option.  Is there a way to simply tell splunk to multiply/divide all columns matching a prefix by a value from another field??&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2013 00:47:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Working-with-dynamically-named-fields-extract/m-p/50731#M10249</guid>
      <dc:creator>jbmchuck</dc:creator>
      <dc:date>2013-03-05T00:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: Working with dynamically named fields (extract)</title>
      <link>https://community.splunk.com/t5/Reporting/Working-with-dynamically-named-fields-extract/m-p/50732#M10250</link>
      <description>&lt;P&gt;Oh my god. This is gold :&lt;/P&gt;

&lt;P&gt;rename sum(*) as *&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2013 07:57:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Working-with-dynamically-named-fields-extract/m-p/50732#M10250</guid>
      <dc:creator>jonuwz</dc:creator>
      <dc:date>2013-03-05T07:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: Working with dynamically named fields (extract)</title>
      <link>https://community.splunk.com/t5/Reporting/Working-with-dynamically-named-fields-extract/m-p/50733#M10251</link>
      <description>&lt;P&gt;Using the &lt;A href="http://splunk-base.splunk.com/apps/76026/scale-command"&gt;http://splunk-base.splunk.com/apps/76026/scale-command&lt;/A&gt; you can do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... stats ... addtotals ... | scale field=Total pattern="^sum" | scale scale=100 pattern="^sum" inverse=t | rename ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Mar 2013 13:24:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Working-with-dynamically-named-fields-extract/m-p/50733#M10251</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-03-07T13:24:29Z</dc:date>
    </item>
  </channel>
</rss>

