Forum Discussion
TFalk_342445
Nimbostratus
Sep 10, 2018Logging sessionid in irule to select pool based on host header
I've been trying to add sessionid to my logs for my irule to select pools based on host-header. It seems easy enough, but I've still managed to fail somehow 😞
The basic iRule isn't very complicate...
youssef1
Cumulonimbus
Sep 10, 2018Hi,
You have to use event "ACCESS_ACL_ALLOWED", is triggered when a resource request passes the access control criteria and is allowed to go through the ACCESS filter.
when ACCESS_ACL_ALLOWED {
set req_start [clock clicks -milliseconds]
set clientip [IP::client_addr]
set method [HTTP::method]
set uri [HTTP::uri]
set referer [HTTP::header Referer]
set uid [string range [AES::key 256] 8 end]
set ua [HTTP::header User-Agent]
switch [string tolower [HTTP::host]] {
"monitoring.domain.com" {
set doSSL 1
pool monitoring
}
"tickets.domain.com" {
set doSSL 2
pool ticketsystem
}
default { reject }
}
log local0. "URI_LOG\t[ACCESS::session data get "session.user.sessionid"]\t$uid\t$clientip\t[clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S"]\t[expr {[clock clicks -milliseconds] - $req_start}]\t[LB::server addr]\t$referer\t[URI::query $uri]"
when SERVER_CONNECTED {
if {$doSSL == 1} {
SSL::profile MonitoringSSLProfile
} elseif {$doSSL == 2} {
SSL::profile TicketSystemSSLProfile
}
}
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
