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

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

Solved Go to solution
Highlighted

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

Explorer

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
/var/log/ranger/admin/access_log.2015-11-27.15.log
/var/log/ranger/admin/access_log.2015-11-27.16.log
/var/log/ranger/admin/access_log.2015-11-27.17.log
/var/log/ranger/admin/access_log.2015-11-27.18.log
/var/log/ranger/admin/access_log.2015-11-27.19.log
/var/log/ranger/admin/access_log.2015-11-27.20.log
/var/log/ranger/admin/access_log.2015-11-27.21.log
/var/log/ranger/admin/access_log.2015-11-27.22.log
/var/log/ranger/admin/access_log.2015-11-27.23.log
/var/log/ranger/admin/access_log.2015-11-28.00.log


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

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

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

9 REPLIES 9
Highlighted

Re: 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..

Highlighted

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

@Junichi Oda Something like this

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

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

Explorer
@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.

Highlighted

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

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

Highlighted

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

Explorer
@Neeraj Sabharwal

Sorry my reply is late.

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

Highlighted

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

Highlighted

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

@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

Highlighted

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

Explorer

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

Highlighted

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

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