Kafka
  1. Kafka
  2. KAFKA-700

log client ip when we log each request on the broker

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 0.8.0
    • Fix Version/s: None
    • Component/s: clients
    • Labels:

      Description

      For debugging purpose, it's useful to know the client ip from which a request comes.

      1. Kafka-700-v2.patch
        12 kB
        Sriram Subramanian
      2. Kafka-700.patch
        11 kB
        Sriram Subramanian

        Activity

        Hide
        Jun Rao added a comment -

        This doesn't seem too hard. In Processor.read(), we can add socketChannel.socket.getRemoteSocketAddress() to RequestChannel.Request.

        Show
        Jun Rao added a comment - This doesn't seem too hard. In Processor.read(), we can add socketChannel.socket.getRemoteSocketAddress() to RequestChannel.Request.
        Hide
        Sriram Subramanian added a comment -

        You want the ip in RequestOrReponse object for it to be useful when logging the different requests. This would be in RequestChannel.Request.RequestOrReponse. We currently only deserialize from the received buffer to create this object. It would require little more plumbing to have the ip available in these request objects.

        Show
        Sriram Subramanian added a comment - You want the ip in RequestOrReponse object for it to be useful when logging the different requests. This would be in RequestChannel.Request.RequestOrReponse. We currently only deserialize from the received buffer to create this object. It would require little more plumbing to have the ip available in these request objects.
        Hide
        Jun Rao added a comment -

        I was thinking of just putting the ip in RequestChannel.Request.

        Show
        Jun Rao added a comment - I was thinking of just putting the ip in RequestChannel.Request.
        Hide
        Sriram Subramanian added a comment -
        • log remote address as part of handling request
        Show
        Sriram Subramanian added a comment - log remote address as part of handling request
        Hide
        Neha Narkhede added a comment -

        Thanks for the patch, Sriram! Few very minor comments -
        1. KafkaApis
        "from remote address" -> "from client"

        2. Request
        I don't think we need to have a default for remoteAddress, no ?

        Show
        Neha Narkhede added a comment - Thanks for the patch, Sriram! Few very minor comments - 1. KafkaApis "from remote address" -> "from client" 2. Request I don't think we need to have a default for remoteAddress, no ?
        Hide
        Sriram Subramanian added a comment -

        1. changed the string
        2. you need it because there are multiple test cases which create this object.

        Show
        Sriram Subramanian added a comment - 1. changed the string 2. you need it because there are multiple test cases which create this object.
        Hide
        Jun Rao added a comment -

        Looks good. Just 1 comment:

        10. RichString.format() seems expensive. We probably should use string + in the following statement.
        requestLogger.trace("Handling request: %s from remote address: %s".format(request.requestObj, request.remoteAddress))

        Show
        Jun Rao added a comment - Looks good. Just 1 comment: 10. RichString.format() seems expensive. We probably should use string + in the following statement. requestLogger.trace("Handling request: %s from remote address: %s".format(request.requestObj, request.remoteAddress))
        Hide
        Neha Narkhede added a comment -

        Checked in v2 after addressing Jun's suggestion

        Show
        Neha Narkhede added a comment - Checked in v2 after addressing Jun's suggestion

          People

          • Assignee:
            Sriram Subramanian
            Reporter:
            Jun Rao
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development