<?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: Trend analysis with joined input lookups in Monitoring Splunk</title>
    <link>https://community.splunk.com/t5/Monitoring-Splunk/Trend-analysis-with-joined-input-lookups/m-p/405568#M8112</link>
    <description>&lt;P&gt;Sorry @woodcock &lt;/P&gt;

&lt;P&gt;I was looking at this incorrectly inline with my dat and it does work and lovely stuff. I have another question in regards to trend date but ill raise a separate question for that&lt;/P&gt;</description>
    <pubDate>Wed, 07 Aug 2019 14:52:50 GMT</pubDate>
    <dc:creator>Sfry1981</dc:creator>
    <dc:date>2019-08-07T14:52:50Z</dc:date>
    <item>
      <title>Trend analysis with joined input lookups</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/Trend-analysis-with-joined-input-lookups/m-p/405562#M8106</link>
      <description>&lt;P&gt;I have a joined input lookup as per the below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| union
   [ inputlookup int_issue
| search reporter=test1 status!=closed status!=approved status!=cancelled labels!="*test2*" labels!="test3*" issuekey=zz* issuetype=test4 created &amp;gt; "2019-01-01 00:00:00"
| eval createddate=substr(created,1,10)
| where createddate&amp;gt;"2019-07-01 00:00:00.000"
| stats count as createticket by createddate]
   [ inputlookup int_case
   | search issue_url__c!=null if_parent_case__c="0" type!="Data Migration" type!="Implementation" io_system_area_1__c!="test2" io_system_area_1__c!="test2*" closeddate!=null
   | eval dateclosed=substr(closeddate,1,10)
   | where dateclosed&amp;gt;"2019-07-01 00:00:00.000"
   | stats count as closed by dateclosed
   | rename dateclosed as createddate]
| stats sum(createissue) sum(closed) by createddate
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;it pulls through like the below:&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/7396iE3ACBEE3CE4B8F00/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 calculate the difference each day&lt;/P&gt;

&lt;P&gt;Ive tried makeresults with no luck and even tried to add a simple | eval difference =  createissue - closed&lt;/P&gt;

&lt;P&gt;This doesnt work wither. I feel that the inputlookup does not work well with Splunks functions.&lt;/P&gt;

&lt;P&gt;What i would like to see is a line overlay that shows the difference between each day and its only a simple calculation of 1 field minus the second field.&lt;/P&gt;

&lt;P&gt;Any help appreciated &lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 15:29:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/Trend-analysis-with-joined-input-lookups/m-p/405562#M8106</guid>
      <dc:creator>Sfry1981</dc:creator>
      <dc:date>2019-07-24T15:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: Trend analysis with joined input lookups</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/Trend-analysis-with-joined-input-lookups/m-p/405563#M8107</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup int_issue
| search reporter=test1 status!=closed status!=approved status!=cancelled labels!="*test2*" labels!="test3*" issuekey=zz* issuetype=test4 created &amp;gt; "2019-01-01 00:00:00"
| eval createddate=substr(created,1,10)
| where createddate&amp;gt;"2019-07-01 00:00:00.000"
| eval which="int_issue"
| inputlookup append=true int_case
| search which="int_issue" OR (issue_url__c!=null if_parent_case__c="0" type!="Data Migration" type!="Implementation" io_system_area_1__c!="test2" io_system_area_1__c!="test2*" closeddate!=null)
| eval which=coalesce(which, "int_case")
| eval dateclosed=if(which="int_case", substr(closeddate,1,10), null())
| where which=="int_issue" OR dateclosed&amp;gt;"2019-07-01 00:00:00.000"
| eval createddate=if(which=="int_issue", createddate, dateclosed)
| stats count(eval(which="int_issue")) AS created count(eval(which="int_case")) AS closed BY createddate

| rename COMMENT AS "Everything above is an optimized version of what you already have; everything below is the new stuff"

