Forum Discussion
TJ_Vreugdenhil
Mar 03, 2014Cirrus
APM W3C Local Logging iRule
Hi
We are using the local logging irule found here on devcentral:
https://devcentral.f5.com/wiki/irules.FormattedLoggingForW3c.ashx
Everything seems to populate correctly, except for the H...
TJ_Vreugdenhil
Mar 06, 2014Cirrus
Here is what I ended with. The sessiondump was a big help. Thank you sir!
ltm rule APM_LOCAL_LOGGING {
version 1.0 - edits by TJ Vreugdenhil - added APM variables
This iRule should be applied to VIP's associated with APM's. If you would like to find more APM
variables to log, use the 'sessiondump ' after a user is logged in to see the list
possible variables to log agaisnt.
when HTTP_REQUEST {
Save Request Side Information
set http_request "\"[HTTP::method] [HTTP::uri] HTTP/[HTTP::version]\""
set http_request_time [clock clicks -milliseconds]
set http_user_agent "\"[HTTP::header User-Agent]]\""
set http_host [HTTP::host]
set client_ip [IP::remote_addr]
set client_port [TCP::remote_port]
set http_request_uri [HTTP::uri]
set referer [HTTP::header value referer]
}
when HTTP_RESPONSE {
set apmprofile [ACCESS::session data get "session.access.profile"]
set sessionid [ACCESS::session data get "session.user.sessionid"]
set userid [ACCESS::session data get "session.logon.last.logonname"]
set userip [ACCESS::session data get "session.user.clientip"]
set response_time [expr [clock clicks -milliseconds] - $http_request_time]
set virtual [virtual]
set content_length 0
if { [HTTP::header exists "Content-Length"] } {
set content_length [HTTP::header "Content-Length"]
}
set lb_server "[LB::server addr]:[LB::server port]"
if { [string compare "$lb_server" ""] == 0 } {
set lb_server ""
}
set status_code [HTTP::status]
set content_type [HTTP::header "Content-type"]
set log_msg ""
append log_msg "sessionid=$sessionid "
append log_msg "apmprofile=$apmprofile "
append log_msg "virtual=$virtual "
append log_msg "userid=$userid "
append log_msg "userip=$userip "
append log_msg "client_ip=$client_ip "
append log_msg "client_port=$client_port "
append log_msg "lb_server=$lb_server "
append log_msg "host=$http_host "
append log_msg "$http_request_uri "
append log_msg "request=$http_request "
append log_msg "server_status=$status_code "
append log_msg "content_type=$content_type "
append log_msg "content_length=$content_length "
append log_msg "resp_time=$response_time "
append log_msg "user_agent=$http_user_agent "
append log_msg "referer=$referer"
log local0. $log_msg
log local0. $log_msg
}
}
Here is the log message:
`Mar 6 10:33:01 OR0506DA05 info tmm[12688]: Rule /Common/APM_LOCAL_LOGGING : sessionid=9ce2d922 apmprofile=/Common/RDP-NO-AUTH-TEST virtual=/Common/F5VIPSPORTAL userid=TJ userip=10.26.243.127 client_ip=10.26.243.127 client_port=18935 lb_server=127.1.1.2:8080 host=172.26.4.57 request="GET /vdesk/resource_info.xml HTTP/1.1" server_status=200 content_length=1666 resp_time=2 user_agent="Mozilla/5.0 (Windows NT 6.1; rv:27.0) Gecko/20100101 Firefox/27.0]" referer=https://172.26.1.1/vdesk/webtop.eui?webtop=/Common/RDP&webtop_type=webtop_full`
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects