A few issues with your iRule, you are looking at the HTTP::path for a Query parameter which will never exist.
Lets say the request is
https://some.host.com/this/is/the/path?jsessionid=thequerypart
You would get the following returned from different iRule commands:
Your iRule would never find locate the
jsessionid
query and is only updating the HTTP path not the query.
The following iRule does the same but using
HTTP::uri
instead of
HTTP::path
:
First use hsl::open to define where to send logs and save it as a variable HSL
when CLIENT_ACCEPTED {
set hsl [HSL::open -proto UDP -pool graylog2-syslog-pool]
}
when HTTP_REQUEST {
Check if the URI contains a jsessionid
if {[HTTP::uri] contains ";jsessionid="}{
Create variable to hold modified URI, split on ;jsessionid
set nojsession [getfield [HTTP::uri] ";jsessionid=" 1]
Write to log verify that the if clause and the variable are correct
HSL::send $hsl "webmod This is the $nojsession without sessionid"
Replace the URI with the variable (modified URI without jsessionid)
HTTP::uri $nojsession
}
}
Quick note about this iRule if the request contains any query parameters after the
jsessionid
then they will be lost as the
getfield
command only takes the first part of the URI.
e.g. If the URI requested is
/this/is/the/path?page=test;jsessionid=thequerypart;user=bob
the updated request would be
/this/is/the/path?page=test
and the query parameter
user=bob
would be lost.