Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

ranger policies custom report

ranger policies custom report

Expert Contributor

i want to pull report from Mysql (ranger db). report i need is what ever i see in ranger UI. list of policies and what permissions are assigned to users.

i'm using ranger 0.5, i knonw this is easy in new ranger 0.6 where we can download report from ranger ui


Re: ranger policies custom report

Hi Raja,

In ranger 0.5 it is a lot more difficult to get the data from the db directly. What I have done in the past is use the Rest APIs to download the content and flatten out the data. You can get the rest apis from your browsers developer tool utilities. For example,

json curl

curl '' -H 'Cookie: AMBARISESSIONID=bkhp0zgjk8be1a5hy438zyk7r; JSESSIONID=DACAF20F2DDF50BD05BFA82C37AE758F; clientTimeOffset=480' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer:' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' --compressed

or xml curl

curl '' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cookie: AMBARISESSIONID=bkhp0zgjk8be1a5hy438zyk7r; JSESSIONID=DACAF20F2DDF50BD05BFA82C37AE758F; clientTimeOffset=480' -H 'Connection: keep-alive' --compressed

If you change the serviceType= to other components you can get the reports from those components, etc.

Once you have the data you can use something like xpath to parse the data: Forexample,

Say I want all hive databases in all my policies


Say I want all users:  


Say I want all groups:  


Or you can use a parsing tool of your choice. Forexample, to convert the json file to csv and import into excel.

In HDP version 2.5 you can download reports in Ranger to csv/excel.


Don't have an account?
Coming from Hortonworks? Activate your account here