How to add parameters to get_user_audit_logs()

Dear Support,

How should I add a parameter to the get_user_audit_logs() API function?

I want to see the audit log of a user with userId 64.
I tried get_user_audit_logs(64), and get_user_audit_logs(userid=64), but there is a syntax error…

Thanks in advance


How are you calling that ? It’s an API method so you should use the API client params to specify user-id

.rccontrol/community-1/profile/bin/rhodecode-api --instance-name=community-1 get_user_audit_logs

Funny thing is, that it gives me back a list of entries which only contains one particular user. Every element is for that user.
I am not sure why. If I got to the web interface and lookup the audit logs, I can see every user.

That user I see for all antries is a user that is used to do some scheduled tasks, like assigne permissions, etc. So it make sense to see lots of actions of that user.
What does not make sense is to not see any other user in that list.

Actually I am trying to get action history of a user. I can use the ‘Audit log’ on the web interface, but the problem with that is that it only list 10 element per page. And there is around 100 pages (1000 entries for this user).
If I can list this on one page using the web interface, that would be enough…

Proper way to call that API for other users would be to call it like that:

.rccontrol/community-1/profile/bin/rhodecode-api --instance-name=community-1 get_user_audit_logs userid:1234

I always get: user ‘1234’ does not exists

Of course, I replace 1234 with a correct, existing userId.

Any tips?

Hi, Please try this format:

.rccontrol/community-1/profile/bin/rhodecode-api --instance-name=community-1 get_user_audit_logs '{"user_id":1234}'

The other format thigns 1234 is username (which you can use too if you want)

Sorry for the late reply.

The above syntax doesn’t generate an error, but the output is not what I expect.
.rccontrol/community-1/profile/bin/rhodecode-api --instance-name=community-1 get_user_audit_logs ‘{“user_id”:65}’:
“error”: null,
“id”: 4841,
“result”: [
“action”: “user.push”,
“action_date”: “2019-11-20T09:28:28”,
“repository_id”: 1598,
“repository_name”: “rd**********”,
“user_id”: 115,
“user_ip”: “”,
“username”: “gr****”
“action”: “user.pull”,
“action_date”: “2019-11-20T09:24:24”,
“repository_id”: 1598,
“repository_name”: “rd******”,
“user_id”: 115,
“user_ip”: “”,
“username”: “gr*****”

I removed the reponame and the username for the sake of security.
The username is wrong, as the user that is listed here has ID 115, not 65. Why is that?