Forum Discussion
User agent query - iRule
Hi, Im wondering is it possible to setup an iRule which will just log the IP address and also the exact type/version of browser that hits my VIP? And if so, some direction would be amazing.. cheers guys :)
v11
- What_Lies_Bene1Cirrostratus
It is, try this;
when SERVER_CONNECTED { log local0. "Client IP: [IP::client_addr], Client User Agent: [HTTP::header value User-Agent]" }
May not work or may log continuously if OneConnect is enabled and/or with some persistence methods.
- JPV_131616Cirrus
when HTTP_REQUEST { log local0. "SRC IP: [IP::remote_addr]" log local0. "User-Agent: [string tolower [HTTP::header User-Agent]]" }
- What_Lies_Bene1CirrostratusHey JPV, just note that this will generate a log entry for every request within a single session whereas using the CLIENT_CONNECTED event generates just one.
- JPV_131616Cirrus
you are correct.
However, I didn't think you can get user-agent out of a CLIENT_CONNECTED event.
thx
- What_Lies_Bene1CirrostratusDoh! Indeed. That being the case I'd suggest SERVER_CONNECTED which could occur more than once but not on every request.
- superd_88943Nimbostratus
hi guys.. thanks a million for responses..
one question.. can you advise why i wouldnt be able to extract a user-agent from a CLIENT_CONNECTED, but can for a SERVER_CONNECT?
- What_Lies_Bene1Cirrostratus
Sure, CLIENT_CONNECT occurs before any HTTP is passed (only the three way handshake has occured). With SERVER_CONNECT again only the three way handshake has occurred, server side but client side the HTTP request has been received and parsed.
In other words, all the required client side events have occured before the first server side one, SERVER_CONNECT.
Recent Discussions
Related Content
* 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