# Enrolled identities lifespan

**URL:** https://openziti.discourse.group/t/enrolled-identities-lifespan/727
**Category:** General Questions
**Created:** [September 2, 2022, 3:38pm UTC](https://openziti.discourse.group/t/enrolled-identities-lifespan/727 "2022-09-02T15:38:20Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![av-dev](https://avatars.discourse-cdn.com/v4/letter/a/ba8739/32.png) [@av-dev](https://openziti.discourse.group/u/av-dev)
#### Post date: [September 2, 2022, 3:38pm UTC](https://openziti.discourse.group/t/enrolled-identities-lifespan/727/1 "2022-09-02T15:38:20Z")

</div>

How does Ziti maintains identities? If I have 50 servers running with the same identity and get deployed weekly, after a month would I have 200 identities whereas only 50 are valid? Are there any provisions in Ziti to clean up identities in some way?

TIA

---

<div class="post-metadata">

### Author: ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)
#### Post date: [September 3, 2022, 10:02pm UTC](https://openziti.discourse.group/t/enrolled-identities-lifespan/727/2 "2022-09-03T22:02:27Z")

</div>

At the moment, I don’t know of any “automatic expiration” of identities. We have talked about adding that sort of feature, but I don’t think we have due to no demand yet to do so.

Since you can create an identity, you can also delete them. Right now you’ll probably have to maintain this yourself with some sort of cleanup routine in your automation.

---

<div class="post-metadata">

### Author: ![av-dev](https://avatars.discourse-cdn.com/v4/letter/a/ba8739/32.png) [@av-dev](https://openziti.discourse.group/u/av-dev)
#### Post date: [September 4, 2022, 5:32am UTC](https://openziti.discourse.group/t/enrolled-identities-lifespan/727/3 "2022-09-04T05:32:22Z")

</div>

Is there any attribute in DB I can refer to, to find out when was the identity registered? or any “last established session” timestamp based on which I can write some automation to remove stale identities?

---

<div class="post-metadata">

### Author: ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)
#### Post date: [September 4, 2022, 10:17am UTC](https://openziti.discourse.group/t/enrolled-identities-lifespan/727/4 "2022-09-04T10:17:45Z")

</div>

@mguthrie88 provided some good insights here

> [@Accessing the controller event metrics](https://openziti.discourse.group/t/accessing-the-controller-event-metrics/525/3):
>
> Ziti has a LOT of data that you can tap into, this example is perhaps a bit overkill, but it should demonstrate how to pick and choose certain namespaces if you want to create filters or drop certain data types to specific files. This would need to go into your controller config. metrics: reportInterval: 1m events: jsonLogger: subscriptions: - type: metrics metricFilter: "link.latency.\*" - type: metrics sourceFilter: .\* metricFilter: "(.\*session.create.\*…

I have setup metrics.. and you can track every time an identity connects to an edge.

This would be a good way to identity which are active or not.. to then consider deactivating..

`{"namespace":"edge.sessions","event_type":"created","id":"cl7n1rz7n0gm3cr8kr0anrim9","timestamp":"2022-09-04T08:03:49.466506557Z","token":" ","api_session_id":"cl7n1ryw60gm1cr8ko1xu98nb","identity_id":"Wbbn31niU"}`

---

<div class="post-metadata">

### Author: ![av-dev](https://avatars.discourse-cdn.com/v4/letter/a/ba8739/32.png) [@av-dev](https://openziti.discourse.group/u/av-dev)
#### Post date: [September 4, 2022, 2:58pm UTC](https://openziti.discourse.group/t/enrolled-identities-lifespan/727/5 "2022-09-04T14:58:08Z")

</div>

This looks very promising. Thanks a lot @markamind

---

<div class="post-metadata">

### Author: ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)
#### Post date: [September 4, 2022, 3:59pm UTC](https://openziti.discourse.group/t/enrolled-identities-lifespan/727/6 "2022-09-04T15:59:15Z")

</div>

> [@av-dev](#):
>
> find out when was the identity registered

Hrmm. I don't think we have an "enrolled at" (registered) date. That might be an interesting thing to track. If it's out there, I didn't find the right API that would track it yet. If I discover it I'll post back
