# How to Modify Logrotation Period in Management Plane

## Problem

Based on the volume of logs being produced, at times it is required to modify the log rotation frequency of files associated with kubelet, kube-apiserver, kube-scheduler etc in the nodes.

## Environment

* Platform9 Edge Cloud - v5.3 and Higher

## Answer

To modify the log rotation days, it is possible to edit the file: /etc/logrotate.d/pf9-\<respective\_file\_name> for the **maxage** and **rotate** directives.

In logrotate, both **maxage** and **rotate** directives are used to manage the retention of rotated log files, but the function in slightly different ways:

1. **maxage** Directive: The **maxage** directive specifies the maximum age (in days) of rotated log files to retain. It determines how long rotated log files should be kept before they are removed. This directive helps enforce a specific time-based retention policy for log files. **For example**, if the **maxage 7** is configured for a log file, logrotate will delete rotated log files that are older than seven days. It ensures that only the most recent rotated log files within the defined timeframe are retained, while older log files are automatically purged.
2. **rotate** Directive: The **rotate** directive specifies the number of rotated log files to keep. It determines the maximum number of log files (including the current and rotated ones) that should be retained before the oldest log files are removed. This directive helps enforce a space-based retention policy for log files.

For instance, if the **rotate 10** is configured for a log file, logrotate will keep a maximum of ten log files (including the current log file) and delete the oldest log file once the limit is reached. As new log files are generated, logrotate will rotate and compress them, ensuring that the total number of log files does not exceed the specified limit.

In summary, **maxage** focuses on the age of the rotated log files and specifies how long to retain them based on the number of days, while **rotate** focuses on the number of log files to retain and specifies the maximum number of log files to keep, regardless of their age.

{% hint style="info" %}
**Info**

The default log rotation period for kubelet, kube-APIServer, kube-Scheduler, kube-controller-manager are 10 days.
{% endhint %}

## Additional Information

Cluster upgrade overwrites this because the pf9-kube installs and configures the file on the hosts.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://platform9.com/kb/pmk/frequently-asked-questions/how-to-modify-logrotation-period-in-management-plane.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
