Getting Data In

bucket retention and frozenTimePeriodInSecs

mataharry
Communicator

My index has a retention of 6 months with frozenTimePeriodInSecs=15552000.
But I still see some events that are older than the retention.

By example events that are from 6 month and 2 weeks.

Any thoughts ?

Tags (2)
1 Solution

yannK
Splunk Employee
Splunk Employee

A bucket that contains events overlapping the time retention will not be frozen until all the events are older than the retention.

By default indexes.conf has buckets with up to 3 months of span. So It's possible that you have buckets still overlapping
[main]
maxHotSpanSecs = 7776000
frozenTimePeriodInSecs = 188697600

A workaround may be to reduce the maxHotSpanSecs to a week, to force the buckets to be smaller, and rotate more often.

To verify the status of your buckets, and estimate if they meet the condition to be frozen you can use those dbinspect searches on the indexer.

  • for Splunk 6, for all indexes with autodetection from frozenTimePeriodInSecs

| dbinspect index=* | join index [|rest /services/data/indexes| eval index=title | table index frozenTimePeriodInSecs ]
| eval toNow=now()-endEpoch | convert num(toNow) | convert num(frozenTimePeriodInSecs)
| convert ctime(endEpoch) AS endEvent | convert ctime(startEpoch) AS startEvent
| eval shouldBeFrozen=if( ( state!="hot" AND state!="thawed" ) AND toNow>frozenTimePeriodInSecs,"yes","no")
| table index path id state startEvent endEvent shouldBeFrozen toNow frozenTimePeriodInSecs

  • for splunk 5 and 4, you have to manually add the values and do one index at a time

|dbinspect index=main
| eval frozenTimePeriodInSecs= 2592000
| convert timeformat="%m/%d/%Y:%H:%M:%S" mktime(earliestTime) AS endEpoch
| eval toNow=now()-endEpoch | convert num(toNow)
| convert num(frozenTimePeriodInSecs)
| eval shouldBeFrozen=if( ( state!="hot" AND state!="thawed" ) AND toNow>frozenTimePeriodInSecs,"yes","no")
| table path id state earliestTime latestTime endEvent shouldBeFrozen toNow frozenTimePeriodInSecs

View solution in original post

yannK
Splunk Employee
Splunk Employee

A bucket that contains events overlapping the time retention will not be frozen until all the events are older than the retention.

By default indexes.conf has buckets with up to 3 months of span. So It's possible that you have buckets still overlapping
[main]
maxHotSpanSecs = 7776000
frozenTimePeriodInSecs = 188697600

A workaround may be to reduce the maxHotSpanSecs to a week, to force the buckets to be smaller, and rotate more often.

To verify the status of your buckets, and estimate if they meet the condition to be frozen you can use those dbinspect searches on the indexer.

  • for Splunk 6, for all indexes with autodetection from frozenTimePeriodInSecs

| dbinspect index=* | join index [|rest /services/data/indexes| eval index=title | table index frozenTimePeriodInSecs ]
| eval toNow=now()-endEpoch | convert num(toNow) | convert num(frozenTimePeriodInSecs)
| convert ctime(endEpoch) AS endEvent | convert ctime(startEpoch) AS startEvent
| eval shouldBeFrozen=if( ( state!="hot" AND state!="thawed" ) AND toNow>frozenTimePeriodInSecs,"yes","no")
| table index path id state startEvent endEvent shouldBeFrozen toNow frozenTimePeriodInSecs

  • for splunk 5 and 4, you have to manually add the values and do one index at a time

|dbinspect index=main
| eval frozenTimePeriodInSecs= 2592000
| convert timeformat="%m/%d/%Y:%H:%M:%S" mktime(earliestTime) AS endEpoch
| eval toNow=now()-endEpoch | convert num(toNow)
| convert num(frozenTimePeriodInSecs)
| eval shouldBeFrozen=if( ( state!="hot" AND state!="thawed" ) AND toNow>frozenTimePeriodInSecs,"yes","no")
| table path id state earliestTime latestTime endEvent shouldBeFrozen toNow frozenTimePeriodInSecs

hajducko
Explorer

I think the Splunk 5/4 search is wrong. Wouldn't you want to make endEpoch as the latestTime as every event in the bucket needs to be older than the frozenTimePeriod. If I run that search, I get 'yes' for buckets that have an earliestTime that is older than the frozenTimePeriod, but with a latestTime that is newer. Those buckets wouldn't be deleted.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Fuel Your Journey: What’s Waiting for You at the .conf26 Acceleration Station

Navigating the show floor at .conf26 isn't just about keynotes and technical breakout sessions; it's also ...

Join the Final Session of the Data Management & Federation Bootcamp Series

Over the past three sessions of the Data Management & Federation Bootcamp Series, we've explored how to build ...

From Data to Insight: Announcing the Winners of the Splunk Dashboard Contest

Hi Splunkers, First off, thank you to everyone who participated in our very first From Data to Insight: The ...