|  reverse
|  streamstats current=f last(closed) AS prev_closed last(created) AS prev_created
|  reverse
|  foreach prev_* [ eval &amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt; = &amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt; - &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; |  fields - &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is a run-anywhere proof of concept:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_*
| bin _time span=1h 
|  rename _time AS createddate
|  stats count(eval(match(sourcetype, "splunkd"))) AS closed count AS created BY createddate
|  reverse
|  streamstats current=f last(closed) AS prev_closed last(created) AS prev_created
|  reverse
|  foreach prev_* [ eval &amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt; = &amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt; - &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; |  fields - &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 27 Jul 2019 16:44:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/Trend-analysis-with-joined-input-lookups/m-p/405563#M8107</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-27T16:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Trend analysis with joined input lookups</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/Trend-analysis-with-joined-input-lookups/m-p/405564#M8108</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/1406"&gt;@woodcock&lt;/a&gt; &lt;/P&gt;

&lt;P&gt;This is getting close but its not bringing back any created data. I might have got the last line wrong which is &lt;/P&gt;

&lt;P&gt;| foreach prev_* [eval difference = prev_created - prev_closed | fields - difference]&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;createddate created closed  prev_closed prev_created
1   2019-07-02  0   1   1   0
2   2019-07-03  0   1   4   0
3   2019-07-04  0   4   2   0
4   2019-07-05  0   2   4   0
5   2019-07-08  0   4   2   0
6   2019-07-09  0   2   4   0
7   2019-07-10  0   4   2   0
8   2019-07-11  0   2   2   0
9   2019-07-12  0   2   1   0
10  2019-07-14  0   1   2   0
11  2019-07-15  0   2   4   0
12  2019-07-16  0   4   9   0
13  2019-07-17  0   9   6   0
14  2019-07-18  0   6   7   0
15  2019-07-19  0   7   1   0
16  2019-07-22  0   1   3   0
17  2019-07-23  0   3   1   0
18  2019-07-24  0   1   1   0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:34:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/Trend-analysis-with-joined-input-lookups/m-p/405564#M8108</guid>
      <dc:creator>Sfry1981</dc:creator>
      <dc:date>2020-09-30T01:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: Trend analysis with joined input lookups</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/Trend-analysis-with-joined-input-lookups/m-p/405565#M8109</link>
      <description>&lt;P&gt;No, no, no.  The &lt;CODE&gt;foreach&lt;/CODE&gt; command is special and when I write &lt;CODE&gt;&amp;lt;&amp;lt;MATCSTR&amp;gt;&amp;gt;&lt;/CODE&gt; and &lt;CODE&gt;&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;&lt;/CODE&gt; I &lt;EM&gt;literally&lt;/EM&gt; mean to use those &lt;EM&gt;EXACT&lt;/EM&gt; strings (do not try to substitute in your field names).  Give it a try EXACTLY as I typed it.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Aug 2019 19:01:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/Trend-analysis-with-joined-input-lookups/m-p/405565#M8109</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-08-04T19:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Trend analysis with joined input lookups</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/Trend-analysis-with-joined-input-lookups/m-p/405566#M8110</link>
      <description>&lt;P&gt;Thanks @woodcock &lt;/P&gt;

&lt;P&gt;I see what you mean now as i have never used that method before. &lt;/P&gt;

&lt;P&gt;Its now bringing back figures for those dates but im trying to understand how it correlates with my original query i put above that gave me the sum of total open and closed. Im getting the below results from your query which do not seem to calculate correctly. Are you able to advise? &lt;/P&gt;

&lt;P&gt;Your awesome trend query&lt;BR /&gt;
Column createddate created closed&lt;BR /&gt;
2   2019-08-02  2   3&lt;BR /&gt;
3   2019-08-01  2   0&lt;BR /&gt;
4   2019-07-31  -2  -1&lt;/P&gt;

&lt;P&gt;but on the graph i have which shows created and closed its as the below:&lt;/P&gt;

&lt;P&gt;my original query&lt;BR /&gt;
column createddate sum(create) sum(closed)&lt;BR /&gt;
2   2019-08-02  2   5&lt;BR /&gt;
3   2019-08-01  3   5&lt;BR /&gt;
4   2019-07-31  1   4&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 07:20:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/Trend-analysis-with-joined-input-lookups/m-p/405566#M8110</guid>
      <dc:creator>Sfry1981</dc:creator>
      <dc:date>2019-08-05T07:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Trend analysis with joined input lookups</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/Trend-analysis-with-joined-input-lookups/m-p/405567#M8111</link>
      <description>&lt;P&gt;You are going to have to take a small subset of data and figure out which of us is right by doing the work by hand.  If I am wrong, then post your small subset of data here so that I can figure out where the problem is and I will double-check.  Keep in mind that I have tested my work on fake data and it gives the correct answer for me.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 14:29:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/Trend-analysis-with-joined-input-lookups/m-p/405567#M8111</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-08-05T14:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: Trend analysis with joined input lookups</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/Trend-analysis-with-joined-input-lookups/m-p/405568#M8112</link>
      <description>&lt;P&gt;Sorry @woodcock &lt;/P&gt;

&lt;P&gt;I was looking at this incorrectly inline with my dat and it does work and lovely stuff. I have another question in regards to trend date but ill raise a separate question for that&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 14:52:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/Trend-analysis-with-joined-input-lookups/m-p/405568#M8112</guid>
      <dc:creator>Sfry1981</dc:creator>
      <dc:date>2019-08-07T14:52:50Z</dc:date>
    </item>
  </channel>
</rss>

