skip to Main Content

Their are some sensitive APIs that are onboarded on APIM and i want no logging to be done for them due to security concerns.

Was able to get many things but none of them work and was not in the will to make custom appsinsights to be done so it just reject those logs is that the only way to not log few apis.

Have tried multiple policy both global and api level none worked till now

2

Answers


  1. Chosen as BEST ANSWER

    I got the solution just use the settings option of apim api and set it to 0%

    Steps to diable logging


  2. <inbound>
        <base />
        <choose>
            <when condition="@(context.Request.OriginalUrl.Path.Contains("/specific-endpoint"))">
                <set-variable name="disableLogging" value="true" />
            </when>
            <otherwise>
                <set-variable name="disableLogging" value="false" />
            </otherwise>
        </choose>
        <log-to-eventhub logger-id="your-eventhub-logger-id" />
        <choose>
            <when condition="@(context.Variables.GetValueOrDefault<bool>("disableLogging") == false)">
                <!-- Include logging policy here -->
            </when>
        </choose>
    </inbound>

    APIM policies allow you to define how your APIs are processed. You can use policies to enable or disable logging dynamically. Here’s an example of how you can control logging with policies:

    1. Go to your API in the APIM portal.
    2. Select the Design tab.
    3. Choose the operation you want to configure or apply a policy at the API level if it’s for multiple operations.
    4. Select Inbound processing or Outbound processing, depending on where you want to apply the policy.
    5. To disable logging for specific endpoints, you would typically use a conditional policy expression. For example:
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search