Forum Discussion
Collect Browser Version (UserAgent) via iRule?
Hello,
Our development team has asked us for a list of browsers/versions that clients are using to access our sites.
Running BigIP LTM 12.1.1, would this need to be accomplished via an iRule and if so, this is what I've come up with so far:
log local0. "User-Agent:[HTTP::header "User-Agent"]"
I would like the iRule to dump the output to a log file and attach said iRule to a few VS in our environment.
6 Replies
- ekaleido
Cirrus
You've got it.
when HTTP_REQUEST { log local0. "User Agent: [HTTP::header "User-Agent"] } - Samir_Jha_52506
Noctilucent
Try to write irule like below.
when HTTP_REQUEST { log local0. "User-Agent:[HTTP::header "User-Agent"]" } Another option you could use is to build some in-memory reporting with the STATS profile/commands. You can create custom metrics and build an iRule to report them directly from a virtual server on the BIG-IP. If you want to automate archiving the content, then you can add a QUERY option to the request to the VIP to tell the iRule to build a different response format (csv, txt, etc) and build a curl script to pull it down regularly.
Here's something in that thought that I wrote a while ago around storing HTTP Status codes and reporting on them. Changing this to monitor User Agents wouldn't be that difficult.
https://devcentral.f5.com/articles/custom-reporting-with-irules
Good luck!
-Joe
- DaleLeBlanc_140
Nimbostratus
I have added log local0. "User Agent: [HTTP::header "User-Agent"] to my iRule. No matter if I use Chrome, IE, Firefox, or Safari, I get the same entry in the log:
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
Thoughts?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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