How to configure HANA log/trace file rotation?

Trace/log files rotation prevents log files from growing indefinitely by limiting the number and size of files.

Requirement: You want to configure trace file rotation in SAP HANA.
Prerequisite: You need INIFILE ADMIN to change parameters in HANA Studio.

Log and Trace files generated in HANA Systems :
In case of any issue with HANA database we can check log files and trace files. These diagnosis files are available in Diagnosis Files page tab of HANA studio.

Refer this article to check HANA trace file location at OS level.

Each service generates its own log file, it will have following naming convention.
<Service name>_<hostname>.<port>.nnn.trc

The SQL trace files are generated as executable python files, these files have following naming convention :

The rotation and size per file is controlled by following parameter present in global.ini.

Maxfiles (default value is 10)
Maxfilesize (default value in 10 MB)

If these parameters are maintained in global.ini only , then its valid for all services.
These parameters can be configured globally for all services in system or can be customized for each service individually. 
HANA Trace file and log ration parameters

Trace file rotation configuration specific to particular service :
 If we wish to configure is specific to service like for Index server , then we can edit these parameters in indexserver.ini

Go to Configuration tab in HANA studio.
Expand indexserver.ini > Trace
Right click on "Trace" and select add parameter.
Add both parameters as we have it in global.ini

When a trace file reaches the specified maximum file size(Maxfilesize ), it is closed, and a new file created. When the specified maximum number of files is reached(Maxfiles ), the next time a new file is created, the first file is deleted, and so on.

How to delete old SAP HANA trace/log files ?
If you wish to delete the log/trace files then you can execute following command at OS level: 

find . -mtime +60 -exec rm {} \;   //this will delete files older then 60 days.

One can also delete these files manually from HANA studio > Configuration , right click and select "Delete".

Reference :