<?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 single value trend with earliest in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367811#M165248</link>
    <description>&lt;P&gt;I've got the followingsearch:&lt;/P&gt;

&lt;P&gt;| stats values earliest(AG_Z) AS A_Z values earliest(D_AG) AS D_A_I &lt;BR /&gt;
| eval eA_Z=strptime(A_Z,"%Y-%m-%d %H:%M:%S.%N") &lt;BR /&gt;
| eval eD_A_I=coalesce(strptime(D_A_I, "%Y-%m-%d %H:%M:%S.%N"),now()) &lt;BR /&gt;
| eval G_w=floor((eD_A_I-eA_Z)/86400) &lt;BR /&gt;
| search G_w &amp;gt; 14 &lt;BR /&gt;
| timechart span=1w avg(G_w) As GDA&lt;/P&gt;

&lt;P&gt;Somehow this does not give any results, when ik remove the first line &lt;BR /&gt;
(| stats values earliest(AG_Z) AS A_Z values earliest(D_AG) AS D_A_I )&lt;BR /&gt;
It does, but i need to use the earliest dates. How can i fix this so i use the earliest dates and generate a single value with trend?&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 16:46:22 GMT</pubDate>
    <dc:creator>Mike6960</dc:creator>
    <dc:date>2020-09-29T16:46:22Z</dc:date>
    <item>
      <title>single value trend with earliest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367811#M165248</link>
      <description>&lt;P&gt;I've got the followingsearch:&lt;/P&gt;

&lt;P&gt;| stats values earliest(AG_Z) AS A_Z values earliest(D_AG) AS D_A_I &lt;BR /&gt;
| eval eA_Z=strptime(A_Z,"%Y-%m-%d %H:%M:%S.%N") &lt;BR /&gt;
| eval eD_A_I=coalesce(strptime(D_A_I, "%Y-%m-%d %H:%M:%S.%N"),now()) &lt;BR /&gt;
| eval G_w=floor((eD_A_I-eA_Z)/86400) &lt;BR /&gt;
| search G_w &amp;gt; 14 &lt;BR /&gt;
| timechart span=1w avg(G_w) As GDA&lt;/P&gt;

&lt;P&gt;Somehow this does not give any results, when ik remove the first line &lt;BR /&gt;
(| stats values earliest(AG_Z) AS A_Z values earliest(D_AG) AS D_A_I )&lt;BR /&gt;
It does, but i need to use the earliest dates. How can i fix this so i use the earliest dates and generate a single value with trend?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:46:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367811#M165248</guid>
      <dc:creator>Mike6960</dc:creator>
      <dc:date>2020-09-29T16:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: single value trend with earliest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367812#M165249</link>
      <description>&lt;P&gt;Hi Mike6960,&lt;BR /&gt;
what's the meaning of the "values" word in the first line?&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 10:48:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367812#M165249</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-11-13T10:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: single value trend with earliest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367813#M165250</link>
      <description>&lt;P&gt;Got this from you, &lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/585581/how-to-calculate-the-days-between-earliest-date-an.html"&gt;https://answers.splunk.com/answers/585581/how-to-calculate-the-days-between-earliest-date-an.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 10:57:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367813#M165250</guid>
      <dc:creator>Mike6960</dc:creator>
      <dc:date>2017-11-13T10:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: single value trend with earliest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367814#M165251</link>
      <description>&lt;P&gt;There are two problems:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;the two "values" word in the first line,&lt;/LI&gt;
&lt;LI&gt;timechart command runs using _time that you havent after your first line&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;For the first problem you have to delete the "values" words.&lt;BR /&gt;
For the second, if  you want to plot a graphic by A_Z or D_A_I, you can use the chart command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| bin span=1w A_Z
| chart avg(G_w) As GDA BY A_Z
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:42:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367814#M165251</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-29T16:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: single value trend with earliest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367815#M165252</link>
      <description>&lt;P&gt;in the above answer there was  &lt;CODE&gt;values(D_A) AS D_A&lt;/CODE&gt; not only &lt;CODE&gt;values&lt;/CODE&gt;&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 11:05:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367815#M165252</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-11-13T11:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: single value trend with earliest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367816#M165253</link>
      <description>&lt;P&gt;But if I use Chart, i cannot use a single value withe trendline....&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 11:09:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367816#M165253</guid>
      <dc:creator>Mike6960</dc:creator>
      <dc:date>2017-11-13T11:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: single value trend with earliest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367817#M165254</link>
      <description>&lt;P&gt;To use timechart you need to have _time, so bring it in the first stats&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats earliest(_time) AS _time earliest(AG_Z) AS A_Z earliest(D_AG) AS D_A_I 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or otherwise if you want to plot your trend by A_Z add an eval command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval _time=strptime(A_Z,"%Y-%m-%d %H:%M:%S.%N") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in other words&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats earliest(_time) AS _time earliest(AG_Z) AS A_Z earliest(D_AG) AS D_A_I 
| eval 
     eA_Z=strptime(A_Z,"%Y-%m-%d %H:%M:%S.%N"), 
     eD_A_I=coalesce(strptime(D_A_I, "%Y-%m-%d %H:%M:%S.%N"),now()),
     G_w=floor((eD_A_I-eA_Z)/86400) 
