Created 02-04-2016 02:22 AM
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?
Created 02-28-2016 12:31 AM
Created 02-29-2016 02:11 AM
@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.
Created 02-04-2016 02:31 AM
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..
Created 02-04-2016 02:32 AM
@Junichi Oda Something like this
find /var/log/ranger/admin/ -mtime +30d -a -type f -print0 | xargs -0 rm
Created 02-04-2016 04:55 AM
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.
Created 02-27-2016 11:48 PM
@Junichi Oda Could you help me to close this thread by accepting the answer?
Created 02-29-2016 02:04 AM
Sorry my reply is late.
I have just accepted the answer. Thank you so much for your kindness.
Created 02-28-2016 12:31 AM
Created 02-28-2016 12:42 AM
@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
Created 02-29-2016 02:11 AM
@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.
Created 09-15-2017 01:16 PM
@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
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
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