<?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: Why does my chart lose interactivity with a search using &amp;quot;appendcols&amp;quot;? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/319999#M95640</link>
    <description>&lt;P&gt;I can't explain why there is an issue, but I think I can help you another way.&lt;/P&gt;

&lt;P&gt;Try this instead. Improves performance by using &lt;CODE&gt;tstats&lt;/CODE&gt; and removes the ambiguity of using &lt;CODE&gt;appendcols&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=my_index
| eval _time = strptime(Closed, "%Y-%m-%d %H:%M:%S")
| chart limit=0 count over _time span=1w by Category
| append [ tstats count as inbound where index=my_index by _time span=1w]
| timechart span=1w latest(*) as *
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 27 Feb 2017 18:57:55 GMT</pubDate>
    <dc:creator>rjthibod</dc:creator>
    <dc:date>2017-02-27T18:57:55Z</dc:date>
    <item>
      <title>Why does my chart lose interactivity with a search using "appendcols"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/319996#M95637</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;

&lt;P&gt;Currently using Splunk 6.5.1.&lt;/P&gt;

&lt;P&gt;As the question implies, I have a search that uses the &lt;CODE&gt;appendcols&lt;/CODE&gt; command to add an additional column to a timechart making sure to use the same interval so it aligns correctly.  I've added this new column as an overlay to the chart, but keeping it on the same axis.&lt;/P&gt;

&lt;P&gt;I've noticed that the interactive nature of the chart is lost so I cannot highlight any values.  The only way to solve it is to remove the &lt;CODE&gt;appendcols&lt;/CODE&gt; command.  Is this a known issue, or is there a way to fix it?&lt;/P&gt;

&lt;P&gt;Thank you and best regards,&lt;/P&gt;

&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2017 15:36:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/319996#M95637</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2017-02-27T15:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my chart lose interactivity with a search using "appendcols"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/319997#M95638</link>
      <description>&lt;P&gt;The community can most efficiently help you if you share details about your search. Please share your SPL if you can.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2017 16:28:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/319997#M95638</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-02-27T16:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my chart lose interactivity with a search using "appendcols"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/319998#M95639</link>
      <description>&lt;P&gt;Thanks for the response!&lt;/P&gt;

