question

vijayshanker.oracle_94842 avatar image
vijayshanker.oracle_94842 asked vijayshanker.oracle_94842 commented

Is there a way to know when a role/user was created?

is there a way to find the role/user creation time other than auditlogs.
Also can we find its TTL too

roles
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered vijayshanker.oracle_94842 commented

@vijayshanker.oracle_94842 you can use the CQL function WRITETIME() to get the timestamp for when the data was written.

To illustrate, here is an example where I created the role vijay:

cassandra@cqlsh> CREATE ROLE vijay WITH LOGIN = true AND PASSWORD = 'xxxxx';

and here is an example output for the WRITETIME() function:

cassandra@cqlsh> SELECT role, WRITETIME(can_login) FROM system_auth.roles WHERE role = 'vijay';

 role  | writetime(can_login)
-------+----------------------
 vijay |     1570581776845000

For more info, see CQL native functions.

On the TTL question, you can't set roles to expire in Cassandra so you can't use the TTL() function.

P.S. There are various ways of converting timestamps to a date. The simplest way is to use an online tool like https://www.epochconverter.com/. FWIW, 1570581776845000 is equivalent to October 9, 2019 12:42 GMT. Cheers!

1 comment Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

vijayshanker.oracle_94842 avatar image vijayshanker.oracle_94842 commented ·

Appreciate you as usually you are great

0 Likes 0 ·