Forum Discussion

wsanders_233261's avatar
wsanders_233261
Icon for Nimbostratus rankNimbostratus
Sep 18, 2017

Can't get ltm policy to log

I have the following policy:

modify policy httptohttps-POLICY {
    controls { forwarding }
    requires { http }
    rules replace-all-with {
        httptohttpsRULE {
            actions replace-all-with {
                0 {
                    http-reply
                    redirect
                    location "https://[getfield [HTTP::host] \":\" 1][HTTP::uri]"
                }
                1 {
                    log
                    write
                    message "REDIRECTED: https://[getfield [HTTP::host] \":\" 1][HTTP::uri]"
                }
            }
            ordinal 1
        }
    }
    strategy first-match
}

It doesn't seem to log anything. This is tmsh 11.6. How do I get logging to work? How can I get it to log to local0.debug?

1 Reply

  • Change the log message itself to include "tcl:" in front of the rest of the string. In other words, in order to do command substitution for the getfield, HTTP::host, and HTTP::uri commands, you need to indicate that this is a tcl string. Something like this:

     

    tcl:REDIRECTED: https://[getfield [HTTP::host] \":\" 1][HTTP::uri]