Forum Discussion
Robert_47833
Altostratus
Jun 01, 2011wanna record user_agent from specific client ip
Hi
I have a requirement
it seems impossible
we want to record user_agent from some specific client ip
when CLIENT_ACCEPTED {
if
{ [IP::addr [IP::client_addr] equals 174.76.19.40] }
{ log local0. " 174.76.19.40 uses [HTTP::header value user_agent]" }
}
this irule doesn't work,because HTTP::header can't be used in CLIENT_ACCEPTED event
How should I do to achieve this goal
13 Replies
Sort By
- hoolio
Cirrostratus
Hi Jucao,when CLIENT_ACCEPTED { if { [IP::addr [IP::client_addr] equals 174.76.19.40] } { set log_ua 1 } else { set log_ua 0 } } when HTTP_REQUEST { if { $log_ua == 1 } { log local0. " 174.76.19.40 uses [HTTP::header value user_agent]" } }
- richard_77048
Nimbostratus
Aaron,when HTTP_REQUEST { if { [IP::client_addr] equals 174.76.19.40 } { log local0. " 174.76.19.40 uses [HTTP::header value user_agent]" } }
- hoolio
Cirrostratus
Hi Richard, - dubdub
Nimbostratus
Hi Aaron, - JRahm
Admin
Hi Jen, check out the optimization 101 articles, doesn't directly address event-specific command usage, but that's a good one to add to the list. - hoolio
Cirrostratus
Hi Jen, - Robert_47833
Altostratus
ok,thanks ,everyone - hoolio
Cirrostratus
You should use the full iRule. If you removed the else clause, you'd get a runtime error for every other client IP when the log_ua variable doesn't exist. The iRule as I wrote it will do what you're looking for and just log the User-Agent header for that specific client IP address. - Robert_47833
Altostratus
oh,yes,hoolio - hoolio
Cirrostratus
I expect you'll get a TCP reset if the variable doesn't exist. If you use the full iRule I posted the iRule will function for that specific client IP and all other client IPs. It will only log for that specific client IP.
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