<?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 How to correctly use mstats rate() without listing all dimensions in BY clause? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-correctly-use-mstats-rate-without-listing-all-dimensions/m-p/485761#M193605</link>
    <description>&lt;P&gt;I have a monotonic counter metric named http_req and my metric data points are tagged with &lt;EM&gt;path&lt;/EM&gt; and &lt;EM&gt;host&lt;/EM&gt; dimensions, eg. path=/accounts or path=/transactions, host=server-1 or host=server-2.&lt;/P&gt;

&lt;P&gt;Application running on each host starts with metric value 0 and increases the value after every request processed. If host is restarted, counting restarts from 0. Every application creates it's own metric data points.&lt;/P&gt;

&lt;P&gt;I can create a visualization showing number of calls processed in time while grouping per path and discarding the host aspect using:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| mstats rate(http_req) as http_req_rate WHERE index="metrices" by path,host span=1m
| stats sum(http_req_rate) by _time,path
| xyseries _time path sum(http_req_rate)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I noticed that I need to specify all dimensions in BY clause of mstats for rate() to work correctly. Having known set of dimensions I can create proper query, but in the future more dimensions will be added.&lt;/P&gt;

&lt;P&gt;Can this query be written in such way that listing all the dimensions is not necessary? eg. is there something like presented below possible?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| mstats ... by all-dimensions
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 21 Jan 2020 12:38:24 GMT</pubDate>
    <dc:creator>y0ft</dc:creator>
    <dc:date>2020-01-21T12:38:24Z</dc:date>
    <item>
      <title>How to correctly use mstats rate() without listing all dimensions in BY clause?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correctly-use-mstats-rate-without-listing-all-dimensions/m-p/485761#M193605</link>
      <description>&lt;P&gt;I have a monotonic counter metric named http_req and my metric data points are tagged with &lt;EM&gt;path&lt;/EM&gt; and &lt;EM&gt;host&lt;/EM&gt; dimensions, eg. path=/accounts or path=/transactions, host=server-1 or host=server-2.&lt;/P&gt;

&lt;P&gt;Application running on each host starts with metric value 0 and increases the value after every request processed. If host is restarted, counting restarts from 0. Every application creates it's own metric data points.&lt;/P&gt;

&lt;P&gt;I can create a visualization showing number of calls processed in time while grouping per path and discarding the host aspect using:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| mstats rate(http_req) as http_req_rate WHERE index="metrices" by path,host span=1m
| stats sum(http_req_rate) by _time,path
| xyseries _time path sum(http_req_rate)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I noticed that I need to specify all dimensions in BY clause of mstats for rate() to work correctly. Having known set of dimensions I can create proper query, but in the future more dimensions will be added.&lt;/P&gt;

&lt;P&gt;Can this query be written in such way that listing all the dimensions is not necessary? eg. is there something like presented below possible?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| mstats ... by all-dimensions
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Jan 2020 12:38:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correctly-use-mstats-rate-without-listing-all-dimensions/m-p/485761#M193605</guid>
      <dc:creator>y0ft</dc:creator>
      <dc:date>2020-01-21T12:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly use mstats rate() without listing all dimensions in BY clause?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correctly-use-mstats-rate-without-listing-all-dimensions/m-p/485762#M193606</link>
      <description>&lt;P&gt;I found a workaround: add another dimension - tsid (time series identifier) - with random constant value for every counter.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| mstats rate(http_req) as http_req_rate WHERE index="metrices" by tsid,path span=1m
| stats sum(http_req_rate) by _time,path
| xyseries _time path sum(http_req_rate)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Jan 2020 09:12:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correctly-use-mstats-rate-without-listing-all-dimensions/m-p/485762#M193606</guid>
      <dc:creator>y0ft</dc:creator>
      <dc:date>2020-01-27T09:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly use mstats rate() without listing all dimensions in BY clause?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-correctly-use-mstats-rate-without-listing-all-dimensions/m-p/485763#M193607</link>
      <description>&lt;P&gt;I found a solution:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| mstats rate(http_req) as http_req_rate WHERE index="metrices" by _timeseries,path span=1m
| stats sum(http_req_rate) by _time,path
| xyseries _time path sum(http_req_rate)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Documentation around it could be improved. It is only mentioned in &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.1/Metrics/Histogramdatatype"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.1/Metrics/Histogramdatatype&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2020 13:55:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-correctly-use-mstats-rate-without-listing-all-dimensions/m-p/485763#M193607</guid>
      <dc:creator>y0ft</dc:creator>
      <dc:date>2020-01-27T13:55:44Z</dc:date>
    </item>
  </channel>
</rss>

