Hi @Lubomir Sokolovsky , welcome to Microsoft Q&A forum and apologies for delay in response.
Currently Activity log events are retained in Azure for 90 days and then deleted as you mentioned. For additional functionality such as longer retention, you should create a diagnostic setting and route the entires to another location based on your needs. See the criteria in the earlier section of below article.
There are specific ways we can check for different azure resources about last accessed date. As an example, please check below article for Azure SQL Database access:
Find the time when table was last accessed in SQL Server database
For Cosmos DB, we can check the '_ts' property of element by using similar below query:
SELECT top 1 c._ts FROM c order by c._ts desc
Once we have the list of resources that are older than our requirements, we can remove them according to requirements.
Please let us know if you need any more details on this and we can discuss further.
----------
Please don't forgot to click on accept it as answer button
wherever the information provided helps you. This can be beneficial to other community members as well.