&lt;P&gt;Here is the SPL:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=my_index
| eval _time = strptime(Closed, "%Y-%m-%d %H:%M:%S")
| timechart span=1w count by Category
| appendcols [ search index=my_index
 | timechart span=1w count as inbound ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will generate a table that looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time,cat_a,cat_b,cat_c,cat_d,inbound
2016-08-04,0,3,1,2,1
2016-08-11,0,3,8,0,0
2016-08-18,0,22,10,12,36
2016-08-25,0,15,42,7,70
2016-09-01,0,39,56,12,137
2016-09-08,0,29,61,5,98
2016-09-15,0,29,65,7,242
2016-09-22,0,22,24,2,219
2016-09-29,0,16,13,2,228
2016-10-06,0,16,4,4,231
2016-10-13,0,6,6,2,256
2016-10-20,0,5,17,3,211
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When formatting the chart, the first thing I notice is that when I try to make &lt;CODE&gt;Inbound&lt;/CODE&gt; as an overlay, the list of fields does not prepopulate as it usually does (I have to type it all in manually):&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/TE1LiTG.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;The final result is the following, but it is not interactive:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/8pVMzN2.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;I hope this helps to clarify the situation!&lt;/P&gt;

&lt;P&gt;Thank you and best regards,&lt;/P&gt;

&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2017 18:40:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/319998#M95639</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2017-02-27T18:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my chart lose interactivity with a search using "appendcols"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/319999#M95640</link>
      <description>&lt;P&gt;I can't explain why there is an issue, but I think I can help you another way.&lt;/P&gt;

&lt;P&gt;Try this instead. Improves performance by using &lt;CODE&gt;tstats&lt;/CODE&gt; and removes the ambiguity of using &lt;CODE&gt;appendcols&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=my_index
| eval _time = strptime(Closed, "%Y-%m-%d %H:%M:%S")
| chart limit=0 count over _time span=1w by Category
| append [ tstats count as inbound where index=my_index by _time span=1w]
| timechart span=1w latest(*) as *
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Feb 2017 18:57:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/319999#M95640</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-02-27T18:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my chart lose interactivity with a search using "appendcols"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/320000#M95641</link>
      <description>&lt;P&gt;Hello and thanks for the suggestion.&lt;/P&gt;

&lt;P&gt;In my case I am tracking items that have an &lt;CODE&gt;open&lt;/CODE&gt; date and a &lt;CODE&gt;closed&lt;/CODE&gt; date, with _time set to the &lt;CODE&gt;open&lt;/CODE&gt; date.  What I want to do is show how many items are closed per week while also showing how many items are opened.  The &lt;CODE&gt;appendcols&lt;/CODE&gt; command seems ideal, and I can avoid calling an external script to process the data.  Unless there is another way?&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 06:41:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/320000#M95641</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2017-02-28T06:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my chart lose interactivity with a search using "appendcols"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/320001#M95642</link>
      <description>&lt;P&gt;OK understood. Going back to your original, try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=my_index
| chart limit=0 count over _time span=1w by Category
| append [ tstats count as inbound where index=my_index by _time span=1w]
| timechart span=1w latest(*) as *
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Feb 2017 11:43:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/320001#M95642</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-02-28T11:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my chart lose interactivity with a search using "appendcols"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/320002#M95643</link>
      <description>&lt;P&gt;This works,  I had to add an &lt;CODE&gt;eval&lt;/CODE&gt; to set &lt;CODE&gt;_time&lt;/CODE&gt; to &lt;CODE&gt;Closed&lt;/CODE&gt;, but the structure is perfect.&lt;/P&gt;

&lt;P&gt;In the meantime I found another way of doing it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=my_index
| eval _time = strptime(Closed, "%Y-%m-%d %H:%M:%S")
| timechart span=1w count by Category
| join type=left _time [ search index=my_index
 | timechart span=1w count as inbound ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(all I did was replace &lt;CODE&gt;appendcols&lt;/CODE&gt; with a &lt;CODE&gt;join type=left _time&lt;/CODE&gt;)&lt;/P&gt;

&lt;P&gt;In my solution the join type means that the leftmost search will determine which values to show, whereas yours will show instances of the rightmost search where there is no match with the leftmost search.&lt;/P&gt;

&lt;P&gt;Thank you very much!&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 12:32:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/320002#M95643</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2017-02-28T12:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my chart lose interactivity with a search using "appendcols"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/320003#M95644</link>
      <description>&lt;P&gt;I am sorry for removing the &lt;CODE&gt;eval&lt;/CODE&gt; from my solution. That was an error on my part.&lt;/P&gt;

&lt;P&gt;In general, you should avoid using &lt;CODE&gt;join&lt;/CODE&gt; as much as possible. There are numerous entries in Splunk answers and a Splunk .conf 2016 talk about why. I will update my original answer with my latest one. You should accept that answer as the final solution.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 13:22:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/320003#M95644</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-02-28T13:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my chart lose interactivity with a search using "appendcols"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/320004#M95645</link>
      <description>&lt;P&gt;Thank you so much, this works perfectly!  I have one additional query:&lt;/P&gt;

&lt;P&gt;I see that &lt;CODE&gt;tstats&lt;/CODE&gt; is fast for index-time fields and works in this particular case.  What is the best approach, though, if the appended search has to apply filters and perform more advanced operations?  Here is a similar scenario:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=my_index
| search Category="A")
| timechart span=1d count as EnterCount
| join type=left _time [ search index=my_index
 | search (Category="A")
 | eval _time = strptime(Exit, "%Y-%m-%d %H:%M:%S")
 | timechart span=1d count as ExitCount ]
| fillnull value=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How would the &lt;CODE&gt;join&lt;/CODE&gt; be replaced with &lt;CODE&gt;append&lt;/CODE&gt; in this case?&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 14:16:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/320004#M95645</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2017-02-28T14:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my chart lose interactivity with a search using "appendcols"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/320005#M95646</link>
      <description>&lt;P&gt;Here is an improved version.&lt;/P&gt;

&lt;P&gt;Note, your filter of &lt;CODE&gt;Category="A"&lt;/CODE&gt; should be moved to the first search step where it will be much, much faster.&lt;/P&gt;

&lt;P&gt;You can almost always replace &lt;CODE&gt;join _time type=left&lt;/CODE&gt; with &lt;CODE&gt;append&lt;/CODE&gt; followed by &lt;CODE&gt;stats&lt;/CODE&gt;, &lt;CODE&gt;chart&lt;/CODE&gt;, or &lt;CODE&gt;timechart&lt;/CODE&gt; that will transform the data on the &lt;CODE&gt;_time&lt;/CODE&gt; dimension. In my example, I don't merge the columns until the last command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=my_index Category="A"
| chart count as EnterCount over _time span=1d
| append 
  [ 
    search index=my_index Category="A"
    | eval _time = strptime(Exit, "%Y-%m-%d %H:%M:%S")
    | chart count as ExitCount over _time span=1d ]
  ]
| timechart span=1d latest(*) as *
| fillnull value=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Feb 2017 15:38:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-my-chart-lose-interactivity-with-a-search-using-quot/m-p/320005#M95646</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-02-28T15:38:37Z</dc:date>
    </item>
  </channel>
</rss>

