1

Earlier I had the same situation where the ClientIP in Application Insights Log records was showing as "0.0.0.0" and I learned that the following property can be set using "resources.azure.com", to enable showing the Client_IP using:

properties.DisableIpMasking

Recently we migrated the Application Insights Logs to Azure Log Analytics Workspace. Now, the Application Insights "Logs" shows the Client_IP whereas in Azure Log Analytics Workspace it doesn't.

Is there any settings available to enable the Client_IP in Azure Log Analytics Workspace - Logs records?

I want to see ClientIP in Azure Log Analytics Workspace => Logs section where we see the request details, like duration, url, path, etc.

PS: I'm able to get the ClientIP in Azure App Insights Logs.

Thanks in Advance!

3 Answers 3

2

I found this explanation

When telemetry is sent to Azure, Application Insights uses the IP address to do a geolocation lookup. Application Insights uses the results of this lookup to populate the fields client_City, client_StateOrProvince, and client_CountryOrRegion. The address is then discarded, and 0.0.0.0 is written to the client_IP field.

at https://learn.microsoft.com/en-us/azure/azure-monitor/app/ip-collection?tabs=net

and a potential fix is in the same article

To enable IP collection and storage, the DisableIpMasking property of the Application Insights component must be set to true. You can set this property through Azure Resource Manager templates (ARM templates) or by calling the REST API.

Sign up to request clarification or add additional context in comments.

Comments

1

Is there any settings available to enable the ClientIP in Azure Log Analytics Workspace - Logs ?

AFAIK, We don't have options for adding clientIP in Azure Log analytics Workspace. And even not available in resources.azure.comas log analytics uses default azure public IPs.

enter image description here

For more information please refer this GitHub discussion by @femsulu

1 Comment

thanks for your reply, Ajay. May I could not explain well. I want to see the source-IP-address for the incoming requests (in the log records). I will update my question as such. Thanks anyway.
0

As there was no way I could find to disable the IP masking on the Azure Log Analytics Workspace I ended up setting the disableIpMasking attribute on each individual application insights resource.

We have hundreds of Application Insights resources hence using Resource Explorer to do that was too much time consuming.

I used the following REST API endpoint to iterate over and update the resource properties:

az rest --method patch --url https://management.azure.com/subscriptions/<subscriptionId>/resourceGroups/<resource-group>/providers/microsoft.insights/components/<app-insights-resource-name>?api-version=2018-05-01-preview --headers Content-Type=application/json --body @body.json

body.json file contents


{
  "properties": {
    "DisableIpMasking": true
  }
}

Later I also found the Azure CLI command to do the same:

az resource update --ids --set properties.disableIpMasking=true


Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.