Question: How to delete Search data for a specific time range?

Requirements:  Supported on releases 21.x and higher.

                             SOLR service should be running on the node.

Solution: Download and run the script by providing the arguments for deleting the data under search key-space.

From release 21. 3 onwards the script will be prepackaged under /opt/versa/scripts/van-maintenance/

Location: https://versanetworks.box.com/s/yuepn4dtc0crso5smolyrlit2bf5al95

MD5SUM:

[versa@Search-Node: ~] $ md5sum search_data_manager.py

8f973a59e1f94e03f3a4a13c4724ecbc  search_data_manager.py

Download the file and copy on server:

[versa@van-search-04: ~] $ ls -l

-rwxrw---- 1 versa versa       4.5K Jan 27 16:32 search_data_manager.py

 

Usage:

[versa@Search-Node: ~] $ python3 search_data_manager.py delete --host <IP of node where Solr is running> --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD> --log-type <log-type-case-sensitive>

 

For Help:

[versa@Search-Node: ~] $ python3 search_data_manager.py --help

Usage: search_data_manager.py [OPTIONS] COMMAND [ARGS]...

  Script to manage Versa Analytics Search Data

Options:

  --help  Show this message and exit.

Commands:

  delete  Script to delete Search data

 

ARGS:

"--host", required, help="IP/hostname of Search node"

"--port", default="8983", help="Port of Search node; default: 8983"

"--start-date", required, help="Deletion start date; format: YYYY-MM-DD"

"--end-date", required, help="Deletion end date (not inclusive); format: YYYY-MM-DD"

"--log-type", help="Log type to delete". If --log-type argument is not passed, by default all search data is deleted.

"--collection", default="searchlogs", help="Collection name; default=searchlogs"

 

Examples:

[versa@Search-Node: ~] $ python3 search_data_manager.py delete --host 192.168.0.3 --start-date 2022-02-18 --end-date 2022-02-20 --log-type accessLog

2022-02-22 17:29:20,404 | SearchDataManager | INFO | Search data deleted for collection: searchlogs

[versa@Search-Node: ~] $ python3 search_data_manager.py delete --host 192.168.0.3 --port 8983 --start-date 2022-02-15 --end-date 2022-02-22 

2022-02-22 17:49:48,259 | SearchDataManager | INFO | Search data deleted for collection: searchlogs

 

Note:

This activity needs to be performed on any one Search personality node of the cluster.