Support Questions
Find answers, ask questions, and share your expertise

How do I control the access log of the ranger-admin ?


I have used the Ranger for several days.

I found that there were a number of access files and that files was not made rotate.

$ ls /var/log/ranger/admin/access_log.2015-1* | head

$ ls /var/log/ranger/admin/access_log.2015-1* | wc -l

I searched the conf file included the access log setting, but I couldn't find.

How do I control the access log of the ranger-admin?


@Junichi Oda

You have to run a cron job based on your requirement. You can schedule it to remove the logs.

every 30 days or 60 day..

@Junichi Oda Something like this

find /var/log/ranger/admin/ -mtime +30d -a -type f -print0 | xargs -0 rm

@Neeraj Sabharwal

Thank you for your prompt reply.

If I don't have any other means, I will set the cron.

However, I think it is better that the Ranger removes log fles with log4j or tomcat configs and I would like the Ambari to enable to change the dulation of the rotation for the ranger-admin.

@Junichi Oda Could you help me to close this thread by accepting the answer?

@Neeraj Sabharwal

Sorry my reply is late.

I have just accepted the answer. Thank you so much for your kindness.

@Ancil McBarnett @Junichi Oda This is good information. I believe its leveraging the same for logs

find /var/log/ranger -mtime +30| xargs --no-run-if-empty rm


@Ancil McBarnett @Neeraj Sabharwal

Thanks for the good information.

I modified /usr/hdp/<version>/ranger-admin/ews/webapp/WEB-INF/log4j.xml with the same way and made sure that I colud do what I want to do.

Cloudera Employee

@Junichi Oda You cannot manage access_log using log4j, as the configuration AccessLogValve is hardcoded in the code.

Following logs can be managed using log4j by leveraging maxBackupIndex

  • UserSync
  • TagSync
  • XA Portal

Below logs cannot be managed using log4j, hence will have to leverage logrotate [ a standard tool for log rotation in linux ] - Manage Ranger Admin access_log log file growth

  • Access Log

Or else as mentioned by @Neeraj Sabharwal you can use cron script with the find command

find /var/log/ranger -mtime +30| xargs --no-run-if-empty rm
; ;