Forum Discussion

Mike_Rausch_628's avatar
Mike_Rausch_628
Icon for Nimbostratus rankNimbostratus
Aug 14, 2007

TCP Info Logging

I am trying to write an irule that will log the TCP info that is being sent to and from the server/client. What exactly does the TCP::collect command grab?

1 Reply

  • TCP::collect gets the raw bytes that are sent. The data collected will be available in the CLIENT_DATA event.

    For example:

    
    when CLIENT_ACCEPTED {
    TCP::collect 16
    }
    when CLIENT_DATA {
     For logging in other events
    set cli "[IP::client_addr]:[TCP::remote_port]"
    set dataVal [TCP::payload]
    binary scan $dataVal H16 hexRep
    log local0. "TCP connection ($cli) sent: $hexRep"
    }

    When the client connects this will cause (at least) 16 bytes to be collected. It then converts that data to a hex representation and logs it.