<?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: How to combine values from stats into single row? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-values-from-stats-into-single-row/m-p/678409#M231993</link>
    <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;coalesce&lt;/FONT&gt; function selects a field within a single result.&amp;nbsp; To combine (aggregate) multiple results, use the &lt;FONT face="courier new,courier"&gt;stats&lt;/FONT&gt; command again after modifying the url field.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=proxy url=*.streaming-site.com
| eval megabytes=round(((bytes_in/1024)/1024),2)
| stats sum(megabytes) as Download_MB by url
| eval url=replace(url, ".*?\.(.*)","\1")
| stats sum(Download_MB) as Download_MB by url
| sort - Download_MB&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 23 Feb 2024 01:09:05 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2024-02-23T01:09:05Z</dc:date>
    <item>
      <title>How to combine values from stats into single row?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-values-from-stats-into-single-row/m-p/678405#M231992</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am looking into using some proxy logs to determine download volume for particular streaming sites and was looking for a way to merge hostnames into one "service".&lt;/P&gt;&lt;P&gt;Consider the SPL:&lt;/P&gt;&lt;PRE&gt;index=proxy url=*.streaming-site.com&lt;BR /&gt;| eval megabytes=round(((bytes_in/1024)/1024),2)&lt;BR /&gt;| stats sum(megabytes) as Download_MB by url&lt;BR /&gt;| sort -Download_MB&lt;/PRE&gt;&lt;P&gt;Will likely return multiple rows like:&lt;/P&gt;&lt;PRE&gt;cdn1.streaming-site.com    180.3&lt;BR /&gt;cdn2.streaming-site.com    164.8&lt;BR /&gt;www.streaming-site.com&amp;nbsp;    12.3&lt;/PRE&gt;&lt;P&gt;I am wanting to merge those all into one row of&lt;/P&gt;&lt;PRE&gt;streaming-site.com&amp;nbsp; &amp;nbsp;357.4&lt;/PRE&gt;&lt;P&gt;I have played around with the coalesce function, but this would be unsustainable for sites like Netflix which have dozens of URLs associated with them.&lt;/P&gt;&lt;P&gt;If anyone has any suggestions on how I might combine results with say a wildcard (*), I'd love to hear from you!&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 23:38:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-values-from-stats-into-single-row/m-p/678405#M231992</guid>
      <dc:creator>TribesmanJohn</dc:creator>
      <dc:date>2024-02-22T23:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine values from stats into single row?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-values-from-stats-into-single-row/m-p/678409#M231993</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;coalesce&lt;/FONT&gt; function selects a field within a single result.&amp;nbsp; To combine (aggregate) multiple results, use the &lt;FONT face="courier new,courier"&gt;stats&lt;/FONT&gt; command again after modifying the url field.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=proxy url=*.streaming-site.com
| eval megabytes=round(((bytes_in/1024)/1024),2)
| stats sum(megabytes) as Download_MB by url
| eval url=replace(url, ".*?\.(.*)","\1")
| stats sum(Download_MB) as Download_MB by url
| sort - Download_MB&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2024 01:09:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-values-from-stats-into-single-row/m-p/678409#M231993</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-02-23T01:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine values from stats into single row?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-values-from-stats-into-single-row/m-p/678410#M231994</link>
      <description>&lt;P&gt;Thanks for this! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;More tweaking required on my part as some of the subdomains being evaluated have more than 3 levels, but this is a big help in getting me on the right track!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2024 01:38:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-values-from-stats-into-single-row/m-p/678410#M231994</guid>
      <dc:creator>TribesmanJohn</dc:creator>
      <dc:date>2024-02-23T01:38:57Z</dc:date>
    </item>
  </channel>
</rss>

