---
title: Setup LogRotate
slug: v00/setup-logrotate
description: Learn how to efficiently manage log files with LogRotate. This document guides you through the process of setting up LogRotate to daily split logs, retain 7 days worth of logs, and automatically delete old logs. Discover the crucial tip of using an "exec"
docTags: 
createdAt: 2023-08-19T21:18:17.523Z
---

# LogRotate

LogRotate will break your log into a new file daily and keep 7 days of logs and discard old logs.

:::hint{type="warning"}
**Important:** Make sure your validator start script starts with `exec` or your validator will go offline for a time each time the logs rotate.
:::

:::hint{type="info"}
Run as `root` user, use `sudo -i`
:::

Copy code block and paste into terminal.

:::CodeblockTabs
CLI

```linux
cat > logrotate.xand <<EOF
/home/xand/xand-validator.log {
  rotate 7
  daily
  missingok
  postrotate
	systemctl kill -s USR1 xand.service
  endscript
}
EOF
sudo cp logrotate.xand /etc/logrotate.d/xand

```
:::

Restart logrotate service

:::CodeblockTabs
CLI

```linux
sudo systemctl restart logrotate.service
```
:::



Continue on to [Starting your validator](docId\:dkZkceOONoXiaMdl8v3sR)
