Created 08-08-2023 08:47 AM
Hi,
I want to read data from Ranger Rest API ...assets/accessAudit...
Works fine but need to set the startDate like I can do it in the Ranger WebUI in the Audit part.
Is there any docu where to find how to do that?
Example: ...server:port/service/assets/accessAudit?startDate=06/02/2023&resourceType=@table&accessType=select&so...
In this example the startDate does not work, only getting the data from the actual day.
If I use the startDate in the Ranger WebUI it works fine.
BR
Roland
Created on 09-29-2023 04:48 AM - edited 09-29-2023 05:15 AM
This works:
---/service/assets/accessAudit?startIndex=0&pageSize=50&sortBy=eventTime&sortType=asc&startDate=09%2F28%2F2023
To get the next records:
---/service/assets/accessAudit?startIndex=50&pageSize=50&sortBy=eventTime&sortType=asc&startDate=09%2F28%2F2023
I would recommend to read more than 50 (pageSize) records at the time and also do some filtering like "&repoName=cm_hive" to reduce the number of records.
Created 08-08-2023 08:58 AM
@kuhbrille Welcome to the Cloudera Community!
To help you get the best possible solution, I have tagged our Ranger experts @Atahar and @vamsi_redd who may be able to assist you further.
Please keep us updated on your post, and we hope you find a satisfactory solution to your query.
Regards,
Diana Torres,Created 08-08-2023 09:27 AM
@kuhbrille When i execute this in my ranger and check the call, the date is URL parsed:
08%2F08%2F2023
https://host.host.a465-9q4k.cloudera.site/se-aw-mdl/cdp-proxy/ranger/service/assets/accessAudit?page=0&pageSize=25&total_pages=57997&totalCount=1449906&startIndex=0&excludeServiceUser=false&startDate=08%2F08%2F2023&accessResult=0&_=1691511837287
Does that help get your call to take it the date?
Created 08-08-2023 10:42 AM
Hi, no, did not help... I took out the totalPages and totalCount...
tried it with page=0 and also with pageSize=25...
It always takes the last 200 rows... whatever I do...
.../service/assets/accessAudit?page=0&pageSize=25&startIndex=0&excludeServiceUser=false&startDate=08%2F08%2F2023&accessResult=0
Created 08-08-2023 10:51 AM
in the Ranger WebUI, when I define the filter in the Audit part, I also have the:
sortType=asscending&sortKey=eventTime
I tried that in my URL, but does not work
Created on 08-09-2023 12:34 AM - edited 08-09-2023 01:53 AM
like I can see, the sorting of the result might cause the issue... whatever I do, it is descending... and so I cannot see, if the startDate filter is working or not...
anybody an idea how to set the sorting in the correct way?
I did it like this: &sortType=ascending&sortBy=eventTime
But that does not work...
here another example... I do not see what I am doing wrong:
---/service/assets/accessAudit?startDate=08%2F08%2F2023&sortBy=eventTime&sortType=ascending&excludeServiceUser=false&pageSize=4&startIndex=0
Created on 09-29-2023 04:48 AM - edited 09-29-2023 05:15 AM
This works:
---/service/assets/accessAudit?startIndex=0&pageSize=50&sortBy=eventTime&sortType=asc&startDate=09%2F28%2F2023
To get the next records:
---/service/assets/accessAudit?startIndex=50&pageSize=50&sortBy=eventTime&sortType=asc&startDate=09%2F28%2F2023
I would recommend to read more than 50 (pageSize) records at the time and also do some filtering like "&repoName=cm_hive" to reduce the number of records.
Created 09-29-2023 07:04 AM
Hello @kuhbrille/Roland
Can you try the below API?
<Ranger host>:<Port No>/service/assets/accessAudit?&sortBy=eventTime&sortType=asc&startIndex=0&startDate=<Date>
Example:
Created 09-30-2023 10:51 AM
@Scharan Why are you repeating my working solution...? Is it your goal to walk away with my credits...?
Created 10-06-2023 04:39 PM
@kuhbrille Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future. Thanks.
Regards,
Diana Torres,