<?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: Evaluating static field over time with Splunk values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Evaluating-static-field-over-time-with-Splunk-values/m-p/312002#M93469</link>
    <description>&lt;P&gt;it didn't update the fields with this way, however, it showed me how to accumulate diff and leaded me to solution. Thanks @somesoni2 , here is the answer SPL for reference. &lt;BR /&gt;
    ....&lt;BR /&gt;
| timechart span=1mon count(eval(openedtickets="Opened")) as Opened count(eval(closedtickets="Closed")) as Closed&lt;BR /&gt;
    | eval diff = Opened-Closed |  accum diff&lt;BR /&gt;
    | eval TicketFromLastYear=200&lt;BR /&gt;
    | eval TicketFromLastYear = TicketFromLastYear + diff |  fields - diff&lt;/P&gt;</description>
    <pubDate>Thu, 07 Sep 2017 14:57:35 GMT</pubDate>
    <dc:creator>akocak</dc:creator>
    <dc:date>2017-09-07T14:57:35Z</dc:date>
    <item>
      <title>Evaluating static field over time with Splunk values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Evaluating-static-field-over-time-with-Splunk-values/m-p/311996#M93463</link>
      <description>&lt;P&gt;Hi Splunkers, I have some data set with Ticket start and end times, I have created &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=x sourcetype=y
| eval opentickets=if(start&amp;gt;relative_time(now(),"@y"),"Opened","") 
| eval closetickets = if(end&amp;gt;relative_time(now(),"@y"),"Closed","") 
| bin _time span=1mon 
| eventstats count(eval(openticketstate="Opened")) as Opened count(eval(closeticketstat="Closed")) as Closed by _time 
| eval diff = Opened-Closed
| timechart values(Closed) as Closed values(Opened) as Opened
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which gives me a nice table of:&lt;BR /&gt;
_time,Closed,Opened&lt;BR /&gt;
2017-01,108,1&lt;BR /&gt;
2017-02,27,7&lt;BR /&gt;
2017-03,    86,64&lt;BR /&gt;
2017-04,38,33&lt;/P&gt;

&lt;P&gt;Question is I have a static number from last year and I need another column TotalOpenTickets that updates this number along with the timechart. So every month, it needs to get previous months TotalOpenTickets count, add Opened count substitute Closed count. My goal is to get the result set of ( let's say static TotalOpenTickets is 200) similar to:&lt;BR /&gt;
_time,      Closed,         Opened,      TotalOpenTickets&lt;BR /&gt;
2017-01   ,108                 ,1               ,93&lt;BR /&gt;
2017-02   ,27                   ,7               ,73&lt;BR /&gt;
2017-03   ,86                  ,66              ,53&lt;BR /&gt;
2017-04   ,38                  ,58              ,73&lt;/P&gt;

&lt;P&gt;I hope I explained well. Thanks for reading. &lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 21:55:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Evaluating-static-field-over-time-with-Splunk-values/m-p/311996#M93463</guid>
      <dc:creator>akocak</dc:creator>
      <dc:date>2017-08-31T21:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluating static field over time with Splunk values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Evaluating-static-field-over-time-with-Splunk-values/m-p/311997#M93464</link>
      <description>&lt;P&gt;Is this in another source or is it a field in this source? Is it a lookup? You could do a &lt;CODE&gt;join _time [dataset|timechart values(TotalOpenTickets) as TotalOpenTickets ]&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 23:53:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Evaluating-static-field-over-time-with-Splunk-values/m-p/311997#M93464</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-08-31T23:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluating static field over time with Splunk values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Evaluating-static-field-over-time-with-Splunk-values/m-p/311998#M93465</link>
      <description>&lt;P&gt;it is a number that I need to hard-code, not from other data sets. I need to add it like&lt;BR /&gt;
| eval mnumber= 200, &lt;BR /&gt;
like it needs to get into dataset by January. and keep updated with the data set as&lt;BR /&gt;
mnumber = mnumber + opened - closed&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2017 14:09:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Evaluating-static-field-over-time-with-Splunk-values/m-p/311998#M93465</guid>
      <dc:creator>akocak</dc:creator>
      <dc:date>2017-09-01T14:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluating static field over time with Splunk values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Evaluating-static-field-over-time-with-Splunk-values/m-p/311999#M93466</link>
      <description>&lt;P&gt;Oh I see. Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval TotalOpenCases=if(_time=1483228800,200-Closed+Opened,null())
|streamstats window=1 current=f  values(TotalOpenCases) as LMopencases
|eval TotalOpenCases=if(isnull(TotalOpenCases),LMopencases-Closed+Opened,TotalOpenCases)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Sep 2017 14:29:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Evaluating-static-field-over-time-with-Splunk-values/m-p/311999#M93466</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-09-01T14:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluating static field over time with Splunk values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Evaluating-static-field-over-time-with-Splunk-values/m-p/312000#M93467</link>
      <description>&lt;P&gt;it is not adding anything as below:&lt;BR /&gt;
|eventstats count(eval(openticketstate="Opened")) as Opened count(eval(closeticketstat="Closed")) as Closed by _time &lt;/P&gt;

&lt;P&gt;|eval TotalOpenCases=if(_time=1483228800,200-Closed+Opened,null())&lt;BR /&gt;
 |streamstats window=1 current=f  values(TotalOpenCases) as LMopencases&lt;BR /&gt;
 |eval TotalOpenCases=if(isnull(TotalOpenCases),LMopencases-Closed+Opened,TotalOpenCases)&lt;/P&gt;

&lt;P&gt;| timechart values(Closed) as Closed values(Opened) as Opened values(TotalOpenCases)&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2017 16:31:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Evaluating-static-field-over-time-with-Splunk-values/m-p/312000#M93467</guid>
      <dc:creator>akocak</dc:creator>
      <dc:date>2017-09-01T16:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluating static field over time with Splunk values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Evaluating-static-field-over-time-with-Splunk-values/m-p/312001#M93468</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=x sourcetype=y
 | eval opentickets=if(start&amp;gt;relative_time(now(),"@y"),"Opened","") 
 | eval closetickets = if(end&amp;gt;relative_time(now(),"@y"),"Closed","") 
 | timechart span=1mon count by openticketstate
 | eval diff = Opened-Closed
 | accum diff
 | appendcols [search query to get count from last year, this will get added to row1| table TotalOpenTickets ]
 | eval TotalOpenTickets =TotalOpenTickets + diff | fields - diff
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Sep 2017 16:52:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Evaluating-static-field-over-time-with-Splunk-values/m-p/312001#M93468</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-09-01T16:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluating static field over time with Splunk values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Evaluating-static-field-over-time-with-Splunk-values/m-p/312002#M93469</link>
      <description>&lt;P&gt;it didn't update the fields with this way, however, it showed me how to accumulate diff and leaded me to solution. Thanks @somesoni2 , here is the answer SPL for reference. &lt;BR /&gt;
    ....&lt;BR /&gt;
| timechart span=1mon count(eval(openedtickets="Opened")) as Opened count(eval(closedtickets="Closed")) as Closed&lt;BR /&gt;
    | eval diff = Opened-Closed |  accum diff&lt;BR /&gt;
    | eval TicketFromLastYear=200&lt;BR /&gt;
    | eval TicketFromLastYear = TicketFromLastYear + diff |  fields - diff&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 14:57:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Evaluating-static-field-over-time-with-Splunk-values/m-p/312002#M93469</guid>
      <dc:creator>akocak</dc:creator>
      <dc:date>2017-09-07T14:57:35Z</dc:date>
    </item>
  </channel>
</rss>

