@Yuriy_but For CDH related service like Yarn you can configure NodeManager Maximum Log File Backups in Service Configuration but if these are some custom logs then I would say setup a cron job to delete these periodically.
Cheers! Was your question answered? Make sure to mark the answer as the accepted solution. If you find a reply useful, say thanks by clicking on the thumbs up button.