Forum Discussion

Algebraic_Mirror's avatar
Algebraic_Mirror
Icon for Cirrostratus rankCirrostratus
Nov 14, 2019

LTM Request Logging Profile: How can it log HTTP headers?

I've been looking at the "Request Logging" profile in LTM, wanting to use it to log details of each HTTP request that LTM sees. But in additional to logging standard things like timestamp, URI, etc, ...
  • Simon_Blakely's avatar
    Nov 15, 2019

    That NULL can be ignored.

    The PARAMETERS are specified with $

    - eg $HTTP_METHOD

    to get a header, just specify the header with a leading $

    However, you may need to escape the header text with "{" and "}"

    Here is an example template that extracts header values

    $DATE_NCSA - |-REQ-| -- virtual=$VIRTUAL_NAME - http_class=$HTTP_CLASS -- client_ip=$CLIENT_IP client_port=$CLIENT_PORT snat_ip=$SNAT_IP snat_port=$SNAT_PORT lb_server=$SERVER_IP lb_port=$SERVER_PORT host=${host} username=${username} request=\"$HTTP_REQUEST\" user_agent=\"${User-agent}\" referer=\"${Referer}\"
    [14/Nov/2019: 16:53:06 -0800] - |-REQ-| -- virtual=/Common/http_vs - http_class= -- client_ip=172.16.0.147 client_port=45380 snat_ip= snat_port= lb_server=10.0.0.145 lb_port=80 host=172.16.0.250 username= request=\"GET / HTTP/1.1\" user_agent=\"curl/7.60.0\" referer=\"\"

    You can see the example logged output