Forum Discussion
Aurel
Cirrus
Aug 28, 2013Remove characters from logging Irule entry
Hello,
I would like to remove the routing domain suffix "%1" in the log file i'm creating.
Here's a sample of my Irule.
when HTTP_REQUEST {
set client_ip [IP::remote_addr]
set log_m...
Kevin_Stewart
Employee
Aug 29, 2013I was showing you performance output using TCLSH from the command line and the time command. It's probably not likely that you have more than a few defined route domains, all of which you know about in advance, so a literal string map is probably most efficient:
set clientip [string map {%1 "" %2 "" %3 ""} [IP::client_addr]]
log local0. "Request from: $clientip"
If, however, you truly need something more dynamic, then a regular expression will work. Keep in mind of course that a regular expression is, in general, going to be more CPU-intensive.
set clientip [regsub {%\d+} [IP::client_addr] ""]
log local0. "Request from: $clientip
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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