<?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: timechart sum of field value from different sources with changing span ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388528#M113290</link>
    <description>&lt;P&gt;Yes, this query seems to be working, but it is taking long time to return the result. Appox it is taking 70 seconds for this query to execute if I select "last 30 days". How can I increase the performance of this query ?&lt;/P&gt;</description>
    <pubDate>Tue, 28 May 2019 12:12:46 GMT</pubDate>
    <dc:creator>pgadhari</dc:creator>
    <dc:date>2019-05-28T12:12:46Z</dc:date>
    <item>
      <title>timechart sum of field value from different sources with changing span ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388522#M113284</link>
      <description>&lt;P&gt;I have 3 sources having a field called value, that collects power ratings. I have to timechart the sum of those values to show the final power ratings. When I keep the timerange as "last 60 minutes", that works, as the values are getting collected every 1 minute. So the span of 1m works fine. But when I change the timerange to "Last 4 hours" or "Last 24 hours" or more than that, problem is - it add the all the values of each source and shows that value which is not proper. How do I resolve this issue :&lt;/P&gt;

&lt;P&gt;My query is :&lt;/P&gt;

&lt;P&gt;index=dcim | timechart sum(value) by source | addtotals ....&lt;/P&gt;

&lt;P&gt;If I do span=1m, which is fine. But If i change the time-range, span=1m does not seem to feasible option, as the search becomes very slow as it is returning lot of events and then doing addtotals and further using eval, will take more time. &lt;BR /&gt;
In short, my output of events should be 1 min, add those values and do the timechart ? whatever time range I select. Please help resolve the issue ?&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
PG&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 09:19:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388522#M113284</guid>
      <dc:creator>pgadhari</dc:creator>
      <dc:date>2019-05-28T09:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: timechart sum of field value from different sources with changing span ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388523#M113285</link>
      <description>&lt;P&gt;Hi @pgadhari,&lt;/P&gt;

&lt;P&gt;If you're using timechart for with a 1m span over a long period of time you will also hit :&lt;BR /&gt;
&lt;CODE&gt;This visualization is configured to display a maximum of 10000 results per series, and that limit has been reached&lt;/CODE&gt;&lt;BR /&gt;
try something like this to first get the total over 1 min, then make the &lt;CODE&gt;timechart&lt;/CODE&gt; with whatever span you need : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dcim| bucket _time span=1m  | stats sum(value) by source,_time | addtotals .... |timechart sum(value) by source
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let me know if that helps!&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 10:17:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388523#M113285</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-28T10:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: timechart sum of field value from different sources with changing span ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388524#M113286</link>
      <description>&lt;P&gt;If you don't use &lt;CODE&gt;span&lt;/CODE&gt;, timechart should automatically adjust the span according to the time-range&lt;/P&gt;

&lt;P&gt;You could also try to put a &lt;CODE&gt;minspan&lt;/CODE&gt; to ensure it never goes below 1min&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dcim | timechart minspan=1m sum(value)  by source
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 May 2019 10:46:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388524#M113286</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2019-05-28T10:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: timechart sum of field value from different sources with changing span ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388525#M113287</link>
      <description>&lt;P&gt;Hi @pgadhari &lt;/P&gt;

&lt;P&gt;Can you try this. In your case , you shoud use &lt;CODE&gt;bin&lt;/CODE&gt; command (to grouping events timestamp), and &lt;CODE&gt;stats&lt;/CODE&gt; command .&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dcim
| fields value, source
| bin _time span=1m
| stats sum(value) as values by _time,source
| xyseries _time source values
| addtotals
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The &lt;CODE&gt;timechart&lt;/CODE&gt; command with &lt;CODE&gt;span=1m&lt;/CODE&gt; option is searching and calcurate events in every all 1min( really every 1 minuite) . &lt;BR /&gt;
So ,if you change the timerange to more longer ,  this affects to search speed. &lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 10:49:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388525#M113287</guid>
      <dc:creator>soskaykakehi</dc:creator>
      <dc:date>2019-05-28T10:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: timechart sum of field value from different sources with changing span ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388526#M113288</link>
      <description>&lt;P&gt;This query is not working, as the stats is not showing up the values properly and when I add addtotals, timechart not showing any values.&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 12:10:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388526#M113288</guid>
      <dc:creator>pgadhari</dc:creator>
      <dc:date>2019-05-28T12:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: timechart sum of field value from different sources with changing span ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388527#M113289</link>
      <description>&lt;P&gt;If I depend on timechart for automatic span, then the values are coming too high, as it adds all the values of that field for that source, which is wrong. &lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 12:11:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388527#M113289</guid>
      <dc:creator>pgadhari</dc:creator>
      <dc:date>2019-05-28T12:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: timechart sum of field value from different sources with changing span ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388528#M113290</link>
      <description>&lt;P&gt;Yes, this query seems to be working, but it is taking long time to return the result. Appox it is taking 70 seconds for this query to execute if I select "last 30 days". How can I increase the performance of this query ?&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 12:12:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388528#M113290</guid>
      <dc:creator>pgadhari</dc:creator>
      <dc:date>2019-05-28T12:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: timechart sum of field value from different sources with changing span ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388529#M113291</link>
      <description>&lt;P&gt;ah yeah, by &lt;CODE&gt;addtotals ...&lt;/CODE&gt; I meant you should add your logic there. What totals did you need there ? Try it like this : &lt;BR /&gt;
 index=dcim| bucket _time span=1m  | stats sum(value) as value by source,_time | addtotals |timechart sum(value) by source&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:41:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388529#M113291</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2020-09-30T00:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: timechart sum of field value from different sources with changing span ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388530#M113292</link>
      <description>&lt;P&gt;Hmm. Sorry , I have no answer to increase more faster this query search performance easly.&lt;BR /&gt;
