Forum Discussion
Request logging - log backend server name
JG, using request logging for the "Host" header is actually very straight forward. "$Host" will work.
This is what my current request logging template looks like, json formatted:
{"DATE":"$DATE_MM/$DATE_DD/$DATE_YY", "TIME":"$TIME_MSECS", "CIP":"$CLIENT_IP", "VIP":"$VIRTUAL_IP", "PORT":"$VIRTUAL_PORT", "BACKENDPOOL":"$VIRTUAL_POOL_NAME", "BACKENDSERVER":"$SERVER_IP", "BACKENDPORT":"$SERVER_PORT", "METHOD":"$HTTP_METHOD", "HOST":"$Host", "PATH":"$HTTP_PATH", "QUERY":"$HTTP_QUERY", "STATUS":"$HTTP_STATCODE", "REFERER":"$Referer", "USERAGENT":"${User-agent}", "SESSIONID":"${Cookie[SESSION]}", "XFF":"${X-Forwarded-For}", "LOCATION":"${Location}", "URI":"$HTTP_URI"}
I historically have had issues with using an iRule for logging. It also means that I need to bind that iRule to every single VIP - which isn't as scalable as enabling a request logging profile with the default setting turned on.
Hopefully, this helps you out.
Are you sure it logs the "Host" header in the request and not the name of the F5 virtual server? To me, it seems it should be called something like "HTTP_HOST" instead. if it does work, it is certainly not documented for this profile of request logging, and F5 TAC knew nothing about it when I asked them.
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