File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -120,17 +120,23 @@ const eventHubTrigger = async function (context: InvocationContext, eventHubMess
120120 if ( ! line || ! line . trim ( ) ) continue ; // Skip empty lines
121121
122122 try {
123+ const storageAccountName = event . topic ? event . topic . split ( '/' ) . pop ( ) : urlParts . hostname . split ( '.' ) [ 0 ] ;
124+ const attributes : any = {
125+ 'log.type' : 'BlobLogRecord' ,
126+ 'blob.container' : containerName ,
127+ 'blob.path' : blobPath ,
128+ 'blob.storage.account' : storageAccountName
129+ } ;
130+
131+ if ( event . data ?. contentLength ) {
132+ attributes [ 'blob.size' ] = event . data . contentLength ;
133+ }
134+
123135 logger . emit ( {
124136 severityNumber : logsAPI . SeverityNumber . INFO ,
125137 severityText : 'INFO' ,
126138 body : line ,
127- attributes : {
128- 'log.type' : 'BlobLogRecord' ,
129- 'blob.container' : containerName ,
130- 'blob.path' : blobPath ,
131- 'blob.storage.account' : event . topic . split ( '/' ) . pop ( ) ,
132- 'blob.size' : event . data . contentLength
133- }
139+ attributes
134140 } ) ;
135141 processedLines ++ ;
136142 } catch ( lineError ) {
You can’t perform that action at this time.
0 commit comments