Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions BlobToOtel/BlobToOtel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,23 @@ const eventHubTrigger = async function (context: InvocationContext, eventHubMess
if (!line || !line.trim()) continue; // Skip empty lines

try {
const storageAccountName = event.topic ? event.topic.split('/').pop() : urlParts.hostname.split('.')[0];
const attributes: any = {
'log.type': 'BlobLogRecord',
'blob.container': containerName,
'blob.path': blobPath,
'blob.storage.account': storageAccountName
};

if (event.data?.contentLength) {
attributes['blob.size'] = event.data.contentLength;
}

logger.emit({
severityNumber: logsAPI.SeverityNumber.INFO,
severityText: 'INFO',
body: line,
attributes: {
'log.type': 'BlobLogRecord',
'blob.container': containerName,
'blob.path': blobPath,
'blob.storage.account': event.topic.split('/').pop(),
'blob.size': event.data.contentLength
}
attributes
});
processedLines++;
} catch (lineError) {
Expand Down
3 changes: 3 additions & 0 deletions BlobToOtel/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<!-- ### version / full date -->
<!-- * [Update/Bug fix] message that describes the changes that you apply -->

### 2.3.0 / 26 Jan 2026
* [Fix] Handle undefined event.topic when extracting storage account name

### 2.2.0 / 05 Jan 2026
[Fix] Improve batching logic
[Update] Use `@opentelemetry/exporter-logs-otlp-http` instead of `@opentelemetry/exporter-logs-otlp-grpc`
Expand Down