| search G_w &amp;gt; 14 
| timechart span=1w avg(G_w) AS GDA
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats earliest(AG_Z) AS A_Z earliest(D_AG) AS D_A_I 
| eval 
     eA_Z=strptime(A_Z,"%Y-%m-%d %H:%M:%S.%N"), 
     eD_A_I=coalesce(strptime(D_A_I, "%Y-%m-%d %H:%M:%S.%N"),now()),
     G_w=floor((eD_A_I-eA_Z)/86400),
     _time=strptime(A_Z,"%Y-%m-%d %H:%M:%S.%N") 
| search G_w &amp;gt; 14 
| timechart span=1w avg(G_w) AS GDA
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 11:16:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367817#M165254</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-11-13T11:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: single value trend with earliest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367818#M165255</link>
      <description>&lt;P&gt;In your first line _time does not really do anything, correct? I want to plot by G_w so then i use;&lt;/P&gt;

&lt;P&gt;| stats earliest(_time) AS _time earliest(AG_Z) AS A_Z earliest(D_AG) AS D_A_I &lt;BR /&gt;
 | eval &lt;BR /&gt;
      eA_Z=strptime(A_Z,"%Y-%m-%d %H:%M:%S.%N"), &lt;BR /&gt;
      eD_A_I=coalesce(strptime(D_A_I, "%Y-%m-%d %H:%M:%S.%N"),now()),&lt;BR /&gt;
      G_w=floor((eD_A_I-eA_Z)/86400) &lt;BR /&gt;
 | search G_w &amp;gt; 14 &lt;BR /&gt;
 | timechart span=1w avg(G_w) AS GDA&lt;BR /&gt;
? Strange thing is that i have searches with timechart without the  _time&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:46:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367818#M165255</guid>
      <dc:creator>Mike6960</dc:creator>
      <dc:date>2020-09-29T16:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: single value trend with earliest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367819#M165256</link>
      <description>&lt;P&gt;No, it's only reported to be used below.&lt;BR /&gt;
Use earliest or latest to have only one value.&lt;BR /&gt;
About "searches with timechart without the _time", check them, maybe it's not highlighted, but it must be present.&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 11:39:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367819#M165256</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-11-13T11:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: single value trend with earliest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367820#M165257</link>
      <description>&lt;P&gt;unfortunately i cant get it working. I used ;&lt;/P&gt;

&lt;P&gt;| stats earliest(_time) AS _time earliest(AG_Z) AS A_Z earliest(D_AG) AS D_A_I &lt;BR /&gt;
 | eval &lt;BR /&gt;
      eA_Z=strptime(A_Z,"%Y-%m-%d %H:%M:%S.%N"), &lt;BR /&gt;
      eD_A_I=coalesce(strptime(D_A_I, "%Y-%m-%d %H:%M:%S.%N"),now()),&lt;BR /&gt;
      G_w=floor((eD_A_I-eA_Z)/86400) &lt;BR /&gt;
 | search G_w &amp;gt; 14 &lt;BR /&gt;
 | timechart span=1w avg(G_w) AS GDA&lt;/P&gt;

&lt;P&gt;I get only one value and no trend. You say _time is only reported to use below, but below i dont see _time back?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:46:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367820#M165257</guid>
      <dc:creator>Mike6960</dc:creator>
      <dc:date>2020-09-29T16:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: single value trend with earliest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367821#M165258</link>
      <description>&lt;P&gt;below you use _time only in timechart.&lt;BR /&gt;
probably all your events have the same or near _time, did you tried with a different time span?&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 12:04:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367821#M165258</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-11-13T12:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: single value trend with earliest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367822#M165259</link>
      <description>&lt;P&gt;But i dont want to plot on the eventtime, i want to plot on the dates mentioned in the events. In this case eA_Z and eD_A_I. This reults in a number of days: G_w. which i want to plot. Still, if   use my own search it workts without adding _time, this is something i don't understand:&lt;/P&gt;

&lt;P&gt;| eval eA_Z=strptime(A_Z,"%Y-%m-%d %H:%M:%S.%N")&lt;BR /&gt;
| eval eD_A_I=coalesce(strptime(D_A_I, "%Y-%m-%d %H:%M:%S.%N"),now())&lt;BR /&gt;
| eval G_w=floor((eD_A_I-eA_Z)/86400)&lt;BR /&gt;
| search G_w &amp;gt; 14&lt;BR /&gt;
| timechart span=1w avg(G_w) As GDA&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:46:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367822#M165259</guid>
      <dc:creator>Mike6960</dc:creator>
      <dc:date>2020-09-29T16:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: single value trend with earliest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367823#M165260</link>
      <description>&lt;P&gt;if you don't use the fist line stats, you don't mention _time, but the important thing is that you still have it, instead after stats command you have only the mentioned fields, the other are lost for this search.&lt;/P&gt;

&lt;P&gt;To plot using the dates mentioned in the event you have to use chart instead timechart, but you haven't trend because you havent _time.&lt;/P&gt;

&lt;P&gt;Did you tried my second suggestion: to pass _time as an elaboration of one of the dates mentioned in the event?&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 12:31:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367823#M165260</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-11-13T12:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: single value trend with earliest</title>
      <link>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367824#M165261</link>
      <description>&lt;P&gt;Yes, i tried that to, also all kind of different time spans. My events are getting in since the beginning of october through by an insert once every day, so _time is different in the events. Somehow i either dont get a trend or i get only data from one date (the earliest)&lt;BR /&gt;
I think i will give up on this one.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 07:27:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/single-value-trend-with-earliest/m-p/367824#M165261</guid>
      <dc:creator>Mike6960</dc:creator>
      <dc:date>2017-11-14T07:27:52Z</dc:date>
    </item>
  </channel>
</rss>

