Ritwik
Ritwik

Reputation: 65

Retention Policy doesn't deletes data

I’m new to influxdb and i want to implement Retention Policy (RP) for my logs.

I loaded a static data using telegraf and have created a RP for that :

CREATE DATABASE test WITH DURATION 60m

but it is not deleting my previous logs .

As i have observed that influx stores data on UTC time format whereas my telegraf server uses system time. Could that be a isuue ??

Upvotes: 1

Views: 2534

Answers (1)

Katy Farmer
Katy Farmer

Reputation: 171

I would check two things using the Influx CLI. First, check the retention policies on your DB.

> SHOW RETENTION POLICIES
name    duration shardGroupDuration replicaN default
----    -------- ------------------ -------- -------
autogen 1h0m0s   1h0m0s             1        true

For example, I can see my autogen policy has a duration of 1 hour and a shardGroupDuration of 1 hour.

Second, check the shards.

> SHOW SHARDS

name: tester
id  database retention_policy shard_group start_time           end_time             expiry_time          owners
--  -------- ---------------- ----------- ----------           --------             -----------          ------
130 tester   autogen          130         2018-02-20T21:00:00Z 2018-02-20T22:00:00Z 2018-02-20T23:00:00Z
131 tester   autogen          131         2018-02-20T22:00:00Z 2018-02-20T23:00:00Z 2018-02-21T00:00:00Z
132 tester   autogen          132         2018-02-20T23:00:00Z 2018-02-21T00:00:00Z 2018-02-21T01:00:00Z

Data is removed when the newest point has a timestamp after the expiry time.

Upvotes: 4

Related Questions