Forum Discussion
hooleylist
Cirrostratus
Aug 31, 2009String map won't work with variables wrapped in curly braces. So you can either use subst like Joe listed, or remove the curly braces. Also, Citizen's suggestion was to add a second HTTP request event with a priority of 501 so you could see the effect of the change once it is made. And you'll need to include a leading forward slash in the scan pattern or it won't match any URI.
Can you try this and reply with the log output from /var/log/ltm if it doesn't work expected?
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: New HTTP request to [HTTP::uri]"
if { [HTTP::uri] contains "adserver/impression" }{
log local0. "[IP::client_addr]:[TCP::client_port]: Matched URI check"
Scan the URI looking for the pid, oid and rand values
if { [scan [HTTP::uri] "/adserver/impression/pid=%d/oid=%d/rand=%d" pid oid rand] == 3 } {
log local0. "[IP::client_addr]:[TCP::client_port]: Scanned three values: pid = $pid, oid = $oid, rand = $rand"
HTTP::uri [string map "adserver/impression/pid=$pid/oid=$oid/rand=$rand/?click ad.imp?pid=$pid&oid=$oid&rand=$rand/?pclk" [HTTP::uri]]
}
}
}
when HTTP_REQUEST priority 501 {
log local0. "[IP::client_addr]:[TCP::client_port]: 501: Updated URI: [HTTP::uri]"
}
Aaron