<?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: Add additional fields to the end of timechart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473643#M133254</link>
    <description>&lt;P&gt;Try something like this (keeping your current version of query)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your query for ticket_inflow
| join type=left _time [Your query for tickets_cancelled]
| join type=left _time [Your query for tickets_resolved]
| reverse
| appendcols [ your query for backlog]
| reverse
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 06 Nov 2019 19:29:46 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2019-11-06T19:29:46Z</dc:date>
    <item>
      <title>Add additional fields to the end of timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473636#M133247</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have a bar chart that looks like this:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7887i5D4E7EEF11E199E0/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;What I want to do is move the "Backlog" field to the end of the bar chart (chart overlay). In this case, I want it to appear on Thu Oct 31.&lt;/P&gt;

&lt;P&gt;Here is the search for my chart:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7888iE48CE7374F320712/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Earliest and latest is derived from a timepicker.&lt;/P&gt;

&lt;P&gt;How can I move backlog to last entry in my timechart?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 06:33:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473636#M133247</guid>
      <dc:creator>dojiepreji</dc:creator>
      <dc:date>2019-10-31T06:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Add additional fields to the end of timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473637#M133248</link>
      <description>&lt;P&gt;Ah, I see what's happening.  I was able to mock up your data using some of my own.  Append is what we should be using here instead of appendcols.  I was able to get the backlog sum at the end if the time series.&lt;/P&gt;

&lt;P&gt;Replace your entire appendcols subsearch with this:   &lt;EM&gt;updated from original post&lt;/EM&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| append
   [ search index=*_internal*
   | where ticket_status!="Resolved" AND ticket_status!="Closed" AND ticket_status!="Cancelled"
   | dedup ticket_name
   | addinfo
   | stats latest(info_max_time) AS _time, count(ticket_name) as backlog]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If this works, I highly recommend your next step be to optimize the other parts of your search based on the way @to4kawa suggested above (minus the backlog part).&lt;BR /&gt;
Let's tackle this one step at a time, though, and get your backlog sum at the end first before moving on to improving your search.&lt;/P&gt;

&lt;P&gt;Hope that helps!&lt;BR /&gt;
rmmiller&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2019 14:53:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473637#M133248</guid>
      <dc:creator>rmmiller</dc:creator>
      <dc:date>2019-11-01T14:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: Add additional fields to the end of timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473638#M133249</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=_internal ticket_status=*
|timechart span=1d count(eval(ticket_status!="Cancelled")) as ticket_inflow
,count(eval(ticket_status=="Cancelled")) as ticket_cancelled
,count(eval(if(resolved_date &amp;gt;= $time_picker.earliest$ AND resolved_date &amp;lt;= $time_picker.latest$ 
AND (ticket_status=="Resolved" OR ticket_status=="Closed"),ticket_name,NULL))) as ticket_resolved
,count(eval(ticket_status!="Resolved" AND ticket_status!="Closed" AND ticket_status!="Cancelled")) as backlog 
|rename ticket_inflow as "Total Inflow", ticket_cancelled as "Total Cancelled"
, ticket_resolved as "Total Outflow", backlog as "Backlog"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, It was a dashboard, so I didn't put earliest etc. at first.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2019 16:52:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473638#M133249</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-11-01T16:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Add additional fields to the end of timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473639#M133250</link>
      <description>&lt;P&gt;This didn't work. Backlog is still appended in the beginning of the timechart. &lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 09:36:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473639#M133250</guid>
      <dc:creator>dojiepreji</dc:creator>
      <dc:date>2019-11-04T09:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Add additional fields to the end of timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473640#M133251</link>
      <description>&lt;P&gt;I made an update to my original answer.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 20:01:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473640#M133251</guid>
      <dc:creator>rmmiller</dc:creator>
      <dc:date>2019-11-04T20:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Add additional fields to the end of timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473641#M133252</link>
      <description>&lt;P&gt;What it did was simply append the backlog to the end of the table. I want it to appear beside the last entry in the timechart. &lt;/P&gt;

&lt;P&gt;Time    Total Inflow    Total Cancelled Total Outflow   Backlog&lt;BR /&gt;
2019-09         10                       10                      9&lt;BR /&gt;&lt;BR /&gt;
2019-10             11                         1                          1&lt;BR /&gt;
2019-11               1                         3                          4                       19&lt;/P&gt;

&lt;P&gt;This way, the backlog will appear to the very far right on my bar chart.&lt;/P&gt;

&lt;P&gt;I'm also thinking of rewriting the search but I think my current search now is more readable than what @to4kawa did. I think I'm willing to sacrifice a bit of performance just to make it more readable for me and others in the future. &lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2019 11:37:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473641#M133252</guid>
      <dc:creator>dojiepreji</dc:creator>
      <dc:date>2019-11-05T11:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: Add additional fields to the end of timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473642#M133253</link>
      <description>&lt;P&gt;Hmm....I'm not sure I understand what you're after, then.&lt;/P&gt;

&lt;P&gt;Your original post asked that the backlog appear on 10/31, which was one day beyond your last data point and the end of your time range.  That's what this latest answer provides, too.&lt;/P&gt;

&lt;P&gt;Are you saying you want backlog to appear immediately next to your latest non-backlog result, regardless of where it occurs?&lt;BR /&gt;
For example, if your search in the comment was from the beginning of September through the end of November, and you didn't have any non-backlog results beyond October, you would want the backlog to appear on 10/31?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2019 14:49:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473642#M133253</guid>
      <dc:creator>rmmiller</dc:creator>
      <dc:date>2019-11-05T14:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: Add additional fields to the end of timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473643#M133254</link>
      <description>&lt;P&gt;Try something like this (keeping your current version of query)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your query for ticket_inflow
| join type=left _time [Your query for tickets_cancelled]
| join type=left _time [Your query for tickets_resolved]
| reverse
| appendcols [ your query for backlog]
| reverse
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Nov 2019 19:29:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473643#M133254</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-11-06T19:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: Add additional fields to the end of timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473644#M133255</link>
      <description>&lt;P&gt;I have modified your search to make it more efficient.&lt;/P&gt;

&lt;P&gt;Try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal earliest=1522540800 latest=1572502991 
| eval ticket_inflow=case(_time&amp;gt;1569888000 and ticket_status!="Cancelled", ticket_name) 
| eval ticket_cancelled=case(_time&amp;gt;1569888000 and ticket_status=="Cancelled", ticket_name) 
| eval ticket_resolved=case(resolved_date&amp;gt;1569888000 and ticket_status=="Resolved" or ticket_status=="Closed", ticket_name) 
| eval _time= if(isnotnull(ticket_resolved), resolved_date, _time) 
| eval backlog=case(_time&amp;gt;1569888000 and ticket_status!="Cancelled" and ticket_status!="Resolved" and ticket_status!="Closed", ticket_name) 
| eventstats dc(backlog) as backlog 
| timechart span=1d fixedrange=false dc(ticket_*) as ticket_*, max(backlog) as backlog 
| eventstats max(_time) as last_time 
| eval backlog=case(_time==last_time, backlog) 
| fields - last_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps. Please mark as answer if this is what you were looking for.&lt;/P&gt;

&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 01:18:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-additional-fields-to-the-end-of-timechart/m-p/473644#M133255</guid>
      <dc:creator>arjunpkishore5</dc:creator>
      <dc:date>2019-11-07T01:18:24Z</dc:date>
    </item>
  </channel>
</rss>

