[
https://issues.apache.org/jira/browse/RANGER-4024?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ramachandran updated RANGER-4024:
---------------------------------
Description:
In Ranger, we do not have the correlation Id which needs to be stored in the
logs whenever we get the requestId header from the caller microservice
Proposal:
RangerMDCFilter will capture the correlation Id which needs to be stored in
the logs whenever we get the requestId header from the caller microservice
This RangerMDCFilter can be enabled in the web.xml and logging
ConversionPattern
{code:java}
<filter>
<filter-name>RangerMDCFilter</filter-name>
<filter-class>org.apache.ranger.security.web.filter.RangerMDCFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>RangerMDCFilter</filter-name>
<url-pattern>/service/*</url-pattern>
</filter-mapping>{code}
and to change the conversion pattern to something like this, using the %X{}
placeholder for each entry contained in the MDC we want to be logged:
Example:
{code:java}
<appender name="xa_log_appender"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<!--See http://logback.qos.ch/manual/appenders.html#RollingFileAppender-->
<!--and
http://logback.qos.ch/manual/appenders.html#TimeBasedRollingPolicy-->
<!--for further documentation-->
<file>${logdir}/ranger-admin-${hostname}-${user}.log</file>
<append>true</append>
<encoder>
<pattern>%date [%thread] %level{5} [%file:%line]
[requestId=%X{OPC_REQUEST_ID}] %msg%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${logdir}/ranger-admin-${hostname}-${user}.log.%d{yyyy-MM-dd}</fileNamePattern>
<maxHistory>15</maxHistory>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
</appender>{code}
was:
In Ranger, we do not have the correlation Id which needs to be stored in the
logs whenever we get the requestId header from the caller microservice
Proposal:
RangerMDCFilter will capture the correlation Id which needs to be stored in
the logs whenever we get the requestId header from the caller microservice
This RangerMDCFilter can be enabled in the web.xml and logging
ConversionPattern
{code:java}
<filter>
<filter-name>RangerMDCFilter</filter-name>
<filter-class>org.apache.ranger.security.web.filter.RangerMDCFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>RangerMDCFilter</filter-name>
<url-pattern>/service/*</url-pattern>
</filter-mapping>{code}
and to change the conversion pattern to something like this, using the %X{}
placeholder for each entry contained in the MDC we want to be logged:
log4j.appender.consoleAppender.layout.ConversionPattern=
%-4r [%t] %5p %c\{1} %x - %m - correlationId=%X\{REQUEST_ID} %n
> Adding correlationId as part of Ranger logs via RangerMDCFilter
> ---------------------------------------------------------------
>
> Key: RANGER-4024
> URL: https://issues.apache.org/jira/browse/RANGER-4024
> Project: Ranger
> Issue Type: Improvement
> Components: Ranger
> Affects Versions: 2.3.0
> Reporter: Ramachandran
> Assignee: Ramachandran
> Priority: Major
> Fix For: 3.0.0
>
>
> In Ranger, we do not have the correlation Id which needs to be stored in the
> logs whenever we get the requestId header from the caller microservice
> Proposal:
> RangerMDCFilter will capture the correlation Id which needs to be stored in
> the logs whenever we get the requestId header from the caller microservice
> This RangerMDCFilter can be enabled in the web.xml and logging
> ConversionPattern
>
> {code:java}
> <filter>
> <filter-name>RangerMDCFilter</filter-name>
> <filter-class>org.apache.ranger.security.web.filter.RangerMDCFilter</filter-class>
> </filter>
> <filter-mapping>
> <filter-name>RangerMDCFilter</filter-name>
> <url-pattern>/service/*</url-pattern>
> </filter-mapping>{code}
>
> and to change the conversion pattern to something like this, using the %X{}
> placeholder for each entry contained in the MDC we want to be logged:
> Example:
> {code:java}
> <appender name="xa_log_appender"
> class="ch.qos.logback.core.rolling.RollingFileAppender">
> <!--See http://logback.qos.ch/manual/appenders.html#RollingFileAppender-->
> <!--and
> http://logback.qos.ch/manual/appenders.html#TimeBasedRollingPolicy-->
> <!--for further documentation-->
> <file>${logdir}/ranger-admin-${hostname}-${user}.log</file>
> <append>true</append>
> <encoder>
> <pattern>%date [%thread] %level{5} [%file:%line]
> [requestId=%X{OPC_REQUEST_ID}] %msg%n</pattern>
> </encoder>
> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>
> <fileNamePattern>${logdir}/ranger-admin-${hostname}-${user}.log.%d{yyyy-MM-dd}</fileNamePattern>
> <maxHistory>15</maxHistory>
> <cleanHistoryOnStart>true</cleanHistoryOnStart>
> </rollingPolicy>
> </appender>{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)