Forum Discussion

Assad_314410's avatar
Assad_314410
Icon for Nimbostratus rankNimbostratus
Mar 20, 2018

Irule to identify what data group a client uses once they hit the VIP

Hello,

 

We have some external VIPS that clients connect to with their unique url. I have some Irules in place that logs source IP and also TLS version.

 

The problem is I have the clients IP addresses coming into the VIP and the TLS version although i need something to identify the client name, such as data group or the full url they are using.

 

Is anyone able to help me create an additional irule that logs client source IP and the full url path they target or data group.

 

Thanks

 

Assad

 

1 Reply

  • Hi Assad,

    If your URLs are unique per client as you say, they you could use a datagroup to maintain an index of client name and URI and use the

    -value
    switch to return the client name.

    E.g.

    Datagroup:

    ltm data-group internal client_uri_dg {
        records {
            /somepath/unique-field1 {
                data "client-1"
            }
            /somepath/unique-field2{
                data "client-2"
            }
        }
        type string
    }
    

    iRule

    when HTTP_REQUEST {
        if {[class match [HTTP::uri] starts_with client_uri_dg} {
            set clientName [class match -value [HTTP::uri] starts_with client_uri_dg]
            log local0. "Request from client: $clientName"
        }
    }