Forum Discussion
Robert_47833
Jun 01, 2011Altostratus
wanna 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
- hooleylistCirrostratusHi 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_77048NimbostratusAaron,
when HTTP_REQUEST { if { [IP::client_addr] equals 174.76.19.40 } { log local0. " 174.76.19.40 uses [HTTP::header value user_agent]" } }
- hooleylistCirrostratusHi Richard,
- dubdubNimbostratusHi Aaron,
- JRahmAdminHi 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.
- hooleylistCirrostratusHi Jen,
- Robert_47833Altostratusok,thanks ,everyone
- hooleylistCirrostratusYou 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_47833Altostratusoh,yes,hoolio
- hooleylistCirrostratusI 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