Forum Discussion
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]
}
}4 Replies
- aghazi
Nimbostratus
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 - dragonflymr
Cirrostratus
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
- P_K
Altostratus
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!
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
