Forum Discussion
Remove 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_msg "" append log_msg "$client_ip"
The result in the log file is "192.168.1.5%1" but i need to have it without the "%1". I'm wondering if a regex could do the job inside my Irule but i'm stucked in finding a way. Any help would be appreciated Aurel
19 Replies
- Kevin_Stewart
Employee
Try this:
set rd "%[ROUTE::domain]" set client_ip [string map "$rd \"\"" [IP::client_addr]]The biggest problem was that you were trying to evaluate variable substitution inside curly braces, which was treating $rd as a literal string.
- Aurel
Cirrus
Hi, This is doing the job : set rd "%[ROUTE::domain]" set client_ip [string map "$rd \"\"" [IP::remote_addr]]
- Josh_Abaire
Nimbostratus
Can anyone explain what the backslash is for? "$rd \"\""
If this works: string map {%1 "" %2 "" %3 ""} [IP::client_addr]
Why doesn't this work?: string map {$rd ""} [IP::client_addr]
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