<?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 Query should return last/latest available data when there is no data for the selected time range in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Query-should-return-last-latest-available-data-when-there-is-no/m-p/673738#M230670</link>
    <description>&lt;P&gt;Query should return last/latest available data when there is no data for the selected time range&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jan 2024 08:02:29 GMT</pubDate>
    <dc:creator>saichandjawari</dc:creator>
    <dc:date>2024-01-10T08:02:29Z</dc:date>
    <item>
      <title>Query should return last/latest available data when there is no data for the selected time range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-should-return-last-latest-available-data-when-there-is-no/m-p/673738#M230670</link>
      <description>&lt;P&gt;Query should return last/latest available data when there is no data for the selected time range&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 08:02:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-should-return-last-latest-available-data-when-there-is-no/m-p/673738#M230670</guid>
      <dc:creator>saichandjawari</dc:creator>
      <dc:date>2024-01-10T08:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: Query should return last/latest available data when there is no data for the selected time range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-should-return-last-latest-available-data-when-there-is-no/m-p/673750#M230674</link>
      <description>&lt;P&gt;Essentially, data is returned from the selected time range, if there is no data, what time range do you want to use?&lt;/P&gt;&lt;P&gt;You could do something like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your search&amp;gt;
| appendpipe
  [| stats count as _count
   | where _count = 0
   | where isnull(_count)
   | append
     [| search &amp;lt;your index&amp;gt; [| metasearch index=&amp;lt;your index&amp;gt; earliest=0
                             | head 1
                             | rename _time as earliest
                             | fields earliest]
      ]
   ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 09:37:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-should-return-last-latest-available-data-when-there-is-no/m-p/673750#M230674</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-01-10T09:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Query should return last/latest available data when there is no data for the selected time range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-should-return-last-latest-available-data-when-there-is-no/m-p/673752#M230675</link>
      <description>&lt;P&gt;The query is used in a dashboard panel as a statistical table with single row. &amp;nbsp;the data is usually &amp;nbsp;not available on regular intervals. Hence we would like to show the last available data instead of “no results found” when there is no data for the selected default time range that we have set.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 09:40:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-should-return-last-latest-available-data-when-there-is-no/m-p/673752#M230675</guid>
      <dc:creator>saichandjawari</dc:creator>
      <dc:date>2024-01-10T09:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Query should return last/latest available data when there is no data for the selected time range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-should-return-last-latest-available-data-when-there-is-no/m-p/673753#M230676</link>
      <description>&lt;P&gt;OK, so have you tried what I suggested?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 09:50:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-should-return-last-latest-available-data-when-there-is-no/m-p/673753#M230676</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-01-10T09:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: Query should return last/latest available data when there is no data for the selected time range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-should-return-last-latest-available-data-when-there-is-no/m-p/673777#M230681</link>
      <description>&lt;P&gt;Yes, but that isn’t working.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;So here is a solution that I came up with —&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Step 1 - first write your results to a lookup file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;your query&amp;gt; |outputlookup yourlookup.csv&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step 2 - use that lookup in the query as shown below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;your query&amp;gt; |append [|inputlookup yourlookup.csv&amp;nbsp;&lt;/P&gt;&lt;P&gt;|outputlookup yourlookup.csv override_if_empty = false create_empty = false]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the above query writes the results and stores in yourlookup.csv with wider time range. And &amp;nbsp;we are rewriting the stored results to the same lookupfile. In the last line override and Create_empty commands will make sure it will not give empty results.&amp;nbsp;&lt;BR /&gt;Note: use |dedup in the last if you see any duplicate results.&lt;/P&gt;&lt;P&gt;step 3- Create a saved search with this query and schedule it according to your requirement.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 12:23:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-should-return-last-latest-available-data-when-there-is-no/m-p/673777#M230681</guid>
      <dc:creator>saichandjawari</dc:creator>
      <dc:date>2024-01-10T12:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: Query should return last/latest available data when there is no data for the selected time range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-should-return-last-latest-available-data-when-there-is-no/m-p/673778#M230682</link>
      <description>&lt;P&gt;Thanks for your response.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 12:24:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-should-return-last-latest-available-data-when-there-is-no/m-p/673778#M230682</guid>
      <dc:creator>saichandjawari</dc:creator>
      <dc:date>2024-01-10T12:24:01Z</dc:date>
    </item>
  </channel>
</rss>

