Greetings @sanjubaba,
See below for the two relevant pieces of documentation regarding setting index retention policies:
https://docs.splunk.com/Documentation/Splunk/latest/Indexer/Setaretirementandarchivingpolicy
https://docs.splunk.com/Documentation/Splunk/latest/Admin/Indexesconf