iRule F5 logging for Maintenance page redirects

I need to edit 3 iRules to add logging to match Apache for these attributes.

Example Format:X-Forwarded-For; EventTime; Request; HTTP Status Code; Referer; User-Agent; Request Time; Host

Would someone help me?

when HTTP_REQUEST {
    if { 
        ([active_members [LB::server pool]] < 1)
    } then {
        log local0. "Client on Maintenance Page: [IP::client_addr]"
        HTTP::respond 200 content [ifile get portal_maintenance.html]
    }
}
To clarify
X-Forward for the IP where they're coming from and going to
EventTime for the time of the event
Request for the GET file GIF etc that they're requesting
HTTPStatuscode self explanatory
Referer is the previous URL link
User Agent has the browser OS
Request Time for the duration of the request.
Host is the main URL

See this to log HTTP headers.

Hi,

Sorry to say but some of data you need will not be easily retrievable without some smart iRule codding - check this link Apache Style Logging with HSL.

Should be good starting point.

Piotr

Anthony-

Below iRule will log everything except your event times/durations.

when HTTP_REQUEST {

set LogString “Client [IP::client_addr]:[TCP::client_port] → [HTTP::host][HTTP::uri]”

log local0. “=============================================”

log local0. “$LogString (request)”

foreach aHeader [HTTP::header names] {

log local0. “$aHeader: [HTTP::header value $aHeader]”

}

log local0. “=============================================”

}

when HTTP_RESPONSE {

log local0. “HTTP Status Code: [HTTP::status]”

}

Hope this helps!