<?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 find the missing number sequence from a table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-missing-number-sequence-from-a-table/m-p/433587#M123778</link>
    <description>&lt;P&gt;For eg: i am having the following table after search in splunk&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;IDS          Time
  1                30
  3                15
  4                05
  6                10
  7                08     
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How to find the missing IDS 2,5 in a separate table.&lt;BR /&gt;&lt;BR /&gt;
NOTE: These IDS 2,5 are not present in logs. whatever present in logs is displayed in the table.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jul 2018 09:10:23 GMT</pubDate>
    <dc:creator>rajeswarir</dc:creator>
    <dc:date>2018-07-10T09:10:23Z</dc:date>
    <item>
      <title>How to find the missing number sequence from a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-missing-number-sequence-from-a-table/m-p/433587#M123778</link>
      <description>&lt;P&gt;For eg: i am having the following table after search in splunk&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;IDS          Time
  1                30
  3                15
  4                05
  6                10
  7                08     
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How to find the missing IDS 2,5 in a separate table.&lt;BR /&gt;&lt;BR /&gt;
NOTE: These IDS 2,5 are not present in logs. whatever present in logs is displayed in the table.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 09:10:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-missing-number-sequence-from-a-table/m-p/433587#M123778</guid>
      <dc:creator>rajeswarir</dc:creator>
      <dc:date>2018-07-10T09:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the missing number sequence from a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-missing-number-sequence-from-a-table/m-p/433588#M123779</link>
      <description>&lt;P&gt;I am currently using excel to get the missing number sequence. Is it possible to get in splunk the missing number sequence of IDS and display in different table.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 11:05:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-missing-number-sequence-from-a-table/m-p/433588#M123779</guid>
      <dc:creator>rajeswarir</dc:creator>
      <dc:date>2018-07-10T11:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the missing number sequence from a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-missing-number-sequence-from-a-table/m-p/433589#M123780</link>
      <description>&lt;P&gt;@rajeswarir, try the following run anywhere search. Query from &lt;CODE&gt;| makeresults&lt;/CODE&gt; till &lt;CODE&gt;| mvexpand IDS&lt;/CODE&gt; generate dummy data as per your question.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| fields - _time
| eval IDS="1,3,4,6,7,8"
| makemv IDS delim=","
| mvexpand IDS
| stats max(IDS) as maxID values(IDS) as IDS
| eval allIDs=mvrange(1,maxID+1)
| fields - maxID
| nomv IDS
| eval IDS=replace(IDS,"\s",",")
| mvexpand allIDs
| eval is_found=if(match(IDS,allIDs),1,0)
| search is_found=0
| table allIDs
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Jul 2018 11:45:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-missing-number-sequence-from-a-table/m-p/433589#M123780</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-07-10T11:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the missing number sequence from a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-missing-number-sequence-from-a-table/m-p/433590#M123781</link>
      <description>&lt;P&gt;Same answer but a bit more robust with negative numbers and numbers (&amp;gt;10)  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | makeresults | fields - _time | eval IDS="-4,3,4,6,7,13" | makemv IDS delim="," | mvexpand IDS
 | stats max(IDS) as maxID  min(IDS) as minID values(IDS) as IDS
 | eval allIDs=mvrange(minID,maxID+1)
 | fields - minID maxID
 | nomv IDS
 | eval IDS=replace(IDS,"^|\s|$",",")
 | mvexpand allIDs
 | eval is_found=if(match(IDS,",".allIDs.","),1,0)
 | search is_found=0
 | table allIDs
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Jul 2018 21:40:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-missing-number-sequence-from-a-table/m-p/433590#M123781</guid>
      <dc:creator>FloSwiip</dc:creator>
      <dc:date>2018-07-11T21:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the missing number sequence from a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-missing-number-sequence-from-a-table/m-p/433591#M123782</link>
      <description>&lt;P&gt;also in 7.0.X the part that is working in 7.1.X...&lt;BR /&gt;
| eval IDS=replace(IDS,"^|\s|$",",")&lt;BR /&gt;
have to be &lt;BR /&gt;
| eval IDS=replace(IDS,"\s",",") | eval IDS=",".IDS.","&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 07:40:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-missing-number-sequence-from-a-table/m-p/433591#M123782</guid>
      <dc:creator>FloSwiip</dc:creator>
      <dc:date>2018-07-12T07:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the missing number sequence from a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-missing-number-sequence-from-a-table/m-p/433592#M123783</link>
      <description>&lt;P&gt;This query is giving me the expected result for the above example that i have posted. But what if the IDS are more than 1lakhs and that contains missing IDS in between? is there a way to calculate for more than 1lakh records the missing values?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 12:26:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-missing-number-sequence-from-a-table/m-p/433592#M123783</guid>
      <dc:creator>rajeswarir</dc:creator>
      <dc:date>2018-07-12T12:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the missing number sequence from a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-missing-number-sequence-from-a-table/m-p/433593#M123784</link>
      <description>&lt;P&gt;This is just an example i have posted. But i need to get the missing Ids of more than 3lakh records. so how can i get the missing IDS for the particular source.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 04:34:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-missing-number-sequence-from-a-table/m-p/433593#M123784</guid>
      <dc:creator>rajeswarir</dc:creator>
      <dc:date>2018-07-13T04:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the missing number sequence from a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-missing-number-sequence-from-a-table/m-p/520866#M146728</link>
      <description>&lt;P&gt;This is an old topic, but I took the answer posted by &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/188825"&gt;@FloSwiip&lt;/a&gt;&amp;nbsp;combined with&amp;nbsp;&lt;A href="https://community.splunk.com/t5/Splunk-Search/search-to-find-gaps-in-data/td-p/68644" target="_blank"&gt;https://community.splunk.com/t5/Splunk-Search/search-to-find-gaps-in-data/td-p/68644&lt;/A&gt;&amp;nbsp;and came up with this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| fields - _time 
| eval IDS="-7,-4,3,4,6,7,13" 
| makemv IDS delim="," 
| mvexpand IDS 
| sort 0 IDS
| streamstats current=f last(IDS) as last_id
| eval gap=IDS-last_id
| where gap&amp;gt;1
| eval allIDs=mvrange(last_id,IDS)
| mvexpand allIDs
| eval is_found=if(match(allIDs,last_id),1,0)
| where is_found=0
| table allIDs&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data generation is up through mvexpand - you can take the rest after that to apply to your own data.&lt;/P&gt;&lt;P&gt;This works with a much larger data set that would otherwise run into memory limits when using mvexpand on "allIDs".&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 13:53:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-missing-number-sequence-from-a-table/m-p/520866#M146728</guid>
      <dc:creator>jlemley</dc:creator>
      <dc:date>2020-09-22T13:53:56Z</dc:date>
    </item>
  </channel>
</rss>

