<?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: dbinspect query help in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/dbinspect-query-help/m-p/449806#M127358</link>
    <description>&lt;P&gt;This query is going to be super slow going about it from a DB inspect way. &lt;BR /&gt;
Make sure to set the time for this greater than your cold storage typical data age. &lt;BR /&gt;
It's a 3 step join to make the table look nice. This would be something to put as a report. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| dbinspect index=* timeformat=%s 
| search state=hot 
| stats max(modTime) as recentHot min(modTime) as oldestHot count as hotbuckets max(endEpoch) as hotearliestEvent min(startEpoch) as hotoldestEvent by index 
| join index 
    [| dbinspect index=* timeformat=%s 
    | search state=warm 
    | stats max(modTime) as recentwarm min(modTime) as oldestwarm count as warmbuckets max(endEpoch) as warmearliestEvent min(startEpoch) as warmoldestEvent by index ] 
| join index 
    [| dbinspect index=* timeformat=%s 
    | search state=cold 
    | stats max(modTime) as recentcold min(modTime) as oldestcold count as coldbuckets max(endEpoch) as coldearliestEvent min(startEpoch) as coldoldestEvent by index ] 
| eval maxAgeHot=tostring((recentHot-oldestHot), "duration") 
| eval maxAgeWarm=tostring((recentwarm-oldestwarm), "duration") 
| eval maxIndexedEventAgeHot=tostring((hotearliestEvent-hotoldestEvent), "duration") 
| eval maxIndexedEventAgeWarm=tostring((warmearliestEvent-warmoldestEvent), "duration") 
| convert ctime(hotoldestEvent) 
| convert ctime(hotearliestEvent) 
| convert ctime(warmearliestEvent) 
| convert ctime(warmoldestEvent) 
| convert ctime(oldestcold) 
| convert ctime(recentcold) 
| convert ctime(recentwarm) 
| convert ctime(oldestwarm) 
| convert ctime(recentHot) 
| convert ctime(oldestHot) 
| sort -index 
| table index,hotbuckets,warmbuckets,coldbuckets,maxIndexedEventAgeHot,maxIndexedEventAgeWarm, maxAgeHot,maxAgeWarm,recentHot ,oldestHot ,oldestwarm ,recentwarm recentcold ,oldestcold,hotoldestEvent,hotearliestEvent,warmearliestEvent,warmoldestEvent
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 01 May 2019 15:46:32 GMT</pubDate>
    <dc:creator>Bselberg</dc:creator>
    <dc:date>2019-05-01T15:46:32Z</dc:date>
    <item>
      <title>dbinspect query help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/dbinspect-query-help/m-p/449805#M127357</link>
      <description>&lt;P&gt;I'm trying to write a dbinspect query to calculate the # of days of data that is stored in our hot/warm storage partition and our cold storage partition, for each index.  So for example trying to get results like this:&lt;/P&gt;

&lt;P&gt;Index, Hot/Warm Days, Cold Days&lt;BR /&gt;
_internal, 10, 80&lt;BR /&gt;
os, 12, 78&lt;BR /&gt;
etc.&lt;/P&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;P&gt;Index, Hot/Warm Earliest Time, Cold Earliest Time&lt;BR /&gt;
_internal, %Y %m %d, %H:%M:%S, %Y %m %d, %H:%M:%S&lt;BR /&gt;
os, %Y %m %d, %H:%M:%S, %Y %m %d, %H:%M:%S&lt;BR /&gt;
etc.&lt;/P&gt;

&lt;P&gt;Can anyone help me figure out how to do this with dbinspect?&lt;/P&gt;

&lt;P&gt;thanks,&lt;BR /&gt;
Marcel&lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2018 15:41:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/dbinspect-query-help/m-p/449805#M127357</guid>
      <dc:creator>mschlapfer</dc:creator>
      <dc:date>2018-10-30T15:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: dbinspect query help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/dbinspect-query-help/m-p/449806#M127358</link>
      <description>&lt;P&gt;This query is going to be super slow going about it from a DB inspect way. &lt;BR /&gt;
Make sure to set the time for this greater than your cold storage typical data age. &lt;BR /&gt;
It's a 3 step join to make the table look nice. This would be something to put as a report. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| dbinspect index=* timeformat=%s 
| search state=hot 
| stats max(modTime) as recentHot min(modTime) as oldestHot count as hotbuckets max(endEpoch) as hotearliestEvent min(startEpoch) as hotoldestEvent by index 
| join index 
    [| dbinspect index=* timeformat=%s 
    | search state=warm 
    | stats max(modTime) as recentwarm min(modTime) as oldestwarm count as warmbuckets max(endEpoch) as warmearliestEvent min(startEpoch) as warmoldestEvent by index ] 
| join index 
    [| dbinspect index=* timeformat=%s 
    | search state=cold 
    | stats max(modTime) as recentcold min(modTime) as oldestcold count as coldbuckets max(endEpoch) as coldearliestEvent min(startEpoch) as coldoldestEvent by index ] 
| eval maxAgeHot=tostring((recentHot-oldestHot), "duration") 
| eval maxAgeWarm=tostring((recentwarm-oldestwarm), "duration") 
| eval maxIndexedEventAgeHot=tostring((hotearliestEvent-hotoldestEvent), "duration") 
| eval maxIndexedEventAgeWarm=tostring((warmearliestEvent-warmoldestEvent), "duration") 
| convert ctime(hotoldestEvent) 
| convert ctime(hotearliestEvent) 
| convert ctime(warmearliestEvent) 
| convert ctime(warmoldestEvent) 
| convert ctime(oldestcold) 
| convert ctime(recentcold) 
| convert ctime(recentwarm) 
| convert ctime(oldestwarm) 
| convert ctime(recentHot) 
| convert ctime(oldestHot) 
| sort -index 
| table index,hotbuckets,warmbuckets,coldbuckets,maxIndexedEventAgeHot,maxIndexedEventAgeWarm, maxAgeHot,maxAgeWarm,recentHot ,oldestHot ,oldestwarm ,recentwarm recentcold ,oldestcold,hotoldestEvent,hotearliestEvent,warmearliestEvent,warmoldestEvent
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 May 2019 15:46:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/dbinspect-query-help/m-p/449806#M127358</guid>
      <dc:creator>Bselberg</dc:creator>
      <dc:date>2019-05-01T15:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: dbinspect query help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/dbinspect-query-help/m-p/449807#M127359</link>
      <description>&lt;P&gt;Thanks @Bselberg!  This is great.&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 14:59:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/dbinspect-query-help/m-p/449807#M127359</guid>
      <dc:creator>mschlapfer</dc:creator>
      <dc:date>2019-05-13T14:59:36Z</dc:date>
    </item>
  </channel>
</rss>

