<?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: Time from a search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Time-from-a-search/m-p/545367#M154456</link>
    <description>&lt;P&gt;Hmm, so you basically want to switch the Status.&lt;BR /&gt;Could this be enough? Add it below your current SPL:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval status=if(status="DOWN", "UP", "DOWN")&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Or you change the logic already when you assign either DOWN or UP.&lt;BR /&gt;&lt;BR /&gt;After that you can filter to see only the DOWN ones with&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where status="DOWN"&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Hope I got your requirement correct.&lt;BR /&gt;&lt;BR /&gt;BR&lt;BR /&gt;Ralph&lt;/P&gt;</description>
    <pubDate>Thu, 25 Mar 2021 12:07:32 GMT</pubDate>
    <dc:creator>rnowitzki</dc:creator>
    <dc:date>2021-03-25T12:07:32Z</dc:date>
    <item>
      <title>Time from a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-from-a-search/m-p/544911#M154306</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have a query like below.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;index="abc" host=xxx&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;| eval Indicator=if(state=="RUNNING", "10", "0") &lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;| timechart span=5min min(Indicator) as "Trend"&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;and it will give me results like below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mariamathewtel_0-1616499504492.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/13443i1A89C94D8F1CB94B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mariamathewtel_0-1616499504492.png" alt="mariamathewtel_0-1616499504492.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I am trying to get the time(_time) value when there is a change in the value of Trend happens.&lt;/P&gt;&lt;P&gt;eg myTime =&amp;nbsp;2021-03-18 16:55:00&amp;nbsp; &amp;nbsp; (When trend changes from 10 to 0)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; myTime = 2021-03-18 17:25:00 &amp;nbsp; &amp;nbsp; (When trend changes from 0 to 10)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please help me do it. Would really appreciate if someone can help with the difference between these times also.&amp;nbsp;&lt;/P&gt;&lt;P&gt;myTime =&amp;nbsp;2021-03-18 16:55:00&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;myTime = 2021-03-18 17:25:00 &amp;nbsp; &amp;nbsp; Difference = 30 minutes&lt;/P&gt;</description>
      <pubDate>Tue, 23 Mar 2021 11:43:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-from-a-search/m-p/544911#M154306</guid>
      <dc:creator>mariamathewtel</dc:creator>
      <dc:date>2021-03-23T11:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: Time from a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-from-a-search/m-p/545099#M154358</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/34184"&gt;@mariamathewtel&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Try this SPL after your search that populates the table shown in the Screenshot:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| streamstats current=f window=1 last(Trend) as prev_trend
| eval trendchange=if(Trend!=prev_trend,"true", "false")
| where trendchange="true"
| streamstats current=f window=1 last(_time) as prev_time
| eval gap=tostring(_time-prev_time, "Duration")
| convert ctime(prev_time)&lt;/LI-CODE&gt;&lt;P&gt;It will give you only the line where a change in Trend happened, including the gap since the last change took place.&lt;BR /&gt;&lt;BR /&gt;Remove the line with "where" to see the whole list, I was not sure if you wanted to filter the ones without change or not.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;BR&lt;BR /&gt;Ralph&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 11:22:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-from-a-search/m-p/545099#M154358</guid>
      <dc:creator>rnowitzki</dc:creator>
      <dc:date>2021-03-24T11:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Time from a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-from-a-search/m-p/545102#M154361</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/34184"&gt;@mariamathewtel&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;You can use the &lt;STRONG&gt;delta&lt;/STRONG&gt; command to identify the event where the Trend value is changed and also to calculate the duration. Try this,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="abc" host=xxx 
| eval Indicator=if(state=="RUNNING", "10", "0")
| timechart span=5min min(Indicator) as "Trend
| delta Trend as diff 
| where diff!=0 
| delta _time AS Duration
| eval Duration=tostring(abs(Duration), "duration")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this reply helps you, an upvote/like would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 11:48:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-from-a-search/m-p/545102#M154361</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2021-03-24T11:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Time from a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-from-a-search/m-p/545282#M154420</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/129090"&gt;@manjunathmeti&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;this works just fine. exactly what i needed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 07:24:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-from-a-search/m-p/545282#M154420</guid>
      <dc:creator>mariamathewtel</dc:creator>
      <dc:date>2021-03-25T07:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Time from a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-from-a-search/m-p/545285#M154421</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/64317"&gt;@rnowitzki&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;This also works as required. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for the help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 07:28:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-from-a-search/m-p/545285#M154421</guid>
      <dc:creator>mariamathewtel</dc:creator>
      <dc:date>2021-03-25T07:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Time from a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-from-a-search/m-p/545343#M154445</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/129090"&gt;@manjunathmeti&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/64317"&gt;@rnowitzki&lt;/a&gt;&amp;nbsp;, need one more help&amp;nbsp;&lt;/P&gt;&lt;P&gt;query works well and m getting the correct duration.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mariamathewtel_0-1616669206011.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/13483iF59908DD9E7E33D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mariamathewtel_0-1616669206011.png" alt="mariamathewtel_0-1616669206011.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;here as you can see the duration is getting updated to the row when the Trend is 10(UP). i want it to be attached to the row where trend is 0(DOWN) so that i can display the downtime properly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like below&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mariamathewtel_1-1616669643005.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/13484i16717D6FAFA274F4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mariamathewtel_1-1616669643005.png" alt="mariamathewtel_1-1616669643005.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So that it can be displayed like below in a dashboard. (Only Downtime)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mariamathewtel_2-1616669699490.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/13485iFD5B78E30E4EE381/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mariamathewtel_2-1616669699490.png" alt="mariamathewtel_2-1616669699490.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 10:55:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-from-a-search/m-p/545343#M154445</guid>
      <dc:creator>mariamathewtel</dc:creator>
      <dc:date>2021-03-25T10:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Time from a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-from-a-search/m-p/545367#M154456</link>
      <description>&lt;P&gt;Hmm, so you basically want to switch the Status.&lt;BR /&gt;Could this be enough? Add it below your current SPL:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval status=if(status="DOWN", "UP", "DOWN")&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Or you change the logic already when you assign either DOWN or UP.&lt;BR /&gt;&lt;BR /&gt;After that you can filter to see only the DOWN ones with&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where status="DOWN"&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Hope I got your requirement correct.&lt;BR /&gt;&lt;BR /&gt;BR&lt;BR /&gt;Ralph&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 12:07:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-from-a-search/m-p/545367#M154456</guid>
      <dc:creator>rnowitzki</dc:creator>
      <dc:date>2021-03-25T12:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: Time from a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-from-a-search/m-p/545389#M154468</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/34184"&gt;@mariamathewtel&lt;/a&gt;,&lt;BR /&gt;You can use &lt;STRONG&gt;autoregress&lt;/STRONG&gt; to move Duration values to one row up. Try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="abc" host=xxx 
| eval Indicator=if(state=="RUNNING", "10", "0")
| timechart span=5min min(Indicator) as "Trend
| delta Trend as diff 
| where diff!=0 
| delta _time AS Duration
| eval Duration=tostring(abs(Duration), "duration")
| reverse
| autoregress Duration as Duration1
| reverse 
| rename Duration1 as Duration&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this reply helps you, a like would be appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 13:31:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-from-a-search/m-p/545389#M154468</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2021-03-25T13:31:20Z</dc:date>
    </item>
  </channel>
</rss>

