<?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 plot multiple trendlines over multiple timechart values? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-plot-multiple-trendlines-over-multiple-timechart-values/m-p/202966#M33632</link>
    <description>&lt;P&gt;Nope, doesn't work...&lt;/P&gt;</description>
    <pubDate>Sun, 03 Jan 2016 08:01:32 GMT</pubDate>
    <dc:creator>esegal2u</dc:creator>
    <dc:date>2016-01-03T08:01:32Z</dc:date>
    <item>
      <title>How to plot multiple trendlines over multiple timechart values?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-plot-multiple-trendlines-over-multiple-timechart-values/m-p/202964#M33630</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I want to see multiple trendlines in a single graph, for multiple values.&lt;/P&gt;

&lt;P&gt;My end-goal is to to have trendlines for each type of errors, so I can define an alert if any specific error had grown in comparison to the moving average count of that specific error. Something like (simplified):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=x ERROR | timechart span=1m count as error_count | trendline sma10(error_count) as moving_avg_errors | eval spike=if(error_count &amp;gt; 2 * moving_avg_errors, 1000, 0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This gives me a good output in total to all errors.&lt;BR /&gt;
However, I want to see different errors separately.&lt;BR /&gt;
When I do the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=x ERROR | timechart span=1m count by error_msg limit=100
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This gives me a timechart count of various error messages I have in my logs.&lt;BR /&gt;
I would like to see independent trendlines for each of these messages.&lt;BR /&gt;
Using "trendline sma10(?) as moving_avg_errors" obviously doesn't work this time, since it requires a specific field to work against.&lt;/P&gt;

&lt;P&gt;How can I achieve this?&lt;BR /&gt;
Am I looking at this search the wrong way? &lt;BR /&gt;
Is it possible to make use of foreach in this case somehow?&lt;/P&gt;

&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:13:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-plot-multiple-trendlines-over-multiple-timechart-values/m-p/202964#M33630</guid>
      <dc:creator>esegal2u</dc:creator>
      <dc:date>2020-09-29T08:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot multiple trendlines over multiple timechart values?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-plot-multiple-trendlines-over-multiple-timechart-values/m-p/202965#M33631</link>
      <description>&lt;P&gt;I'm curious if trendline works with map:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype=x ERROR | timechart count by error_msg | map search='| trendline sma10($count$) as "moving_avg_errors".$error_msg$'&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;does this work for you?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2015 19:28:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-plot-multiple-trendlines-over-multiple-timechart-values/m-p/202965#M33631</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2015-12-30T19:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot multiple trendlines over multiple timechart values?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-plot-multiple-trendlines-over-multiple-timechart-values/m-p/202966#M33632</link>
      <description>&lt;P&gt;Nope, doesn't work...&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jan 2016 08:01:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-plot-multiple-trendlines-over-multiple-timechart-values/m-p/202966#M33632</guid>
      <dc:creator>esegal2u</dc:creator>
      <dc:date>2016-01-03T08:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot multiple trendlines over multiple timechart values?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-plot-multiple-trendlines-over-multiple-timechart-values/m-p/202967#M33633</link>
      <description>&lt;P&gt;Try sma10($count$)&lt;BR /&gt;
AS $error_msg$ &lt;/P&gt;

&lt;P&gt;Instead of the field string concatenation in the above search.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jan 2016 23:13:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-plot-multiple-trendlines-over-multiple-timechart-values/m-p/202967#M33633</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-01-03T23:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot multiple trendlines over multiple timechart values?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-plot-multiple-trendlines-over-multiple-timechart-values/m-p/202968#M33634</link>
      <description>&lt;P&gt;It behaves the same. It matches events, but says "No results found".&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2016 13:51:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-plot-multiple-trendlines-over-multiple-timechart-values/m-p/202968#M33634</guid>
      <dc:creator>esegal2u</dc:creator>
      <dc:date>2016-01-07T13:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot multiple trendlines over multiple timechart values?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-plot-multiple-trendlines-over-multiple-timechart-values/m-p/202969#M33635</link>
      <description>&lt;P&gt;I realize I'm a little late to this thread, but I had a similar issue and thought I might post my answer here for anyone running into the same problem.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=x ERROR 
| timechart span=1m count by error_msg limit=100
| untable _time error count
| streamstats global=f window=10 avg(count) AS avg_count by error
| eval lowerBound=(-avg_count*2)
| eval upperBound=(avg_count*2)
| eval isOutlier=if('count' &amp;lt; lowerBound OR 'count' &amp;gt; upperBound, "***".count."***", count)
| xyseries _time error isOutlier
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The above code will show you all the data for each error over time, but it will surround outliers with asterisks. If you wanted to only show data when the count is an outlier, you could run the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=x ERROR 
| timechart span=1m count by error_msg limit=100
| untable _time error count
| streamstats global=f window=10 avg(count) AS avg_count by error
| eval lowerBound=(-avg_count*2)
| eval upperBound=(avg_count*2)
| where count &amp;lt; lowerBound OR count &amp;gt; upperBound
| xyseries _time error count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Again, I know I'm late to the party, but hopefully this will help someone with a similar problem in the future.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2017 18:42:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-plot-multiple-trendlines-over-multiple-timechart-values/m-p/202969#M33635</guid>
      <dc:creator>drivernick</dc:creator>
      <dc:date>2017-03-08T18:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot multiple trendlines over multiple timechart values?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-plot-multiple-trendlines-over-multiple-timechart-values/m-p/505648#M33636</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/216786"&gt;@drivernick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What if I have to count errors by grouping more than two fields like by error_msg and sitename say?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2020 05:17:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-plot-multiple-trendlines-over-multiple-timechart-values/m-p/505648#M33636</guid>
      <dc:creator>ksharma7</dc:creator>
      <dc:date>2020-06-23T05:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot multiple trendlines over multiple timechart values?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-plot-multiple-trendlines-over-multiple-timechart-values/m-p/571093#M46904</link>
      <description>&lt;P&gt;There's a quicker way with streamstats that may be new - here's how to get a 7 hour rolling average when splitting by host for example&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your base search&amp;gt;
| timechart span=1h sum(foo) as s by host
| untable _time host s
| sort host _time
| streamstats global=f window=7 avg(s) as trend by host
| timechart span=1h max(trend) by host&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Oct 2021 12:23:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-plot-multiple-trendlines-over-multiple-timechart-values/m-p/571093#M46904</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2021-10-15T12:23:15Z</dc:date>
    </item>
  </channel>
</rss>