This query has dispatch almost procsess at indexers. Add more  indexer can increase this performance. but... yeah, this not an answer you want.&lt;/P&gt;

&lt;P&gt;Other option is, how about to save your shortly span results to &lt;CODE&gt;summary index&lt;/CODE&gt; using hourly or daily scheduled search. You can use &lt;CODE&gt;fill_summary_index.py&lt;/CODE&gt; to fill your summary index with past timerange.&lt;BR /&gt;
If you need many times to search a same query or more than long timerange, this is one of the answer i think.&lt;/P&gt;

&lt;P&gt;Or, If this index is using  &lt;CODE&gt;index-time field extractions&lt;/CODE&gt; with structured data (ex:  CSV , json ,etc), you can use &lt;CODE&gt;tstats&lt;/CODE&gt; command to get more faster results.  like this :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats sum(value) where index=dcim by _time,source span=1m
| xyseries _time source value
| addtotals
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 May 2019 13:52:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388530#M113292</guid>
      <dc:creator>soskaykakehi</dc:creator>
      <dc:date>2019-05-28T13:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: timechart sum of field value from different sources with changing span ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388531#M113293</link>
      <description>&lt;P&gt;This is my query, &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dcim 41025 |timechart sum(value) by source | addtotals |eval Power=round(Total/1000/3,1) | fields - snmp* Total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;wherein I am getting timechart of the value of different sources in columns and then doing the addtotals, to find the final power value and further doing calculation on that using eval function. Now, using "bucket _time span=1m", I am getting the values every 1 min, even after changing the time-range, which is working fine now. The only problem is, when I change the time range, getting events every one minute is slowing down the performance of the query and taking long time to load the panel chart. I need to fix that issue. How can I fix it ?&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
PG&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 05:57:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388531#M113293</guid>
      <dc:creator>pgadhari</dc:creator>
      <dc:date>2019-05-29T05:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: timechart sum of field value from different sources with changing span ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388532#M113294</link>
      <description>&lt;P&gt;So, you mean to  say is - I should forward the output of that query in summary index and then use the tstats command in the search query for the  panel right ?&lt;/P&gt;

&lt;P&gt;can you tell me detailed steps on that, on how can I do that ? As per my understanding, I should schedule a saved search and put following query in that search, right ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=dcim
 | fields value, source
 | bin _time span=1m
 | stats sum(value) as values by _time,source
 | xyseries _time source values
 | addtotals
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and then forward to summary index. Once this is done, I should use tstats command in the query for the panel right ? Please guide ?&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
PG&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 06:00:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388532#M113294</guid>
      <dc:creator>pgadhari</dc:creator>
      <dc:date>2019-05-29T06:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: timechart sum of field value from different sources with changing span ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388533#M113295</link>
      <description>&lt;P&gt;@pgadhari &lt;BR /&gt;
You should forward your search results in summary index and then just search it without tstats.&lt;BR /&gt;
tstats needs to extract fields during indexing time. I am not sure if this works with a summary index.&lt;/P&gt;

