<?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: Help with Chart overlay over Bar chart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Chart-overlay-over-Bar-chart/m-p/370337#M109057</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Sorry i misunderstood your requirement - Anyway here's a sample code that I tried on internal splunk audit index, which you can also try as the audit index is available by default. A bit on mapping , I have taken the field 'user' for unique user , which is 'ip' in your case, rest all stays the same.&lt;BR /&gt;
Now, you are using a lookup to calculate the hourly averages, for example,say for hour 10&lt;BR /&gt;
if you have 3 days as columns something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;hour   day 1 day 2 day 3
10       2        3          4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You expect the average as 3 , which should also be available as an overlay field and that is probably why you are using a csv look up. Let splunk calculate this average for you..try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="_audit" | eval tmfrmt_date=strftime(_time,"%Y-%m-%d") | eval tmfrmt_hour=strftime(_time,"%H") | eval tmfrmt_wkday=strftime(_time,"%a") | stats dc(user) AS Unique_Users by tmfrmt_hour tmfrmt_date tmfrmt_wkday |search NOT(tmfrmt_wkday="sat") NOT(tmfrmt_wkday="sun")| eventstats dc(tmfrmt_date) as col  | xyseries tmfrmt_hour tmfrmt_date Unique_Users| addtotals  | appendcols[search index="_audit" | eval tmfrmt_date=strftime(_time,"%Y-%m-%d") | eval tmfrmt_hour=strftime(_time,"%H") | eval tmfrmt_wkday=strftime(_time,"%a") | stats dc(user) AS Unique_Users by tmfrmt_hour tmfrmt_date tmfrmt_wkday |search NOT(tmfrmt_wkday="sat") NOT(tmfrmt_wkday="sun")| eventstats dc(tmfrmt_date) as col   |table col]| where isnotnull(tmfrmt_hour)| eval avg=(Total-tmfrmt_hour)/col | fields - col,Total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Mapping&lt;BR /&gt;
id - user&lt;BR /&gt;
AvgUserCount - avg&lt;/P&gt;

&lt;P&gt;Now, when you go to the visualization you can select avg as an overlay. If possible avoid using a lookup csv, merely to calculate the average over hours over days, let splunk calculate it real time&lt;/P&gt;</description>
    <pubDate>Sat, 10 Feb 2018 06:39:35 GMT</pubDate>
    <dc:creator>Sukisen1981</dc:creator>
    <dc:date>2018-02-10T06:39:35Z</dc:date>
    <item>
      <title>Help with Chart overlay over Bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Chart-overlay-over-Bar-chart/m-p/370333#M109053</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;Need help in building below visualization having overlay.&lt;/P&gt;

&lt;P&gt;x-axis - represents hour [24 hour format]&lt;BR /&gt;
y-axis -shows the distinct count&lt;BR /&gt;
single hour should be able to show the counts for different dates.&lt;BR /&gt;
overlay should show the average count&lt;/P&gt;

&lt;P&gt;I have lookup which has average, i am willing to use this lookup.  &lt;/P&gt;

&lt;P&gt;Below is my xyseries search,i am unable to get the overlay either with xyseries or stats command. i am unable to get "AvgUserCount" field values in overlay field name &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=abc | eval tmfrmt_date=strftime(_time,"%Y-%m-%d") | eval tmfrmt_hour=strftime(_time,"%H") | eval tmfrmt_wkday=strftime(_time,"%a") | stats dc(id) AS Unique_Users by tmfrmt_hour tmfrmt_date tmfrmt_wkday |search NOT(tmfrmt_wkday="sat") NOT(tmfrmt_wkday="sun") | table Unique_Users tmfrmt_date tmfrmt_hour | lookup avg.csv Hour as tmfrmt_hour OUTPUT AvgUserCount | table tmfrmt_hour Unique_Users tmfrmt_date AvgUserCount | xyseries tmfrmt_hour tmfrmt_date Unique_Users AvgUserCount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;avg lookup has values as below[ values are cooked up]&lt;/P&gt;

&lt;P&gt;Hour,AvgUserCount&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;![00,230
01,100
.
.
.23,270][1]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any suggestions on how to get this done.&lt;/P&gt;

