-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54622/
-----------------------------------------------------------

Review request for ranger, Ankita Sinha, Don Bosco Durai, Gautam Borad, Abhay 
Kulkarni, Madhan Neethiraj, Mehul Parikh, Ramesh Mani, Selvamohan Neethiraj, 
and Velmurugan Periasamy.


Bugs: RANGER-1249
    https://issues.apache.org/jira/browse/RANGER-1249


Repository: ranger


Description
-------

**Problem Statement:**
ranger-admin-services.sh script usage 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 &
Above command usage JAVA_OPTS environment variable. 
if JAVA_OPTS value does not contains '-Duser.timezone=UTC' then ranger admin 
runs in local timezone rather UTC which causes timezone issue in viewing audit 
logs at UI end as ranger admin doesn't return eventtime in UTC format.

**Use Case :** Currently '-Duser.timezone=UTC' argument need to provided to 
ranger-admin-services.sh through JAVA_OPTS variable; if anyone fails to do so 
and if -Duser.timezone=UTC is not set then ranger service start in local 
timezone. if ranger admin service is not running in UTC then ranger audit log 
rest api returns audit eventtime according to localtime zone of server; UI code 
expect event time to be in UTC format and convert in browser timezone format 
for user. if received eventtime is not in UTC then UI may do the wrong 
conversion which is not sync with end user timezone.

**Proposed Solution** : Rather expecting user to provide '-Duser.timezone=UTC' 
argument in JAVA_OPTS; an export statement(export JAVA_OPTS=" ${JAVA_OPTS} 
-Duser.timezone=UTC") can be added in ranger-admin-services.sh file which shall 
be executed during ranger admin setup and set the attribute -Duser.timezone=UTC 
in JAVA_OPTS variable if its not there.


Diffs
-----

  embeddedwebserver/scripts/ranger-admin-services.sh 515e010 

Diff: https://reviews.apache.org/r/54622/diff/


Testing
-------

**Case-1 : Ranger Admin installation and creation of 
ranger-admin-env-javaopts.sh file:**
**Steps Performed (with patch) :**
1. After mvn Build; untar the Ranger admin module and updated 
install.properties for MySQL DB flavor.
2. Changed machine timezone to IST.
3. Called setup.sh to install Ranger.
4. Changed current working directory to ews.
3. Executed ./ranger-admin-services.sh start command to start ranger.
4. Excecuted ps -ef | grep ranger-admin command.

**Expected Behavior : ** ranger-admin service should start with 
'-Duser.timezone=UTC' attribute.

**Actual Behavior :** ranger-admin service started with '-Duser.timezone=UTC' 
attribute and was running in UTC timezone.

Note : Please refer latest logs timestamp of ranger-admin.log file to findout 
on which timezone ranger-admin is running.


Thanks,

Pradeep Agrawal

Reply via email to