<?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 create a multi-series line chart based on date, hosts, and an eval? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-multi-series-line-chart-based-on-date-hosts-and/m-p/591282#M48498</link>
    <description>&lt;P&gt;Perfect!&amp;nbsp; Thanks!&amp;nbsp; Is the foreach approach&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;mentioned any less complex?&amp;nbsp; Just curious for my own educational purposes.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Mar 2022 14:57:47 GMT</pubDate>
    <dc:creator>bsg273</dc:creator>
    <dc:date>2022-03-29T14:57:47Z</dc:date>
    <item>
      <title>How to create a multi-series line chart based on date, hosts, and an eval?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-multi-series-line-chart-based-on-date-hosts-and/m-p/591140#M48493</link>
      <description>&lt;P&gt;I'm trying to create a multi-series line chart in a Splunk dashboard that shows the availability percentages of a given service across multiple individual days for a set of hosts.&amp;nbsp; In other words, date is my x-axis, availability is my y-axis, and my legend contains the various hosts.&amp;nbsp; Since a picture is worth a thousand words, here's an example of what I'm trying to create:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="example_chart.jpg" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/18796iFF4C54EFDF95CC23/image-size/medium?v=v2&amp;amp;px=400" role="button" title="example_chart.jpg" alt="example_chart.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;And here is my attempt at the query that's currently not working (it's using the rhnsd service as an example and assumes ps.sh is being run every 1800 seconds so it calculates availability based off ps.sh running 86400/1800=48 times per day):&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=os host="my-db-*" sourcetype=ps rhnsd | timechart span=1d count by host | eval availability=if(count&amp;gt;=86400/1800,100,count/floor(86400/1800)*100) | rename _time as Date host as Host availability as Availability | fieldformat Date = strftime(Date, "%m/%d/%Y") | chart first(Availability) over Host by Date&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any assistance with getting this query working so I can visualize it in a&amp;nbsp;multi-series line chart in a dashboard panel would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 21:09:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-multi-series-line-chart-based-on-date-hosts-and/m-p/591140#M48493</guid>
      <dc:creator>bsg273</dc:creator>
      <dc:date>2022-03-28T21:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a multi-series line chart based on date, hosts, and an eval?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-multi-series-line-chart-based-on-date-hosts-and/m-p/591151#M48494</link>
      <description>&lt;P&gt;When you do timechart, you're creating separate data series not called "count" but named after values of your "by" field. You can either do the eval calculations using foreach or you can untable, calculate your evals and xyseries the data back. Both solutions aren't very pretty, you might want to check for yourself which is better performance-wise.&lt;/P&gt;&lt;P&gt;And I suppose you might lose the last chart command.&lt;/P&gt;&lt;P&gt;In general - don't troubleshoot all pipeline at once, just add one command at a time and see where it leads you.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 21:26:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-multi-series-line-chart-based-on-date-hosts-and/m-p/591151#M48494</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-03-28T21:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a multi-series line chart based on date, hosts, and an eval?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-multi-series-line-chart-based-on-date-hosts-and/m-p/591196#M48495</link>
      <description>&lt;LI-CODE lang="markup"&gt;index=os host="my-db-*" sourcetype=ps rhnsd 
| timechart span=1d count by host 
| untable _time host count
| eval availability=if(count&amp;gt;=86400/1800,100,count/floor(86400/1800)*100) 
| rename _time as Date host as Host availability as Availability 
| fieldformat Date = strftime(Date, "%m/%d/%Y") 
| xyseries Date Host Availability&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 29 Mar 2022 07:20:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-multi-series-line-chart-based-on-date-hosts-and/m-p/591196#M48495</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-03-29T07:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a multi-series line chart based on date, hosts, and an eval?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-multi-series-line-chart-based-on-date-hosts-and/m-p/591198#M48496</link>
      <description>&lt;P&gt;Yep, that's one of the solutions I was talking about &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 07:25:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-multi-series-line-chart-based-on-date-hosts-and/m-p/591198#M48496</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-03-29T07:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a multi-series line chart based on date, hosts, and an eval?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-multi-series-line-chart-based-on-date-hosts-and/m-p/591282#M48498</link>
      <description>&lt;P&gt;Perfect!&amp;nbsp; Thanks!&amp;nbsp; Is the foreach approach&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;mentioned any less complex?&amp;nbsp; Just curious for my own educational purposes.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 14:57:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-multi-series-line-chart-based-on-date-hosts-and/m-p/591282#M48498</guid>
      <dc:creator>bsg273</dc:creator>
      <dc:date>2022-03-29T14:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a multi-series line chart based on date, hosts, and an eval?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-multi-series-line-chart-based-on-date-hosts-and/m-p/591285#M48499</link>
      <description>&lt;P&gt;The foreach solution is a bit more straightforward in terms of understanding the idea behind it, but - in my opinion - less "splunky" &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;index=os host="my-db-*" sourcetype=ps rhnsd &lt;BR /&gt;| timechart span=1d count by host &lt;BR /&gt;| foreach * &lt;BR /&gt;&amp;nbsp;&amp;nbsp; [ | eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; &amp;gt; 86400/1800,100,&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;/floor(86400/1800)*100) ]&lt;BR /&gt;| rename _time as Date&lt;BR /&gt;| fieldformat Date = strftime(Date, "%m/%d/%Y") &lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Mar 2022 15:07:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-multi-series-line-chart-based-on-date-hosts-and/m-p/591285#M48499</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-03-29T15:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a multi-series line chart based on date, hosts, and an eval?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-multi-series-line-chart-based-on-date-hosts-and/m-p/591290#M48500</link>
      <description>&lt;P&gt;Ha, we wouldn't want that!&amp;nbsp; But like you said, definitely easier to understand.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 15:21:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-multi-series-line-chart-based-on-date-hosts-and/m-p/591290#M48500</guid>
      <dc:creator>bsg273</dc:creator>
      <dc:date>2022-03-29T15:21:47Z</dc:date>
    </item>
  </channel>
</rss>

