Forum Discussion
LTM Request Logging Profile: How can it log HTTP headers?
- 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
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
- Algebraic_MirrorNov 15, 2019Cirrostratus
Thank you so much for explaining this. That was exactly what I needed. I had managed to figure out how to get the built in variables to work with the dollar signs in front, but that NULL thing just threw me off. I didn't realize you could directly put headers in there like that. (I actually did try it, but just my luck, I tried it out on user-agent without escaping it, and the "-" broke it, so I thought that meant it didn't work that way. But had I known to escape it, it would have!)
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com