Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

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

avatar
Rising Star

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?

2 ACCEPTED SOLUTIONS

avatar
Rising Star

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

View solution in original post

9 REPLIES 9

avatar
Master Mentor
@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..

avatar
Master Mentor

@Junichi Oda Something like this

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

avatar
Rising Star
@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.

avatar
Master Mentor

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

avatar
Rising Star
@Neeraj Sabharwal

Sorry my reply is late.

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

avatar
Master Mentor

@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

avatar
Rising Star

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

avatar
Contributor

@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