Search code examples
azureazure-digital-twins

How to view Azure Digital Twin user defined function log output


The User-defined function library reference lists a log() function. https://learn.microsoft.com/en-us/azure/digital-twins/reference-user-defined-functions-client-library

How does one go about viewing the output generated by this function?

I've looked around numerous places within the Azure dashboard. My best guess is to use a query such as

AzureDiagnostics
| where Category == "UserDefinedFunction" 

within a Log Analytics workspace that is referenced from the 'Log Analytics' value of a digital twins diagnostic setting. However this is returning zero results.

It would be extremely helpful if someone could point out exactly what needs to be enabled within the dashboard and where the logs should be available as it's totally unclear from the documentation.


Solution

  • I followed these two pages:

    The query I use is slightly different from yours, but it shows me all the results.

    AzureDiagnostics
    | where Category == "UserDefinedFunction" 
    

    The only part where the Microsoft documentation differs is in adding a new Diagnostic Setting to your Digital Twin instance: Diagnostic settings