---
title: "Change InfluxDB retention period"
description: "Changing the InfluxDB retention period in Opsview adjusts how long time series data is stored to manage database size. This article provides steps to view and modify the retention period and how to drop shards after reducing it."
url: "https://docs.itrsgroup.com/docs/faq/opsview/4922967463069-opsview-change-influxdb-retention-period/index.html"
---
If you find that your InfluxDB database is taking up too much space, you can reduce the data retention period. Alternatively, you may wish to increase the retention period. The default retention period is 8736 hours (364 days).

This article explains how to change the InfluxDB retention period. For more information about managing InfluxDB, please refer to the official InfluxDB documentation.

## Prerequisites

- `opsview-timeseries-influxdb` is installed

### Process

1. Log in to your timeseries host as `root` (this is usually your [orchestrator](https://docs.itrsgroup.com/docs/faq/opsview/4920429084957-opsview-orchestrator/index.html)).
2. Log in to the InfluxDB shell using `influx`:

```
influx -precision rfc3339
```

3. Check your current retention period using this query:

```
SHOW RETENTION POLICIES ON "opsview"
```

4. Change your retention period with a query like this:

```
ALTER RETENTION POLICY autogen ON opsview DURATION <duration> REPLICATION 1 SHARD DURATION 7d
```

Substitue `<duration>` with your desired duration. For example: `28w` for 28 weeks, `256h` for 256 hours.

### Dropping shards after reducing retention period

After reducing the retention period, you may wish to drop some shards.

You can list all shards with this InfluxQL query:

```
SHOW SHARDS
```

You can drop shards with a query like this:

```
DROP SHARD <shard_id>
```


