Forum Discussion
Muhannad_64809
Nimbostratus
Jul 21, 2017Deploy different logging profiles based on the HTTP host-name or URI
Dears,
I have a scenario where i need to apply a logging profile based on URI of the hostname of the HTTP header.
For example:
When Http request: ---> i want to deploy logging profile EXAM...
Andy_McGrath
Cumulonimbus
Jul 24, 2017You have two key options with this, you can configure multiple High Speed Logging (HSL) publisher then select the preferred publisher based on some HTTP Request data.
To do this configure your HSL publishers then in an iRule use
HSL::open -publisher
to select and open the publisher. Once done you can use the HSL handler with:
HSL::send
Example:
when HTTP_REQUEST {
if {[HTTP:host] equals "www.test1.com "} {
set hsl [HSL::open -publisher /Common/test1HSL]
} else {
set hsl [HSL::open -publisher /Common/defaultHSL]
}
HSL::send $hsl "<190> [IP::client_addr]:[TCP::client_port]->[IP::local_addr]:[TCP::local_port]; [HTTP::host][HTTP::uri]"
}
Second option if you are not using or do not want to use HSL you can log directly within an iRule to a server or IP (which could be a VS to load balance logging) using the standard log option:
when HTTP_REQUEST {
if {[HTTP:host] equals "www.test1.com "} {
set logServer "192.168.0.1"
} else {
set logServer "192.168.0.99"
}
log $logServer local0.info "<190> [IP::client_addr]:[TCP::client_port]->[IP::local_addr]:[TCP::local_port]; [HTTP::host][HTTP::uri]"
}
Hope this helps 🙂
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