From 9b3c946f485309cdf50f7fb1622707b5373e33f3 Mon Sep 17 00:00:00 2001 From: Hemal Shah Date: Wed, 19 Oct 2022 19:17:13 -0700 Subject: log: Add a new watcher to watch for deletions. `watch deletions`: would log all keys which are deleted using either `delete` or `md` command. The log line would contain the command used, the key, the clsid and size of the deleted item. Items which result in delete miss or are marked as stale wouldn't show up in the logs --- logger.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'logger.h') diff --git a/logger.h b/logger.h index 4e8f1bb..9d2630c 100644 --- a/logger.h +++ b/logger.h @@ -22,6 +22,7 @@ enum log_entry_type { LOGGER_SLAB_MOVE, LOGGER_CONNECTION_NEW, LOGGER_CONNECTION_CLOSE, + LOGGER_DELETIONS, #ifdef EXTSTORE LOGGER_EXTSTORE_WRITE, LOGGER_COMPACT_START, @@ -108,6 +109,14 @@ struct logentry_item_store { char key[]; }; +struct logentry_deletion { + int nbytes; + int cmd; + uint8_t nkey; + uint8_t clsid; + char key[]; +}; + struct logentry_conn_event { int transport; int reason; @@ -164,6 +173,7 @@ struct _logentry { #define LOG_PROXYREQS (1<<10) /* command logs from proxy */ #define LOG_PROXYEVENTS (1<<11) /* error log stream from proxy */ #define LOG_PROXYUSER (1<<12) /* user generated logs from proxy */ +#define LOG_DELETIONS (1<<13) /* see whats deleted */ typedef struct _logger { struct _logger *prev; -- cgit v1.2.1