Support Questions

Find answers, ask questions, and share your expertise

Ranger API assets/accessAudit set startDate in URL

avatar
Explorer

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

1 ACCEPTED SOLUTION

avatar
New Contributor

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.

View solution in original post

9 REPLIES 9

avatar
Community Manager

@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,
Community Moderator


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:

avatar

@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?

avatar
Explorer

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

avatar
Explorer

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

avatar
Explorer

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

avatar
New Contributor

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.

avatar
Master Collaborator

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:

 http://myranger:6080/service/assets/accessAudit?&sortBy=eventTime&sortType=asc&startIndex=0&startDat...

avatar
New Contributor

@Scharan Why are you repeating my working solution...? Is it your goal to walk away with my  credits...?

avatar
Community Manager

@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,
Community Moderator


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community: