How can you delete any trend data older than X days from a specific element in a local Cassandra setup?
Hi Paul,
In System Settings - time to live you can specify how long you wish specific data types to be kept in the database for.
This can be configured globally, or per protocol (version).
Setting this will ensure that the data written to Cassandra has a time to live (ttl) set, and will be marked for deletion after this period has passed. Note that this does not affect any data already present prior to setting this value.
Your question is about deleting it for a specific element though, so unless there are no other elements sharing the same protocol version, it is not possible to configure this in DataMiner.
You can however manually send a query to the Cassandra database to delete specific data you want.
In System Center - Tools, there is a Query Executor you can use to send queries to your local database. A query to request trend points looks like this. The Cassandra table we want to query is the "data" table:
select * from data where d=[DMAID] and ei=[ELEMENTID] and p=[PARAMETER] and i='[TABLEINDEX]' and w=[0, 5 or 60 depending on whether you wish to query real time points, 5min averaged points or 1hour averaged points] and t > '[Timestamp]';
d, ei, p, i, w and t are all Partitioning Keys in Cassandra, and I don't believe you can send a delete statement using range queries (< or >) on a Partitioning Key column in Cassandra.
You would have to create a script that fetches the rows that match a range query first, to then send separate delete queries for each row separately. This will probably be a heavy operation if there are a lots of rows to go through.
Naturally you should be very careful in doing this and only delete the data you know is safe to delete.
Hope this helps!