Hi Johan ,
Please check below query if it helps your requirement
AppServiceAppLogs
| where Message contains "Starting instance" or Message contains "Stopping instance"
| project InstanceId = extractjson("$.InstanceID", Message), State = iff(Message contains "Starting instance", "Running", "Stopped")
| summarize InstanceCount = count() by State
Ref doc --> https://learn.microsoft.com/en-us/azure/app-service/monitor-app-service
Kindly check once and accept if it helps