Skip to content

Advanced UDA configuration

This page details advanced UDA configuration options for kdb Insights.

Adding logging to UDAs

You can use the logging wrapper functions provided by kdb Insights, which streamlines the logging process provided by Qlog or.

  1. Make sure logging is enabled.

    Processes respect KXI_LOG_FORMAT, KXI_LOG_DEST, KXI_LOG_LEVELS or a KXI_LOG_CONFIG JSON file for routing and formatting, so set those as needed in your deployment.

    When debugging UDA issues, you can also follow the guidance in the UDA testing documentation and inspect DAP and Aggregator logs alongside your own log entries.

  2. Initialize logging in each code file:

    \d .example
    .log.initns[]
    
  3. Add log entries to the query and aggregation functions, making sure to use the namespace in the function call as follows:

    .example.log.info"Hello, world"
    

Recommendations

To assist with debugging debugging to have the following log entries as a minimum:

  • A debug log entry that takes the args dictionary or parameters

  • A completion log entry

  • Additional log entries specific to your code

Example:

\d .tca

.log.initns[];

.uda.example: {[args]
    / Log start with parameters
    log.debug("Starting .uda.example args=%d";args);

    //UDA code

    / Log that the function is complete
    .uda.log.info ".uda.example: complete";

    }
\d .uda

.log.initns[];

.uda.example:{[param1;param2]
    / Log start with parameters
    .uda.log.debug enlist[`param1`param2!
            ("Starting .uda.example"; param1; param2)];

    //UDA code

    / Log that the function is complete
    .uda.log.info ".uda.example: complete";

    }