medic / cht-user-management

GNU Affero General Public License v3.0
3 stars 1 forks source link

Document audit log features #10

Open mrjones-plip opened 7 months ago

mrjones-plip commented 7 months ago

I believe this tool has an audit log feature. We should document this:

  1. Where is the audit log stored?
  2. When is the audit log updated? (eg every click, every form submit or just on create/delete/move)
  3. How do you get a list of activities to show, for example, which time and day CHWs were created by which CHT admin users?
mrjones-plip commented 7 months ago

Answers to above from my own testing:

  1. Audit log is stored on the documents themselves in CouchDB. For example, this is a stanza on the JSON from a contact that I created with the tool:
     "user_attribution": {
       "tool": "cht_usr-1.0.2",
       "username": "medic",
       "created_time": 1706062507968
     },
  2. Audit log is updated at the time of document creation, on the doc itself per # 1 above
  3. To get a list you would need to download every single document and aggregate the data you're looking for. Alternately, you may be able to do some of this with a couch2pg instance - but I don't think couch2pg gets the data from medicdb for contact docs.