DataScript: avi.vs.log

DataScript

Function avi.vs.log()
Description Generate a log associated with the connection or request and viewed within the Virtual Service > Client Log page. A log field is created called datascript_log, containing the DataScript’s name and the output of the avi.vs.log command. If avi.vs.log is called multiple times, the output of each invocation goes in the same datascript_log field in the client log.
Events HTTP_REQ
HTTP_RESP
HTTP_RESP_DATA
HTTP_REQ_DATA
HTTP_RESP_FAILED
LB_DONE
LB_FAILED
AUTH
POST_AUTH
SSL_HANDSHAKE_DONE
SSL_CLIENT_HELLO
SSL_PRE_CONNECT

Note: Starting with NSX Advanced Load Balancer version 21.1.3, events HTTP_RESP_DATA, HTTP_REQ_DATA, HTTP_RESP_FAILED, LB_DONE, and LB_FAILED are supported.
Parameter
  • Logs may contain any arbitrary combination of string, number, Boolean and nil values.
  • If the last argument avi.SIG_ENABLE passed, the connection log is converted to a significant log.
  • Returns None
    Example From DataScript "Log1" HTTP_REQ event:
    avi.vs.log("Hello World!")
    From DataScript "Log2" HTTP_RESP event:
    num = 2
    avi.vs.log("Hello " .. num .. " You!")
    Output from the client log:

    DataScript Log: [string "Log1"]:1: Hello World!
    
    DataScript Log: [string "Log2"]:1: Hello 2 You!
    Note: The logs are prefixed by meta information, which is generally the function name and line number calling avi.vs.log(). When the call is not made from a function, the name is the name of the script (in our example, the script is a string, not a file, named Log1).
    Significant Logging Example:
    From DataScript "Log1" HTTP_REQ event:
    avi.vs.log("Hello World!", avi.SIG_ENABLE)
    Output from the client log:
    DataScript Log: [string "Log1"]:1: Hello World!
    Significance: Datascript Significant Log.