# Enabling and configuring log rotation on the engine

Logs related to the pipelines that are executed on the Remote Engine Gen2 are written inside the Livy container /tmp/livy/jobs where the log rotation is disabled by default.

The following table presents the log rotation parametersThe following table presents the log rotation parameters

| Parameters | Values | Description |
| --- | --- | --- |
| LIVY\_JOB\_LOG\_PURGE\_ENABLE | true or false | false (default<br>value): log rotation is disabled.<br><br><br>true : enables log<br>rotation |
| LIVY\_JOB\_LOG\_RETAIN\_DAYS | Integer, the default value is 30 | When log rotation is enabled, logs older than XX (in<br>days) are removed. |
| LIVY\_JOB\_LOG\_RETAIN\_DISK | Integer, the default value is 1048576 | When log rotation is enabled and the total disk<br>space used by the logs folder is greater than XX (in Bytes) all the existing logs are removed. |

## Procedure

1. Go to the Remote Engine Gen2 installation directory.
2. Edit the following file used to start the engine:

   default/docker-compose.yml if you are using the engine in the AWS USA, AWS Europe, AWS Asia-Pacific or Azure regions.

   eap/docker-compose.yml if you are using the engine as part of the Early Adopter Program.
3. Find the service named livy and add the appropriate parameters and values.
   ### Example

   To enable log rotation and remove logs older than 3 months with a clean trigger of 10 GB:
   ```
   livy:
   	...
   	environment:
   		...
   		LIVY_JOB_LOG_PURGE_ENABLE: "true"
   		LIVY_JOB_LOG_RETAIN_DAYS: 90
   		LIVY_JOB_LOG_RETAIN_DISK: 10485760
   ```
4. Restart Livy by executing this command:
   ```
   docker-compose up -d livy
   ```