Search code examples
azureazure-logic-appspowerapps

How to query Service Bus past executions in logs by ids from the payloads processed?


TLDR; How do I get more detailed queryable logs in Azure log apps?

I have created a logic app that polls messages from a service bus and then sends them to a downstream service.

In case of a customer ticket or errors logged downstream, I want to query the past execution of the logic apps to see in which call a particular id within the payload, or at the least, the service bus message id was processed.

It's cumbersome to scan all executions one by one to look for an id in a step in the execution.

I have enabled log analytics but I see it only captures execution id and some metadata but not logs of the actions and the payload.

As shown below, I see some additional settings in the configure log analytics section, but need to know how to enable logs to be able to query detailed logs along with data processed and not just metadata.

enter image description here


Solution

  • Using Tracked properties you can view session id, content of message, Lock Token etc. Here I have used content of the message in Tracked properties and I can see the content Log analytics workspace.

    1. Created Logic app as shown below,

    enter image description here

    1. Using logic app I am sending messages from one queue to another queue.
    2. In send message action, Added TrackedProperties as shown below, enter image description here Here added value for Tracked Properties as
    "@base64ToString(triggerBody()?['ContentData'])"
    
    1. In logic app added Diagnostic setting and configured Log analytics workspace as shown below, enter image description here
    2. The runs of logic app can be viewed in Log analytics workspace as shown below, enter image description here
    3. Click on Success or Failed runs as per requirement. I have selected Sucess runs and details are like, enter image description here
    4. Click on view in Tracked properties then you can see content of message, enter image description here

    In this way you can data or ids in Log analytics workspace.

    Reference: Link1, Link2