Forum Discussion
rmd1023
Oct 09, 2013Nimbostratus
iRule to log a specific field in POST data
I'd like to have an irule log the authentication attempts for a web application I have that takes POST data. How do I pull a specific POST parameter out of the http content?
Suppose I have a ...
Kevin_Stewart
Oct 09, 2013Employee
Please try this:
when HTTP_REQUEST {
if { ( [string tolower [HTTP::uri]] equals "/loginform.html" ) and ( [HTTP::method] equals "POST" ) } {
HTTP::collect [HTTP::header Content-Length]
}
}
when HTTP_REQUEST_DATA {
set username "unknown"
foreach x [split [string tolower [HTTP::payload]] "&"] {
if { $x starts_with "username=" } {
set username [lindex [split $x "="] 1]
}
}
log local0. "User $username attempted login from [IP::client_addr]:[TCP::client_port]"
}
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