Skip to content

Conversation

@Fiery-Fenix
Copy link
Contributor

Description

This is a second part from the set of Azure Resource Log parsing implementations in azure_encoding extension.
This part is bringing this extension functionality in parity with pkg/translator/azurelogs in terms of supported Azure Resource Log Categories (and even a bit more than azurelogs has).

Link to tracking issue

Part of #41725

Testing

Corresponding Unit Test were added.

Documentation

Readme is updated with fields mapping information for supported Azure Resource Log Categories.

| `cacheStatus` | `azure.cache_status` | Log Attribute |
| `errorInfo` | `exception.type` | Log Attribute |
| `endpoint` | `destination.address` + `destination.port` if it is equal to `hostName` or `network.peer.address` + `network.peer.port` otherwise. If unparsable - `destination.address.original` | Log Attribute |
| `hostName` | `destination.address` + `destination.port`. If unparsable - `destination.address.original` | Log Attribute |
Copy link
Contributor

@thompson-tomo thompson-tomo Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this not

Suggested change
| `hostName` | `destination.address` + `destination.port`. If unparsable - `destination.address.original` | Log Attribute |
| `hostName` | `host.name` | Log Attribute |

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to http.request.header.host as it described in documentation:

The host name in the request from client. If you enable custom domains and have wildcard domain (*.contoso.com), the HostName log field's value is subdomain-from-client-request.contoso.com. If you use the Azure Front Door domain (contoso-123.z01.azurefd.net), the HostName log field's value is contoso-123.z01.azurefd.net

Copy link
Contributor

@thompson-tomo thompson-tomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have attempted to be consistent with network attributes. Key thing is client/server attributes are 1 pair source/destination is another pair and both pairs shouldn't be used together.

| `requestBytes` | `http.request.size` | Log Attribute |
| `responseBytes` | `http.response.size` | Log Attribute |
| `userAgent` | `user_agent.original` | Log Attribute |
| `clientIp` | `client.address` | Log Attribute |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `clientIp` | `client.address` | Log Attribute |
| `clientIp` | `source.address` | Log Attribute |

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think source is only meant to be used when it is not clear this is a client, so it is best to stick with client here

Copy link
Contributor

@thompson-tomo thompson-tomo Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then we shouldn't have destination.* attributes which was already there. In fact this mapping also already has source.* attributes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Official Microsoft Azure documentation stated that it's "the IP address of the client that made the request", so it should be client.*

| `responseBytes` | `http.response.size` | Log Attribute |
| `userAgent` | `user_agent.original` | Log Attribute |
| `clientIp` | `client.address` | Log Attribute |
| `clientPort` | `client.port` | Log Attribute |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `clientPort` | `client.port` | Log Attribute |
| `clientPort` | `source.port` | Log Attribute |

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Official Microsoft Azure documentation stated that it's "The IP port of the client that made the request", so it should be client.*


| Azure "properties" Field | OpenTelemetry | OpenTelemetry Scope |
|---------------------------|-----------------------------------|---------------------|
| `clientIP` | `client.address` | Log Attribute |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `clientIP` | `client.address` | Log Attribute |
| `clientIP` | `source.address` | Log Attribute |

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me Firewall rules don't fit into the client/server representation given that firewall rules are usually defined using the notion of source/destination.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Official Microsoft Azure documentation stated that it's "The IP address of the client that made the request", so it should be client.*

| Azure "properties" Field | OpenTelemetry | OpenTelemetry Scope |
|---------------------------|-----------------------------------|---------------------|
| `clientIP` | `client.address` | Log Attribute |
| `clientPort` | `client.port` | Log Attribute |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `clientPort` | `client.port` | Log Attribute |
| `clientPort` | `source.port` | Log Attribute |

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Official Microsoft Azure documentation stated that it's "The IP port of the client that made the request.", so it should be client.*

| `requestBytes` | `http.request.size` | Log Attribute |
| `responseBytes` | `http.response.size` | Log Attribute |
| `userAgent` | `user_agent.original` | Log Attribute |
| `clientIp` | `client.address` | Log Attribute |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `clientIp` | `client.address` | Log Attribute |
| `clientIp` | `source.address` | Log Attribute |

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Official Microsoft Azure documentation stated that it's "The IP address of the client that made the original request", so it should be client.*

| `responseBytes` | `http.response.size` | Log Attribute |
| `userAgent` | `user_agent.original` | Log Attribute |
| `clientIp` | `client.address` | Log Attribute |
| `clientPort` | `client.port` | Log Attribute |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `clientPort` | `client.port` | Log Attribute |
| `clientPort` | `source.port` | Log Attribute |

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Official Microsoft Azure documentation stated that it's "The IP port of the client that made the request.", so it should be client.*

@Fiery-Fenix
Copy link
Contributor Author

Fiery-Fenix commented Dec 14, 2025

Have attempted to be consistent with network attributes. Key thing is client/server attributes are 1 pair source/destination is another pair and both pairs shouldn't be used together.

I don't think that using source/destination everywhere is the correct approach.
According to SemConv documentation source/destination is used for low-level network communication and/or when there is no client/server relationship. This might be valid for firewall logs (still not sure), but definitely not valid for HTTP access logs (FronDoor, CDN, AppService access logs).
I think we should use client.*/server.* attributes at least for HTTP Access Logs here, because it logs for high-level (OSI level 7) communication protocol and definitely knows which side initiates the connection.

@thompson-tomo
Copy link
Contributor

So the access logs are a hard one to place and they could be client/server however the existing proposal was already using source & destination namespace hence I consolidated on that.

Comment on lines +14 to +18
"EventStampType": "Stamp",
"EventPrimaryStampName": "waws-prod-blu-479",
"EventStampName": "waws-prod-blu-479",
"Host": "lw0sdlwk0005XR",
"EventIpAddress": "10.50.0.34"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional that these details are dropped?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field is not described in documentation for this category, so I'm not sure how to correctly map it to OpenTelemetry attributes as the meaning of this value is unclear

@Fiery-Fenix
Copy link
Contributor Author

I have uploaded all the changes discussed here, no more mixtures of client.* and destination.*, updated mapping documentation and some cleanup based on Microsoft Azure documentation re-check.

As for client.* vs source.* - I have double checked official Microsoft Azure documentation for all categories and decided to use it as a source of truth.
So client.* vs source.* usage rules are simple:

  • If official Microsoft Azure documentation explicitly states that it's log for client-server communication and it has request initiator field - use client.*/server.*. For example from Azure CDN documentation: "ClientIp | The IP address of the client that made the request. ..." - documentation explicitly stated that we have client that initiate request and we have a field for it's address, decision - use client.address.
  • Otherwise - use source.*/destination.*

Comment on lines +83 to +85
// OpenTelemetry attribute name for Azure HTTP Request Duration,
// from `durationMs` field in Azure Log Record
attributeAzureRequestDuration = "azure.request.duration"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is client, you should http.client.request.duration, if it is server, you should use http.server.request.duration. See https://opentelemetry.io/docs/specs/semconv/dotnet/dotnet-http-metrics/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, type of value is conflicting with SemConv definition - SemConv states that it should be Histogram while our value is a single number

@Fiery-Fenix Fiery-Fenix reopened this Dec 15, 2025
@Fiery-Fenix Fiery-Fenix force-pushed the feat/azureencoding-logs-appservice branch from c5a64d1 to 5b506db Compare December 17, 2025 15:10
@Fiery-Fenix
Copy link
Contributor Author

Rebased and updated tests to fulfill new lint requirements (SemConv attribute names in tests should be a string representation now)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants