# Access to purge logs

**URL:** <https://forum.communityhealthtoolkit.org/t/access-to-purge-logs/1826>\
**Category:** Technical Support\
**Tags:** purge\
**Created:** [April 7, 2022, 11:27pm UTC](https://forum.communityhealthtoolkit.org/t/access-to-purge-logs/1826 "2022-04-07T23:27:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bamatic](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/bamatic/32/1318_2.png) [@bamatic](https://forum.communityhealthtoolkit.org/u/bamatic)\
**Post date:** [April 7, 2022, 11:27pm UTC](https://forum.communityhealthtoolkit.org/t/access-to-purge-logs/1826/1 "2022-04-07T23:27:55Z")

</div>

Hi there,  
We are experimenting troubles with purge function, we have beed advised to upgrade to 3.14.2 version and to monitor purge logs.  
We’ve upgrade to 3.14.2 in our dev instance but we are not able to see the logs  
[https://upgrade-muso-mali.app.medicmobile.org/medic-sentinel/\_all\_docs?startkey=%22purgelog%22&endkey=%22pw%22](https://upgrade-muso-mali.app.medicmobile.org/medic-sentinel/_all_docs?startkey=%22purgelog%22&endkey=%22pw%22)  
we get

```auto
{

error: "forbidden",

reason: "You are not allowed to access this db."

}

```

How could we get access to this logs ?

---

<div class="post-metadata">

**Author:** ![kenn](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/kenn/32/55_2.png) [@kenn](https://forum.communityhealthtoolkit.org/u/kenn)\
**Post date:** [April 7, 2022, 11:33pm UTC](https://forum.communityhealthtoolkit.org/t/access-to-purge-logs/1826/2 "2022-04-07T23:33:11Z")

</div>

Do you have admin credentials to your instance [https://upgrade-muso-mali.app.medicmobile.org](https://upgrade-muso-mali.app.medicmobile.org)? If so, are you using them?

---

<div class="post-metadata">

**Author:** ![bamatic](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/bamatic/32/1318_2.png) [@bamatic](https://forum.communityhealthtoolkit.org/u/bamatic)\
**Post date:** [April 7, 2022, 11:36pm UTC](https://forum.communityhealthtoolkit.org/t/access-to-purge-logs/1826/3 "2022-04-07T23:36:14Z")

</div>

Yes, we have admin credentials

 ![image](https://communityhealthtoolkit.b-cdn.net/uploads/default/original/2X/4/4a8fcd7d663f186a54d41fde36c6180d03c1adff.png)

---

<div class="post-metadata">

**Author:** ![kenn](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/kenn/32/55_2.png) [@kenn](https://forum.communityhealthtoolkit.org/u/kenn)\
**Post date:** [April 8, 2022, 9:37pm UTC](https://forum.communityhealthtoolkit.org/t/access-to-purge-logs/1826/4 "2022-04-08T21:37:09Z")

</div>

Purge logs (and all sentinel log files) are available to the “couch2pg database administrator” accounts. The user account you’re using (`pm_test_muso`) is not an admin user, it has the role `national_admin` - which is a custom role within your app\_settings.json file. It has the word admin in the role, but isn’t a db admin.

```auto
  "roles": {
    "national_admin": {
      "name": "usertype.national-manager"
    },
    ...
  },

```

There is an actual admin permissions which is controlled via CouchDB’s security features. [1.5. Security — Apache CouchDB® 3.3 Documentation](https://docs.couchdb.org/en/3.2.0/intro/security.html#users-documents). To make this account an admin, you’ll need to set its role to `_admin` in the CouchDB user document.

Hope this helps. Let me know if you are still unclear on how to proceed.

---

<div class="post-metadata">

**Author:** ![bamatic](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/bamatic/32/1318_2.png) [@bamatic](https://forum.communityhealthtoolkit.org/u/bamatic)\
**Post date:** [April 10, 2022, 2:32am UTC](https://forum.communityhealthtoolkit.org/t/access-to-purge-logs/1826/5 "2022-04-10T02:32:49Z")

</div>

Sorry but it is no clear for me, at medic database I found user org.couchdb.user:pm\_test\_muso, and adding the \_admin role does just nothing

```auto
{
  "_id": "org.couchdb.user:pm_test_muso",
  "_rev": "3-e029e0bb42dc0ef9de0ed3081c7c2837",
  "name": "pm_test_muso",
  "type": "user-settings",
  "fullname": "PM Test Muso",
  "roles": [
    "national_admin",
    "mm-online",
    "_admin"
  ],
  "known": true
}

```

In your [https://docs.couchdb.org/en/3.2.0/intro/security.html#users-documents](https://docs.couchdb.org/en/3.2.0/intro/security.html#users-documents) I can read

> - **roles** (_array_ of _string_): List of user roles. CouchDB doesn’t provide any built-in roles, so you’re free to define your own depending on your needs. However, you cannot set system roles like `_admin` there. Also, only administrators may assign roles to users - by default all users have no roles

And in this other doc [https://docs.couchdb.org/en/3.2.0/intro/security.html#creating-a-new-admin-user](https://docs.couchdb.org/en/3.2.0/intro/security.html#creating-a-new-admin-user)

---

<div class="post-metadata">

**Author:** ![kenn](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/kenn/32/55_2.png) [@kenn](https://forum.communityhealthtoolkit.org/u/kenn)\
**Post date:** [April 11, 2022, 9:44pm UTC](https://forum.communityhealthtoolkit.org/t/access-to-purge-logs/1826/6 "2022-04-11T21:44:16Z")

</div>

I think it is me who has misunderstood. But I think we are getting closer.

I went to `https://upgrade-muso-mali.app.medicmobile.org/_utils/#database/medic-sentinel/_security` and I found that any non-admin user with role `sentinel` can access the sentinel database.

I added this sentinel role to your user document at `https://upgrade-muso-mali.app.medicmobile.org/_utils/#database/_users/org.couchdb.user%3Apm_test_muso`.

Can you try now if you can access the sentinel logs at `https://upgrade-muso-mali.app.medicmobile.org/medic-sentinel/_all_docs?startkey=%22purgelog%22&endkey=%22pw%22`?

---

<div class="post-metadata">

**Author:** ![bamatic](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/bamatic/32/1318_2.png) [@bamatic](https://forum.communityhealthtoolkit.org/u/bamatic)\
**Post date:** [April 13, 2022, 9:33pm UTC](https://forum.communityhealthtoolkit.org/t/access-to-purge-logs/1826/7 "2022-04-13T21:33:57Z")

</div>

yes, Now this is working I see it thank you
