<?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: using append with mstats and eval in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/using-append-with-mstats-and-eval/m-p/516245#M145050</link>
    <description>&lt;P&gt;I would have thought this would work but no go.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;| mstats sum(HostIOs) as HostIOs WHERE index=my_index AND Array_Name=myarray span=5m by sgname&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| appendcols [mstats sum(HostIOs) as sgIOs WHERE index=my_index AND sgname=my_sg span=5m]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| stats sum(HostIOs) as preload sum(eval(totalIOPs=HostIOs+sgIOs)) as postload by _time&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It only returns HostIOs and sgIOs but not the calculated field totalIOPs.&amp;nbsp; I just don't get it.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Aug 2020 11:41:14 GMT</pubDate>
    <dc:creator>winknotes</dc:creator>
    <dc:date>2020-08-26T11:41:14Z</dc:date>
    <item>
      <title>using append with mstats and eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-append-with-mstats-and-eval/m-p/515853#M144845</link>
      <description>&lt;P&gt;The following query is being used to model IOPs before and after moving a load from one disk array to another.&amp;nbsp; The "pre-load" snapshot is captured by the first mstats command, while the append is gathering the number of IOPs over time for the load being moved onto the array.&amp;nbsp; I'll then simply add the IOPs from both queries to get what it would look like if that load existed on that array for the period of time I'm querying.&amp;nbsp; I'm getting accurate data for both mstats commands, but my calculated field isn't showing any values.&amp;nbsp; I've done a ton of searching and trial and error but can't find a way to do this without an append or to get it to work with an append/appendcols. Any help would be appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Array_Name and sgname are dimensions for grouping results.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;| mstats sum(HostIOs) as HostIOs WHERE index=my_index AND Array_Name=myarray span=5m by sgname&lt;BR /&gt;| append[mstats sum(HostIOs) as sgIOs WHERE index=my_index AND sgname=my_sg span=5m by sgname]&lt;BR /&gt;| eval totalIOPs=sgIOs+HostIOs&lt;BR /&gt;| timechart sum(HostIOs) as preload sum(totalIOPs) as postload span=5m&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suspect the append is getting added to the results AFTER everything else runs but I can't seem to make anything work.&amp;nbsp; Hopefully it's clear what I'm after.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 17:59:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-append-with-mstats-and-eval/m-p/515853#M144845</guid>
      <dc:creator>winknotes</dc:creator>
      <dc:date>2020-08-24T17:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: using append with mstats and eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-append-with-mstats-and-eval/m-p/515856#M144846</link>
      <description>&lt;P&gt;After the second mstats command, you'll have a bunch of metrics with HostIOs followed by a bunch of metrics with sgIOs.&amp;nbsp; None of them will contain both HostIOs and sgIOs so the totalOPSs field will not be what you expect.&lt;/P&gt;&lt;P&gt;The solution is to merge the two sets of metrics before doing the eval.&lt;/P&gt;&lt;P&gt;I don't have a lot of experience with metrics. but give this a try.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats sum(HostIOs) as HostIOs WHERE index=my_index AND Array_Name=myarray span=5m by sgname
| append[mstats sum(HostIOs) as sgIOs WHERE index=my_index AND sgname=my_sg span=5m by sgname]
| mstats max(HostIOs) as HostIOs, max(sgIOs) as sgIOs by sgname
| eval totalIOPs=sgIOs+HostIOs
| timechart sum(HostIOs) as preload sum(totalIOPs) as postload span=5m&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 24 Aug 2020 18:12:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-append-with-mstats-and-eval/m-p/515856#M144846</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-08-24T18:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: using append with mstats and eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-append-with-mstats-and-eval/m-p/515860#M144849</link>
      <description>&lt;P&gt;Unfortunately that didn't work.&amp;nbsp; It throws an error that mstats has to be the first command.&amp;nbsp; So unless they're appended it won't let me string together several mstats commands.&amp;nbsp; I did try a second append but that didn't work either.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats sum(HostIOs) as HostIOs WHERE index=my_index AND Array_Name=myarray span=5m by sgname
| append[mstats sum(HostIOs) as sgIOs WHERE index=my_index AND sgname=my_sg span=5m by sgname]
| append [mstats max(HostIOs) as HostIOs, max(sgIOs) as sgIOs by sgname]
| eval totalIOPs=sgIOs+HostIOs
| timechart sum(HostIOs) as preload sum(totalIOPs) as postload span=5m&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 24 Aug 2020 18:33:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-append-with-mstats-and-eval/m-p/515860#M144849</guid>
      <dc:creator>winknotes</dc:creator>
      <dc:date>2020-08-24T18:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: using append with mstats and eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-append-with-mstats-and-eval/m-p/515868#M144868</link>
      <description>&lt;P&gt;I think I've found something that works though I think there's probably a more elegant way to accomplish this.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Minutes ago I read where mstats doesn't support subsearches and that append is the only way to accomplish what I'm wanting.&amp;nbsp; So I essentially have to gather both sets of data in my append query to allow me to add them together as I need.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats sum(HostIOs) as HostIOs WHERE index=my_index AND Array_Name=myarray span=5m by sgname
| append[mstats sum(HostIOs) as sgIOs WHERE index=my_index AND sgname=my_sg OR Array_Name=myarray span=5m by sgname]
| timechart sum(HostIOs) as preload sum(sgIOs) as postload span=5m&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 19:08:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-append-with-mstats-and-eval/m-p/515868#M144868</guid>
      <dc:creator>winknotes</dc:creator>
      <dc:date>2020-08-24T19:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: using append with mstats and eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-append-with-mstats-and-eval/m-p/515888#M144879</link>
      <description>I'd experiment with using regular stats in place of the third mstats (without append).</description>
      <pubDate>Mon, 24 Aug 2020 21:01:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-append-with-mstats-and-eval/m-p/515888#M144879</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-08-24T21:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: using append with mstats and eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-append-with-mstats-and-eval/m-p/515999#M144923</link>
      <description>&lt;P&gt;Still no luck.&amp;nbsp; I've tried so many variations to no avail.&amp;nbsp; I'm just not sure if this is possible.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2020 11:54:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-append-with-mstats-and-eval/m-p/515999#M144923</guid>
      <dc:creator>winknotes</dc:creator>
      <dc:date>2020-08-25T11:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: using append with mstats and eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-append-with-mstats-and-eval/m-p/516245#M145050</link>
      <description>&lt;P&gt;I would have thought this would work but no go.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;| mstats sum(HostIOs) as HostIOs WHERE index=my_index AND Array_Name=myarray span=5m by sgname&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| appendcols [mstats sum(HostIOs) as sgIOs WHERE index=my_index AND sgname=my_sg span=5m]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| stats sum(HostIOs) as preload sum(eval(totalIOPs=HostIOs+sgIOs)) as postload by _time&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It only returns HostIOs and sgIOs but not the calculated field totalIOPs.&amp;nbsp; I just don't get it.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 11:41:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-append-with-mstats-and-eval/m-p/516245#M145050</guid>
      <dc:creator>winknotes</dc:creator>
      <dc:date>2020-08-26T11:41:14Z</dc:date>
    </item>
  </channel>
</rss>

