<?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 How to get the dates which are not present in output for every ID? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-dates-which-are-not-present-in-output-for-every/m-p/200681#M58188</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have ID and dates in my output. (consider this is the data from 02-07-2016 to 02-10-2016)&lt;BR /&gt;
e.g&lt;BR /&gt;
ID  Ingestion_Date&lt;BR /&gt;
1   2-10-2016&lt;BR /&gt;
1   2-09-2016&lt;BR /&gt;
1   2-07-2016&lt;BR /&gt;
2   2-10-2016&lt;BR /&gt;
2   2-08-2016&lt;/P&gt;

&lt;P&gt;Now, I want to find the dates when these IDs did not get ingested. eg: Output should be:&lt;BR /&gt;
ID Ingestion_Date&lt;BR /&gt;
1   2-08-2016&lt;BR /&gt;
2   2-09-2016&lt;BR /&gt;
2   2-07-2016&lt;/P&gt;

&lt;P&gt;How can we achieve this Splunk?&lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Thu, 11 Feb 2016 00:34:59 GMT</pubDate>
    <dc:creator>shrutikale19</dc:creator>
    <dc:date>2016-02-11T00:34:59Z</dc:date>
    <item>
      <title>How to get the dates which are not present in output for every ID?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-dates-which-are-not-present-in-output-for-every/m-p/200681#M58188</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have ID and dates in my output. (consider this is the data from 02-07-2016 to 02-10-2016)&lt;BR /&gt;
e.g&lt;BR /&gt;
ID  Ingestion_Date&lt;BR /&gt;
1   2-10-2016&lt;BR /&gt;
1   2-09-2016&lt;BR /&gt;
1   2-07-2016&lt;BR /&gt;
2   2-10-2016&lt;BR /&gt;
2   2-08-2016&lt;/P&gt;

&lt;P&gt;Now, I want to find the dates when these IDs did not get ingested. eg: Output should be:&lt;BR /&gt;
ID Ingestion_Date&lt;BR /&gt;
1   2-08-2016&lt;BR /&gt;
2   2-09-2016&lt;BR /&gt;
2   2-07-2016&lt;/P&gt;

&lt;P&gt;How can we achieve this Splunk?&lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2016 00:34:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-dates-which-are-not-present-in-output-for-every/m-p/200681#M58188</guid>
      <dc:creator>shrutikale19</dc:creator>
      <dc:date>2016-02-11T00:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the dates which are not present in output for every ID?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-dates-which-are-not-present-in-output-for-every/m-p/200682#M58189</link>
      <description>&lt;P&gt;Is the date range fixed OR values for ID fixed??&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2016 02:39:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-dates-which-are-not-present-in-output-for-every/m-p/200682#M58189</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-02-11T02:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the dates which are not present in output for every ID?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-dates-which-are-not-present-in-output-for-every/m-p/200683#M58190</link>
      <description>&lt;P&gt;Date range will be passed to query from splunk input (dropdown) (mostly it wont exceed more than last 60-30 days) and values of IDs are coming from one table.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2016 16:39:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-dates-which-are-not-present-in-output-for-every/m-p/200683#M58190</guid>
      <dc:creator>shrutikale19</dc:creator>
      <dc:date>2016-02-11T16:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the dates which are not present in output for every ID?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-dates-which-are-not-present-in-output-for-every/m-p/200684#M58191</link>
      <description>&lt;P&gt;Assuming you're using timerange picker to select date range, try something like this (replace everything before &lt;CODE&gt;"| appendpipe"&lt;/CODE&gt; with your current search)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval temp="1,2-10-2016 1,2-09-2016 1,2-06-2016 2,2-10-2016 2,2-08-2016" | makemv temp | table temp | mvexpand temp | makemv temp delim="," | eval ID=mvindex(temp,0) | eval Ingestion_Date=mvindex(temp,-1) | fields - temp 
 | appendpipe [| stats count by ID | addinfo | eval Ingestion_Date=strftime(info_min_time,"%m-%d-%Y")." ".strftime(info_max_time,"%m-%d-%Y") | makemv Ingestion_Date | mvexpand Ingestion_Date | table ID Ingestion_Date  ]| eval ingestion_epoch=strptime(Ingestion_Date,"%m-%d-%Y") | sort 0 ID ingestion_epoch | streamstats current=f window=1 values(ingestion_epoch) as prev by ID | eval Missing=mvrange(prev+86400,ingestion_epoch,86400) | eval Missing=strftime(Missing,"%m-%d-%Y") | where isnotnull(Missing) | table ID Missing
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Optionally add &lt;CODE&gt;"| mvexpand Missing"&lt;/CODE&gt; in the end to get the Missing dates separate rows&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2016 17:20:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-dates-which-are-not-present-in-output-for-every/m-p/200684#M58191</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-02-11T17:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the dates which are not present in output for every ID?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-dates-which-are-not-present-in-output-for-every/m-p/200685#M58192</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I tried adding this in my query but i am not getting correct result.&lt;BR /&gt;
e.g consider i am running this for last 7 days ( from 4th Feb to 11th Feb), then for all the IDs I am getting missing dates as all the dates from 5th Feb-10th Feb.&lt;BR /&gt;
This is how it is working:&lt;BR /&gt;
 1. In the step where you are adding info_min_time and info_max_time, it is adding 4th Feb (min time) and 11th Feb (max time) for every ID.&lt;BR /&gt;
 2. In the step where you are finding ingestion_epoch, it is getting calculated only for the above dates (4th Feb and 11th Feb). For the rest of the dates, ingestion_epoch is coming blank.&lt;BR /&gt;
 3. In the sorting step, for every ID its sorting like this- 4th Feb, 11th Feb, other dates present for that ID (as ingestion_epoch is blank for them).&lt;BR /&gt;
 4. Then in the streamstats, i am getting previous result values like this-&amp;gt;&lt;BR /&gt;
 ID      ingestion_date      Prev&lt;BR /&gt;
1         4th Feb&lt;BR /&gt;&lt;BR /&gt;
1         11th Feb                4th Feb&lt;BR /&gt;
1         5th Feb                  11th Feb&lt;BR /&gt;
etc.&lt;BR /&gt;
 5. So, when mvrange function is used, its giving all the dates from (5th Feb-11th Feb) for the record with ID=1 and prev=4th Feb from the above table. &lt;BR /&gt;
 6. with where isnotnull(Missing), final result is only picking row from above and showing it as result.&lt;/P&gt;

&lt;P&gt;Please let me know where it is going wrong. &lt;/P&gt;

&lt;P&gt;Thanks again! &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:47:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-dates-which-are-not-present-in-output-for-every/m-p/200685#M58192</guid>
      <dc:creator>shrutikale19</dc:creator>
      <dc:date>2020-09-29T08:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the dates which are not present in output for every ID?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-dates-which-are-not-present-in-output-for-every/m-p/200686#M58193</link>
      <description>&lt;P&gt;Hi, &lt;BR /&gt;
I also tried running your query and it gives that ID 2 was not ingested only on 9th Feb. Though, as your time range starts from 6th Feb here, ideally it should show that, ID 2 was not ingested on 6th, 7th and 9th Feb. This is what I am trying to achieve here.&lt;BR /&gt;
Please let me know if you have any idea on how can we do this in Splunk.&lt;BR /&gt;
Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 00:15:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-dates-which-are-not-present-in-output-for-every/m-p/200686#M58193</guid>
      <dc:creator>shrutikale19</dc:creator>
      <dc:date>2016-02-12T00:15:29Z</dc:date>
    </item>
  </channel>
</rss>

