Splitting Hive Logs into HiveServer2 and Metastore logs by Process ID
Starting from the 1904 release, you can split Hive log files into HiveServer2 and Metestore log files by process ID.
hive-log4j2.properties
file, if one does not already exist, and then edit
it: - If the
hive-log4j2.properties
file does not exist, create it from the template:cp /opt/mapr/hive/hive-<version>/conf/hive-log4j2.properties.template /opt/mapr/hive/hive-<version>/conf/hive-log4j2.properties
- Edit the
hive-log4j2.properties
file to replace Daily Rolling File Appender (DRFA) with the PID appender:#property.hive.root.logger = DRFA property.hive.root.logger = PID #appenders = console, DRFA appenders = console, PID
- Restart Hive services.
The HiveServer2 log is located at:
${HIVE_HOME}/log/<ADMIN_USER>/<ADMIN_USER>-hiveserver2-<HOSTNAME>.log.<PID>@<HOSTNAME>
Where: ${HIVE_HOME}
is the home folder for Hive.<ADMIN_USER>
is the administrator user of the cluster. Typically,mapr
.<HOSTNAME>
is the host where HiveServer2 log file is placed.<PID>
is the process ID of HiveServer2.
The Metastore log is located at:
${HIVE_HOME}/log/<ADMIN_USER>/<ADMIN_USER>-metastore-<HOSTNAME>.log.<PID>@<HOSTNAME>
Where: ${HIVE_HOME}
is the home folder for Hive.<ADMIN_USER>
is the administrator user of the cluster. Typically,mapr
.<HOSTNAME>
is the host where Hive Metastore log file is placed.<PID>
is the process ID of Hive Metastore.
Logging CLI session
After splitting logs for HiveServer2 and Hive Metastore, CLI log appears separately for
each CLI session at ${HIVE_HOME}/logs/<USERNAME>
.
A log file is created for every launched CLI session:
${HIVE_HOME}/log/<USERNAME>/<USERNAME>-hiveserver2-<HOSTNAME>.log.<PID>@<HOSTNAME>
Where
<PID>
is process identifier of the CLI session.