Back

Identify when and by who a collection has been deleted.

  • 3
  • Self Hosted
  • Tools
  • Databases
Victor1337
7 Mar, 2023, 16:02

Hello, what are the ways of identifying, when and by who, a collection has been deleted ?

TL;DR
The user is asking for ways to identify when and by whom a collection has been deleted. They mention finding information in the audit table of the underlying MariaDB container. The response suggests enabling HTTP Access logs or creating a feature request to retain audit data. They also mention using Appwrite events to trigger a function for identifying collection deletions.
joeyouss
7 Mar, 2023, 16:50

Hi, when it is created/updated, you can see it in activity tab of collection.

Victor1337
7 Mar, 2023, 17:00

Thank you, but how about deleted ?

joeyouss
7 Mar, 2023, 17:00

Hmm not sure about deleted Let me confirm once and get back to you

Victor1337
7 Mar, 2023, 17:02

Thankies

Victor1337
21 Mar, 2023, 17:08

<:appwriteupvote:899677724615016528>

rafagazani
21 Mar, 2023, 17:56

Hello @Victor1337 , you can use appwrite events and trigger some function. databases.*.collections.*.delete

rafagazani
21 Mar, 2023, 17:58

if it is a specific collection: databases.*.collections.my-collection.delete here is a list of all events: https://appwrite.io/docs/events

rafagazani
21 Mar, 2023, 17:59

@Victor1337 if you can write a little more about your use case, we can come up with a pretty cool solution

Victor1337
21 Mar, 2023, 18:02

In the meantime I connected to mariaDb underlying container, and found some info in the audit table. Does that incorporate all events ? Of type collection delete ?

rafagazani
21 Mar, 2023, 18:11

I can't tell you how the internals of appwrite work, I'll leave it to someone with more experience

Drake
21 Mar, 2023, 18:58

unfortunately, the audit data is also deleted when the collection is deleted. You could create a feature request to somehow retain the audit data, though.

Drake
21 Mar, 2023, 18:58

nice! but that probably doesn't tell you who did it, right? 🧐

Drake
21 Mar, 2023, 18:59

you could also see if there's any HTTP Access logs that might give you some info too. if it's not enabled, you could try to enable them (on traefik)

Victor1337
21 Mar, 2023, 19:02

@Steven , I did manage to track that down, but the process was painful. And I don't feel is right, the reason I managed was based on time event logs from docker, annexed with ip. But not provided by appwrite structure.

Drake
21 Mar, 2023, 19:06

nice!

Victor1337
21 Mar, 2023, 19:06

Also collection.delete is saved in audit table. Going trough the process seams to stay there, should it get deleted ?

Victor1337
21 Mar, 2023, 19:07

Are there some better logs on the roadmap ?

Drake
21 Mar, 2023, 19:08

it's not something worked on at the moment, if you want to see better audit logs for deleted collections, please make sure to create an issue

Victor1337
21 Mar, 2023, 19:10

@Steven Yes sir, will crate a issue, this is how I found events of sort. But not the friendliest approach. Thankies

Drake
21 Mar, 2023, 19:12

that's interesting...that should have been deleted 😅 This is the _<number>_audit table, right?

Victor1337
21 Mar, 2023, 19:16

Right

Victor1337
21 Mar, 2023, 19:26
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more