&lt;P&gt;However, storing calculation results in a summary index can provide significant benefits. Also, you don't have to do a lot of processing over and over, and you can search on a longer time range. And Summary Index does not consume daily license.&lt;BR /&gt;
I'm still looking for a way to use tstats at the summary index or add a field extraction configuration that can use tstats later, but I haven't yet found a good way.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Here is the step to &lt;CODE&gt;use summary index&lt;/CODE&gt; without using &lt;CODE&gt;tstats&lt;/CODE&gt; command.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;*Reference : &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Usesummaryindexing"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Usesummaryindexing&lt;/A&gt; *&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Step 1) Create a new index to use as a summary index.&lt;/STRONG&gt;&lt;BR /&gt;
The method of creating a summary index is the same as creating a general index. The entity is just an index.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Note&lt;/EM&gt;&lt;/STRONG&gt;: When creating a summary index, your configuration may affect where you create the summary index. Only SearchHead can generate summary index data. And you can not access that summary index from other SearchHeads.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Option  1: Store summary index locally on SearchHead&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
If you are using standalone Splunk or single SearchHead, there is no problem creating an index locally.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Option 2: Save summary index in Indexer&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
If the amount of data in the summary index to create or the number of events is large, it is possible to hold the summary index in Indexer. &lt;BR /&gt;
By doing so, you have the following benefits:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt; Aggregates data in Indexer&lt;/LI&gt;
&lt;LI&gt;Summary index can be used from other SearchHead such as SearchHeadCluster&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;If you want to save the summary index in Indexer, you need to set up to transfer SearchHead data to Indexer, referring to the following page.&lt;/P&gt;

&lt;P&gt;*Reference :  &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/DistSearch/Forwardsearchheaddata"&gt;Best practice: Forward search head data to the indexer layer&lt;/A&gt; &lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/DistSearch/Forwardsearchheaddata"&gt;https://docs.splunk.com/Documentation/Splunk/latest/DistSearch/Forwardsearchheaddata&lt;/A&gt; *&lt;/P&gt;

&lt;P&gt;Keep in mind the following points when making this setting:&lt;BR /&gt;
- You will not be able to access the summary index already created in SearchHead (since all requests will be sent to Indexer)&lt;BR /&gt;
- Before setting up, it is necessary to create a summary index used by SearchHead in Indexer. To create an index in Indexer, distribute &lt;CODE&gt;indexes.conf&lt;/CODE&gt; from Cluster Master.&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
&lt;STRONG&gt;Step 2) Set the schedule search as the following settings.&lt;/STRONG&gt;&lt;BR /&gt;
Execution interval and time range specification are one example, please change according to your search frequency and requirements.&lt;BR /&gt;
If you want to set the summary index from the schedule search setting screen on the WebUI, please delete the &lt;CODE&gt;collect&lt;/CODE&gt; command line of the query because it is unnecessary.&lt;/P&gt;

&lt;P&gt;Execution interval ： &lt;CODE&gt;per 1h&lt;/CODE&gt; &lt;BR /&gt;
Search Timerange ： &lt;CODE&gt;Relative&lt;/CODE&gt; ,    &lt;CODE&gt;earliest: -1h@h&lt;/CODE&gt;,   &lt;CODE&gt;latest: @h&lt;/CODE&gt;&lt;BR /&gt;
Query1:&lt;BR /&gt;
&lt;CODE&gt;collect&lt;/CODE&gt; command line means , store search results in to summary index &lt;CODE&gt;dcim_summary&lt;/CODE&gt; and add a strings &lt;CODE&gt;tags=dcim_sum_v1&lt;/CODE&gt; to record.&lt;BR /&gt;
Please change the index name from &lt;CODE&gt;dcim_summary&lt;/CODE&gt; to created in Step 1.&lt;BR /&gt;
You should add a tag or label, if you use same summary index to other usage.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dcim
| fields value, source
| bin _time span=1m
| stats sum(value) as values by _time,source
| eval labels="source:"+source
| xyseries _time labels values
| addtotals
| collect index=dcim_summary marker="tags=dcim_sum_v1"    
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Step 3) Search statistical data from summary index.&lt;/STRONG&gt;&lt;BR /&gt;
Query2:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dcim_summary tags=dcim_sum_v1
| bin _time span=1m
| stats sum(source:*) sum(Total) by _time   
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks for reading. I hope it helps you.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 11:11:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388533#M113295</guid>
      <dc:creator>soskaykakehi</dc:creator>
      <dc:date>2019-05-29T11:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: timechart sum of field value from different sources with changing span ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388534#M113296</link>
      <description>&lt;P&gt;Sure @soskaykakehi , thanks. I will try that out and revert if there are any issues.&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 07:26:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-sum-of-field-value-from-different-sources-with/m-p/388534#M113296</guid>
      <dc:creator>pgadhari</dc:creator>
      <dc:date>2019-05-30T07:26:34Z</dc:date>
    </item>
  </channel>
</rss>

