<?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 Conditional statements based on metric trends in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Conditional-statements-based-on-metric-trends/m-p/488629#M193997</link>
    <description>&lt;P&gt;This may actually be 2 questions, but I have 3 metrics I'd like to compare based on how they're trending.  So......&lt;/P&gt;

&lt;P&gt;Condition is met when metric 1 is trending up, metric 2 and metric 3 are trending down.  &lt;/P&gt;

&lt;P&gt;I'm not sure how to write a query that ascertains a trend and I'm guessing an if statement would work for the condition.  &lt;/P&gt;</description>
    <pubDate>Fri, 17 Jan 2020 17:38:20 GMT</pubDate>
    <dc:creator>winknotes</dc:creator>
    <dc:date>2020-01-17T17:38:20Z</dc:date>
    <item>
      <title>Conditional statements based on metric trends</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-statements-based-on-metric-trends/m-p/488629#M193997</link>
      <description>&lt;P&gt;This may actually be 2 questions, but I have 3 metrics I'd like to compare based on how they're trending.  So......&lt;/P&gt;

&lt;P&gt;Condition is met when metric 1 is trending up, metric 2 and metric 3 are trending down.  &lt;/P&gt;

&lt;P&gt;I'm not sure how to write a query that ascertains a trend and I'm guessing an if statement would work for the condition.  &lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 17:38:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-statements-based-on-metric-trends/m-p/488629#M193997</guid>
      <dc:creator>winknotes</dc:creator>
      <dc:date>2020-01-17T17:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional statements based on metric trends</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-statements-based-on-metric-trends/m-p/488630#M193998</link>
      <description>&lt;P&gt;hello there, &lt;BR /&gt;
there are many ways to do it in Splunk. couple of commands to consider: &lt;CODE&gt;streamstats, detla, trendline, autoregress, accumn&lt;/CODE&gt;&lt;BR /&gt;
look here for example: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Trendline"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Trendline&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;As there are many other ways to do this, here is a very simplified version of what i understand you are trying to achieve:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    | gentimes start=-1 increment=1m
    | head 10
    | eval _time = starttime
    | table _time
    | eval v1 = random()%10
    | eval v2 = random()%10
    | eval v3 = random()%10
    | rename COMMENT as "the above generates data below is the solution" 
    | delta v1 as dv1 
    | delta v2 as dv2
    | delta v3 as dv3
    | eval alert = if(dv1 &amp;gt; 0 AND dv2 &amp;lt; 0 AND dv3 &amp;lt; 0,"ALERT","OK")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;hope it helps&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 18:53:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-statements-based-on-metric-trends/m-p/488630#M193998</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2020-01-17T18:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional statements based on metric trends</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-statements-based-on-metric-trends/m-p/488631#M193999</link>
      <description>&lt;P&gt;Thanks so much adonio.  I'll experiment with this but looks promising.  &lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 21:15:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-statements-based-on-metric-trends/m-p/488631#M193999</guid>
      <dc:creator>winknotes</dc:creator>
      <dc:date>2020-01-17T21:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional statements based on metric trends</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-statements-based-on-metric-trends/m-p/488632#M194000</link>
      <description>&lt;P&gt;@winknotes i converted your answer to a comment, if this works for you, kindly accept the answer and up-vote it &lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 21:21:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-statements-based-on-metric-trends/m-p/488632#M194000</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2020-01-17T21:21:07Z</dc:date>
    </item>
  </channel>
</rss>

