@Override
  public void channelRead(ChannelHandlerContext ctx, Object obj) throws Exception {
    logger.trace("Reading on channel {}", ctx.channel());
    long startTimeInMs = System.currentTimeMillis();
    if (obj instanceof HttpRequest) {
      nettyMetrics.publicAccessLogRequestRate.mark();
      if (request != null) {
        logDurations();
        logMessage.append(" : Received request while another request in progress. Resetting log message.");
        logger.error(logMessage.toString());
      }
      reset();
      requestArrivalTimeInMs = System.currentTimeMillis();
      request = (HttpRequest) obj;
      logMessage.append(ctx.channel().remoteAddress()).append(" ");
      structuredLogMessage.put("remoteAddress", String.valueOf(ctx.channel().remoteAddress()));
      logMessage.append(request.method().toString()).append(" ");
      structuredLogMessage.put("method", String.valueOf(request.method()));
      logMessage.append(request.uri()).append(", ");
      structuredLogMessage.put("uri", String.valueOf(request.uri()));
      logSSLInfo(ctx);
      logMessage.append(", ");
      logHeaders("Request", request, publicAccessLogger.getRequestHeaders());
      logMessage.append(", ");
    } else if (obj instanceof LastHttpContent) {
      requestLastChunkArrivalTimeInMs = System.currentTimeMillis();
    } else if (!(obj instanceof HttpContent)) {
      logger.error(
          "Receiving request (messageReceived) that is not of type HttpRequest or HttpContent. Receiving request from {}. Request is of type {}. No action being taken other than logging this unexpected state.",
          ctx.channel().remoteAddress(), obj.getClass());
    }
    nettyMetrics.publicAccessLogRequestProcessingTimeInMs.update(System.currentTimeMillis() - startTimeInMs);
    super.channelRead(ctx, obj);
  }
Captures headers and other required info from request and responses, to make public access log entries
{@link PublicAccessLogger} assists in logging the required information
ambry-rest/src/main/java/com/github/ambry/rest/PublicAccessLogHandler.java