Community Articles

Find and share helpful community-sourced technical articles.
Labels (2)
avatar
Expert Contributor

ISSUE :

If SOLR is configured as backend storage for ranger audits, ranger audit screen shows incorrect screen. This happens if server is running on any timezone other than UTC.

ROOT CAUSE :

'ranger-admin-services.sh' script uses below command to start ranger.

nohup  java -Dproc_rangeradmin ${JAVA_OPTS} -Dlogdir=${RANGER_ADMIN_LOG_DIR} -Dcatalina.base=${XAPOLICYMGR_EWS_DIR} -cp "${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf:${XAPOLICYMGR_EWS_DIR}/lib/*:${RANGER_JAAS_LIB_DIR}/*:${RANGER_JAAS_CONF_DIR}:${JAVA_HOME}/lib/*:${RANGER_HADOOP_CONF_DIR}/*:$CLASSPATH" org.apache.ranger.server.tomcat.EmbeddedServer > ${RANGER_ADMIN_LOG_DIR}/catalina.out 2>&1 &

If JAVA_OPTS value does not contain '-Duser.timezone=UTC', then Ranger admin runs in the local timezone. This causes timezone issue in viewing audit on Ranger UI as Ranger admin doesn't return eventtime in UTC format.

RESOLUTION :

This is fixed under https://issues.apache.org/jira/browse/RANGER-1249

WORKAROUND :

1. Create a file ranger-admin-env-javaopts.sh in /usr/hdp/current/ranger-admin/conf/ on the ranger admin server

2. Add the below contents in to the file.

export JAVA_OPTS=" ${JAVA_OPTS} -Duser.timezone=UTC"

3. chown ranger:ranger /usr/hdp/current/ranger-admin/conf/ranger-admin-env-javaopts.sh

4. chmod 755 /usr/hdp/current/ranger-admin/conf/ranger-admin-env-javaopts.sh

5. Restart Ranger admin.

1,488 Views