&lt;P&gt;Thank you in advance.&lt;/P&gt;

&lt;P&gt;Splunk version 6.5.2&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 18:47:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Chart-overlay-over-Bar-chart/m-p/370333#M109053</guid>
      <dc:creator>newbie2tech</dc:creator>
      <dc:date>2018-02-08T18:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Chart overlay over Bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Chart-overlay-over-Bar-chart/m-p/370334#M109054</link>
      <description>&lt;P&gt;i am willing to follow any other approach if needed to achieve this. &lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 14:52:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Chart-overlay-over-Bar-chart/m-p/370334#M109054</guid>
      <dc:creator>newbie2tech</dc:creator>
      <dc:date>2018-02-09T14:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Chart overlay over Bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Chart-overlay-over-Bar-chart/m-p/370335#M109055</link>
      <description>&lt;P&gt;hmm what if you use &lt;CODE&gt;|trendline sma2(Unique_Users) as AvgUserCount&lt;/CODE&gt;&lt;BR /&gt;
Then try adding the trendline field - AvgUserCount as an overlay?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 18:30:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Chart-overlay-over-Bar-chart/m-p/370335#M109055</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2018-02-09T18:30:02Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Chart overlay over Bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Chart-overlay-over-Bar-chart/m-p/370336#M109056</link>
      <description>&lt;P&gt;thanks for the response.  I need the average of the hour across the time range the trendline is giving me average for the specific hour+date combination , yes the field is listed in overlay option but the dates spread out for the hour is going off i.e. I no longer see the dates with in the hour. &lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 19:06:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Chart-overlay-over-Bar-chart/m-p/370336#M109056</guid>
      <dc:creator>newbie2tech</dc:creator>
      <dc:date>2018-02-09T19:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Chart overlay over Bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Chart-overlay-over-Bar-chart/m-p/370337#M109057</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Sorry i misunderstood your requirement - Anyway here's a sample code that I tried on internal splunk audit index, which you can also try as the audit index is available by default. A bit on mapping , I have taken the field 'user' for unique user , which is 'ip' in your case, rest all stays the same.&lt;BR /&gt;
Now, you are using a lookup to calculate the hourly averages, for example,say for hour 10&lt;BR /&gt;
if you have 3 days as columns something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;hour   day 1 day 2 day 3
10       2        3          4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You expect the average as 3 , which should also be available as an overlay field and that is probably why you are using a csv look up. Let splunk calculate this average for you..try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="_audit" | eval tmfrmt_date=strftime(_time,"%Y-%m-%d") | eval tmfrmt_hour=strftime(_time,"%H") | eval tmfrmt_wkday=strftime(_time,"%a") | stats dc(user) AS Unique_Users by tmfrmt_hour tmfrmt_date tmfrmt_wkday |search NOT(tmfrmt_wkday="sat") NOT(tmfrmt_wkday="sun")| eventstats dc(tmfrmt_date) as col  | xyseries tmfrmt_hour tmfrmt_date Unique_Users| addtotals  | appendcols[search index="_audit" | eval tmfrmt_date=strftime(_time,"%Y-%m-%d") | eval tmfrmt_hour=strftime(_time,"%H") | eval tmfrmt_wkday=strftime(_time,"%a") | stats dc(user) AS Unique_Users by tmfrmt_hour tmfrmt_date tmfrmt_wkday |search NOT(tmfrmt_wkday="sat") NOT(tmfrmt_wkday="sun")| eventstats dc(tmfrmt_date) as col   |table col]| where isnotnull(tmfrmt_hour)| eval avg=(Total-tmfrmt_hour)/col | fields - col,Total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Mapping&lt;BR /&gt;
id - user&lt;BR /&gt;
AvgUserCount - avg&lt;/P&gt;

&lt;P&gt;Now, when you go to the visualization you can select avg as an overlay. If possible avoid using a lookup csv, merely to calculate the average over hours over days, let splunk calculate it real time&lt;/P&gt;</description>
      <pubDate>Sat, 10 Feb 2018 06:39:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Chart-overlay-over-Bar-chart/m-p/370337#M109057</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2018-02-10T06:39:35Z</dc:date>
    </item>
  </channel>
</rss>

