<?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: Need help on Queries Combination. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-help-on-Queries-Combination/m-p/578871#M201745</link>
    <description>&lt;P&gt;I've never had the opportunity to work with metric indexes but my intuition tells me to try append or multisearch and do stats on the resulting data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;But there are some other things about your searches.&lt;/P&gt;&lt;P&gt;Firstly - in order to combine your results, you have to correlate them on time, right? So you heed to bin the results from your first search by time.&lt;/P&gt;&lt;P&gt;Secondly, use fieldformat on _time field, not eval for rendering it as string. If you use string timestamp representation, you will sort this field lexicographicaly which is almost never what you want.&lt;/P&gt;&lt;P&gt;Thirdly, "| dedup Hostname" might lose data. It will deduplicate events basing on hostname field ignoring whether other fields differ or not. Are you sure that's what you want?&lt;/P&gt;</description>
    <pubDate>Mon, 20 Dec 2021 07:32:11 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2021-12-20T07:32:11Z</dc:date>
    <item>
      <title>Need help on Queries Combination.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-on-Queries-Combination/m-p/578860#M201739</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;STRONG&gt;Search 1&lt;/STRONG&gt;: It is used to findout the server health&lt;BR /&gt;index=win sourcetype="xmlwineventlog" host=Prod_UI_*&lt;BR /&gt;| eval Status=if(EventCode=41 OR EventCode=6006 OR EventCode=6008,"Down","Up")&lt;BR /&gt;| dedup host&lt;BR /&gt;| table Status&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Search 2&lt;/STRONG&gt; : It is used to findout the CPU Usage&lt;/P&gt;&lt;P&gt;| mstats avg(_value) prestats=true WHERE metric_name="Processor.%_Processor_Time" AND&lt;BR /&gt;"index"="winperf" AND&lt;BR /&gt;host=Prod_UI_* span=60s&lt;BR /&gt;| eval Timestamp=strftime(_time ,"%d/%m/%Y %H:%M:%S")&lt;BR /&gt;| stats avg(_value) AS CPU BY host Timestamp&lt;BR /&gt;| where CPU&amp;gt;=0&lt;BR /&gt;| eval Status="Critical",CPU=round(CPU,2),CPU=CPU+"%"&lt;BR /&gt;| rename host as Hostname&lt;BR /&gt;| table Timestamp Hostname CPU Status&lt;BR /&gt;| dedup Hostname&lt;BR /&gt;| sort - CPU&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Search 3&lt;/STRONG&gt; : It is used to findout the Memory Usage&lt;/P&gt;&lt;P&gt;| mstats avg(_value) prestats=true WHERE metric_name="Memory.%_Committed_Bytes_In_Use" AND&lt;BR /&gt;"index"="winperf" AND&lt;BR /&gt;host=Prod_UI_* span=60s&lt;BR /&gt;| eval Timestamp=strftime(_time ,"%d/%m/%Y %H:%M:%S")&lt;BR /&gt;| stats avg(_value) AS Memory BY host Timestamp&lt;BR /&gt;| where Memory&amp;gt;=0&lt;BR /&gt;| eval Status="Critical",Memory=round(Memory,2),Memory=Memory+"%"&lt;BR /&gt;| rename host as Hostname&lt;BR /&gt;| table Timestamp Hostname Memory Status&lt;BR /&gt;| dedup Hostname&lt;BR /&gt;| sort - Memory&lt;/P&gt;&lt;P&gt;finally I need a query to know the server health and CPU and memory usage in single table.&lt;BR /&gt;and if CPU used &amp;gt;75% or memory used &amp;gt;75% it should show that the server is Down.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Like&lt;/P&gt;&lt;P&gt;Hostname&amp;nbsp; &amp;nbsp; Health&amp;nbsp; &amp;nbsp; CPU&amp;nbsp; &amp;nbsp; Memory&lt;BR /&gt;Google&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Down&amp;nbsp; &amp;nbsp; &amp;nbsp; 76%&amp;nbsp; &amp;nbsp; &amp;nbsp; 45%&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 04:20:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-on-Queries-Combination/m-p/578860#M201739</guid>
      <dc:creator>jackin</dc:creator>
      <dc:date>2021-12-20T04:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Need help on Queries Combination.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-on-Queries-Combination/m-p/578871#M201745</link>
      <description>&lt;P&gt;I've never had the opportunity to work with metric indexes but my intuition tells me to try append or multisearch and do stats on the resulting data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;But there are some other things about your searches.&lt;/P&gt;&lt;P&gt;Firstly - in order to combine your results, you have to correlate them on time, right? So you heed to bin the results from your first search by time.&lt;/P&gt;&lt;P&gt;Secondly, use fieldformat on _time field, not eval for rendering it as string. If you use string timestamp representation, you will sort this field lexicographicaly which is almost never what you want.&lt;/P&gt;&lt;P&gt;Thirdly, "| dedup Hostname" might lose data. It will deduplicate events basing on hostname field ignoring whether other fields differ or not. Are you sure that's what you want?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 07:32:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-on-Queries-Combination/m-p/578871#M201745</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-12-20T07:32:11Z</dc:date>
    </item>
  </channel>
</rss>

