File tree Expand file tree Collapse file tree
azure/activity_logs_monitoring Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -383,30 +383,28 @@ class EventhubLogHandler {
383383 this . records . push ( originalRecord ) ;
384384 }
385385 } else {
386- this . records . push ( this . fixPropertiesJsonString ( originalRecord ) ) ;
386+ this . records . push ( this . formatProperties ( originalRecord ) ) ;
387387 }
388388 } else {
389389 record = this . addTagsToStringLog ( record ) ;
390390 this . records . push ( record ) ;
391391 }
392392 }
393393
394- fixPropertiesJsonString ( record ) {
394+ formatProperties ( record ) {
395395 // Check if properties field is a malformed JSON String
396396 if ( Object . hasOwn ( record , 'properties' ) && ( typeof record . properties === 'string' ) && ( record . properties . includes ( "':'" ) ) ) {
397397 try {
398398 // If the check is true, find and replace single quotes
399399 // with double quotes, to make a proper JSON
400400 // which is then converted into a JSON Object
401- record . properties = JSON . parse ( record . properties . replace ( / ' / g, '"' ) ) ;
402- return record ;
401+ parsedProperties = JSON . parse ( record . properties . replace ( / ' / g, '"' ) ) ;
402+ record . properties = parsedProperties ;
403403 } catch {
404404 this . context . error ( 'Unable to fix properties field to JSON Object' ) ;
405- return record ;
406405 }
407- } else {
408- return record ;
409406 }
407+ return record ;
410408 }
411409
412410 handleLogs ( logs ) {
You can’t perform that action at this time.
0 commit comments