I am afraid there is not a direct way. However,you can call Kudu Api to delete the log files. Below is an example of powershell script:
$ResGroupName = ""
$WebAppName = ""
$LogFolder = ""
$DaysToKeepLogsAround=""
# Get publishing profile for web application
$WebApp = Get-AzWebApp -Name $WebAppName -ResourceGroupName $ResGroupName
[xml]$publishingProfile = Get-AzWebAppPublishingProfile -WebApp $WebApp
# Create Base64 authorization header
$username = $publishingProfile.publishData.publishProfile[0].userName
$password = $publishingProfile.publishData.publishProfile[0].userPWD
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
$apiBaseUrl = "https://$($WebApp.Name).scm.azurewebsites.net/api/command"
# delete log files
$apiCommand = @{
command = 'powershell.exe -command "Get-ChildItem -Path $LogFolder -Recurse -File | Where LastWriteTime -lt (Get-Date).AddDays(-$DaysToKeepLogsAround) | Remove-Item -Force"'
dir=$LogFolder
}
Invoke-RestMethod -Uri $apiBaseUrl -Headers @{"Authorization"="Basic $base64AuthInfo";"If-Match"="*"} -Method POST -ContentType "application/json" -Body (ConvertTo-Json $apiCommand)
You can also refer to another example in this thread.
You can aslo create a azure web job and upload a powershell script to delete the old log files. Please check here for detailed steps.