If the Azure functions core tools (func) did not work, it could be due to several things, but try to use AZ CLI tool instead. If the latter works, then it can mean that the function app has some settings or configuration that doesn’t allow you to stream logs using the functions ccore tools.
Using the functions core tools:
func azure functionapp logstream thefunc
Retrieving Function App...
Response status code does not indicate success: 404 (Not Found).
Using AZ CLI:
az monitor log-analytics query \
--workspace "$WORKSPACE_ID" \
--analytics-query "AppTraces | where TimeGenerated > ago(24h) | where AppRoleName == 'thefunc' | where Message contains 'Timer function processed request' | order by TimeGenerated desc | project TimeGenerated, Message, SeverityLevel" \
--output table