Can Couchbase record the expired data or keep a log for that?

Couchbase will clear expired data automatically, but I want to keep them for research. Any methods help me to record all the expired data?

Currently, no. You could modify your own source build to journal out on actual delete during compaction (expiration doesn’t physically delete until compaction). I am not sure if it’s straightforward or non-trivial however.

Just out of curiosity, would you also want the data itself for each expired key (so the key-value pair) or just the keys themselves that got expired? To do so, almost creates another database, but in the style of journaling.

Any support as of now?

Hi @rohan.agarwal,

I don’t think this feature is yet built-in to Couchbase Server specifically. However, something along the lines of this expiry callback tool might help you: https://blog.couchbase.com/expiry-callbacks-couchbase-server

You may want to look at DCP (which the above may use - I’m not sure if the DCP event bus includes TTL expirations) - https://developer.couchbase.com/documentation/server/current/sdk/java/collecting-information-and-logging.html