You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some events from the AppServicePlatformLogs log category can contain one or more newline characters (\n).
Here's an example received export from a Diagnostic Setting to an Event Hub:
"{\"records\": [{ \"time\": \"2022-12-17T20:21:24.4331338Z\", \n \"resourceId\": \"/SUBSCRIPTIONS/5AEB8557-CAB7-41AC-8603-9F94AD233EFC/RESOURCEGROUPS/GT-WEU-GTP-CORE-DEV-RSG/PROVIDERS/MICROSOFT.WEB/SITES/AppService-Redacted\", \"category\": \"AppServicePlatformLogs\", \"operationName\": \"AutoHealingLogEvent\", \"level\": \"Informational\", \"resultDescription\": \"Worker Process serving application pool 'AppService-Redacted' hit the 'Total Requests' limit.\\n\", \"properties\": {\"message\":\"Worker Process serving application pool 'AppService-Redacted' hit the 'Total Requests' limit.\n\"}}]}"
The message attribute contains a \n in this example.
Then this string is unmarshaled, we get an error:
package main
import (
"encoding/json""fmt"
)
funcmain() {
varmapObjectmap[string][]interface{}
message:="{\"records\": [{ \"time\": \"2022-12-17T20:21:24.4331338Z\", \n\"resourceId\": \"/SUBSCRIPTIONS/5AEB8557-CAB7-41AC-8603-9F94AD233EFC/RESOURCEGROUPS/GT-WEU-GTP-CORE-DEV-RSG/PROVIDERS/MICROSOFT.WEB/SITES/AppService-Redacted\", \"category\": \"AppServicePlatformLogs\", \"operationName\": \"AutoHealingLogEvent\", \"level\": \"Informational\", \"resultDescription\": \"Worker Process serving application pool 'AppService-Redacted' hit the 'Total Requests' limit.\\n\", \"properties\": {\"message\":\"Worker Process serving application pool 'AppService-Redacted' hit the 'Total Requests' limit.\n\"}}]}"bMessage:= []byte(message)
err:=json.Unmarshal(bMessage, &mapObject)
iferr!=nil {
fmt.Println(err)
return
}
fmt.Println(mapObject)
}
The result is:
invalid character '\n' in string literal
The text was updated successfully, but these errors were encountered:
Some events from the
AppServicePlatformLogs
log category can contain one or more newline characters (\n
).Here's an example received export from a Diagnostic Setting to an Event Hub:
"{\"records\": [{ \"time\": \"2022-12-17T20:21:24.4331338Z\", \n \"resourceId\": \"/SUBSCRIPTIONS/5AEB8557-CAB7-41AC-8603-9F94AD233EFC/RESOURCEGROUPS/GT-WEU-GTP-CORE-DEV-RSG/PROVIDERS/MICROSOFT.WEB/SITES/AppService-Redacted\", \"category\": \"AppServicePlatformLogs\", \"operationName\": \"AutoHealingLogEvent\", \"level\": \"Informational\", \"resultDescription\": \"Worker Process serving application pool 'AppService-Redacted' hit the 'Total Requests' limit.\\n\", \"properties\": {\"message\":\"Worker Process serving application pool 'AppService-Redacted' hit the 'Total Requests' limit.\n\"}}]}"
The
message
attribute contains a\n
in this example.Then this string is unmarshaled, we get an error:
The result is:
The text was updated successfully, but these errors were encountered: