<?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 convert  `_time` to the column and  `host` as an index while using `mstats`? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-to-the-column-and-host-as-an-index-while/m-p/591807#M205991</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127036"&gt;@dhirendra761&lt;/a&gt;&amp;nbsp; i tried that in the last line of search but did not&amp;nbsp; list the &lt;STRONG&gt;host, &lt;/STRONG&gt;it&amp;nbsp; shows the host column but do not print the hostname's .. it turns blank.&lt;/P&gt;</description>
    <pubDate>Thu, 31 Mar 2022 15:23:44 GMT</pubDate>
    <dc:creator>microsac</dc:creator>
    <dc:date>2022-03-31T15:23:44Z</dc:date>
    <item>
      <title>How to convert  `_time` to the column and  `host` as an index while using `mstats`?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-to-the-column-and-host-as-an-index-while/m-p/591749#M205982</link>
      <description>&lt;P&gt;How to convert&amp;nbsp; `_time` to the column and&amp;nbsp; `host` as an index while using `mstats`?&lt;/P&gt;&lt;PRE&gt;| mstats avg(_value) prestats=true WHERE metric_name="cpu.*" AND index="*" AND&lt;BR /&gt;(host="host01.example.com" OR &lt;BR /&gt;host="host02.example.com" OR &lt;BR /&gt;host="host03.example.com" OR &lt;BR /&gt;host="host04.example.com" OR &lt;BR /&gt;host="host05.example.com" OR&lt;BR /&gt;host="host06.example.com" &lt;BR /&gt;) AND `sai_metrics_indexes` span=auto BY metric_name&lt;BR /&gt;| timechart avg(_value) as "Avg" span=30m by metric_name&lt;BR /&gt;| fillnull value=0 &lt;BR /&gt;| foreach *[| eval "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"=round('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;',2)]&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;The above results in as follows:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="microsac_0-1648727550403.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/18876iD39AC3AFE4B5B099/image-size/large?v=v2&amp;amp;px=999" role="button" title="microsac_0-1648727550403.png" alt="microsac_0-1648727550403.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What is Desired:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;host               _time                 cpu.idle cpu.interrupt cpu.nice  cpu.softirq  cpu.steal cpu.system cpu.user cpu.wait &lt;BR /&gt;host01.example.com 2022-03-31 07:30:00   57.56    0.00          22.98     0.08         0.00      18.75      0.59     0.04&lt;BR /&gt;host01.example.com 2022-03-31 08:00:00   59.08    0.00          22.02     0.11         0.00      18.06      0.70     0.04&lt;BR /&gt;host01.example.com 2022-03-31 08:00:00   61.79    0.00          20.53     0.08         0.00      16.96      0.62     0.04&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Any help will be uch appeciated.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 12:10:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-to-the-column-and-host-as-an-index-while/m-p/591749#M205982</guid>
      <dc:creator>microsac</dc:creator>
      <dc:date>2022-03-31T12:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert  `_time` to the column and  `host` as an index while using `mstats`?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-to-the-column-and-host-as-an-index-while/m-p/591797#M205987</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats avg(_value) prestats=true WHERE metric_name="cpu.*" AND index="*" AND
(host="host01.example.com" OR 
host="host02.example.com" OR 
host="host03.example.com" OR 
host="host04.example.com" OR 
host="host05.example.com" OR
host="host06.example.com" 
) AND `sai_metrics_indexes` span=auto BY metric_name host
| bucket span=30m _time
| eval temp=host."##"._time
| chart avg(_value) as "Avg" over temp by metric_name
| fillnull value=0 
| foreach cpu.* [| eval "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"=round('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;',2)]
| eval host=mvindex(split(temp,"##"),0)
| eval _time=tonumber(mvindex(split(temp,"##"),1))
| fields - temp | table host _time *&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 31 Mar 2022 14:45:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-to-the-column-and-host-as-an-index-while/m-p/591797#M205987</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2022-03-31T14:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert  `_time` to the column and  `host` as an index while using `mstats`?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-to-the-column-and-host-as-an-index-while/m-p/591798#M205988</link>
      <description>&lt;P&gt;You haven't use &lt;EM&gt;&lt;STRONG&gt;host&lt;/STRONG&gt;&lt;/EM&gt; in SPL.&lt;/P&gt;&lt;P&gt;Try to use host filed in your &lt;STRONG&gt;SPL&lt;/STRONG&gt; first either in stats or BY.&lt;/P&gt;&lt;P&gt;in last&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; |table host _time *&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 31 Mar 2022 14:51:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-to-the-column-and-host-as-an-index-while/m-p/591798#M205988</guid>
      <dc:creator>dhirendra761</dc:creator>
      <dc:date>2022-03-31T14:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert  `_time` to the column and  `host` as an index while using `mstats`?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-to-the-column-and-host-as-an-index-while/m-p/591802#M205990</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt;&amp;nbsp;, this works can you explain the part you placed it working that will also help posterity.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 15:06:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-to-the-column-and-host-as-an-index-while/m-p/591802#M205990</guid>
      <dc:creator>microsac</dc:creator>
      <dc:date>2022-03-31T15:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert  `_time` to the column and  `host` as an index while using `mstats`?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-to-the-column-and-host-as-an-index-while/m-p/591807#M205991</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127036"&gt;@dhirendra761&lt;/a&gt;&amp;nbsp; i tried that in the last line of search but did not&amp;nbsp; list the &lt;STRONG&gt;host, &lt;/STRONG&gt;it&amp;nbsp; shows the host column but do not print the hostname's .. it turns blank.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 15:23:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-to-the-column-and-host-as-an-index-while/m-p/591807#M205991</guid>
      <dc:creator>microsac</dc:creator>
      <dc:date>2022-03-31T15:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert  `_time` to the column and  `host` as an index while using `mstats`?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-to-the-column-and-host-as-an-index-while/m-p/591854#M206018</link>
      <description>&lt;LI-CODE lang="markup"&gt;## Since timechart only support group by one field, we're using this alternative implementation. Doing bucket of _time with same span that was used in timechart##
| bucket span=30m _time
## Merging two fields, so that charting can be done for two fields.
| eval temp=host."##"._time
## Running chart with merge field appearing as rows and metric_name values are column.
| chart avg(_value) as "Avg" over temp by metric_name
| fillnull value=0 
| foreach cpu.* [| eval "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"=round('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;',2)]
## Getting those merged field back.
| eval host=mvindex(split(temp,"##"),0)
| eval _time=tonumber(mvindex(split(temp,"##"),1))
| fields - temp | table host _time *&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 31 Mar 2022 18:43:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-to-the-column-and-host-as-an-index-while/m-p/591854#M206018</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2022-03-31T18:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert  `_time` to the column and  `host` as an index while using `mstats`?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-to-the-column-and-host-as-an-index-while/m-p/591892#M206039</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="php"&gt;| eval host=mvindex(split(temp,"##"),0)  &amp;lt;-- Can you please explain this ?
| eval _time=tonumber(mvindex(split(temp,"##"),1))  &amp;lt;-- Can you please explain this ?
| fields - temp | table host _time *

What is the meaning of using "##", does it has a special meaning here?&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 03:23:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-to-the-column-and-host-as-an-index-while/m-p/591892#M206039</guid>
      <dc:creator>microsac</dc:creator>
      <dc:date>2022-04-01T03:23:27Z</dc:date>
    </item>
  </channel>
</rss>

