1
votes

I understand that WebJob SDK uses the blob storage defined in AzureWebJobsDashboard connection for Dashboard logging.

Is there any way to have WebJob SDK uses Azure Storage Table instead of the Blob storage for whatever Dashboard it logs into AzureWebJobsDashboard connection?

Update 1: This article shows how the log output entries appear in Azure Table:

https://docs.microsoft.com/en-us/azure/app-service-web/websites-dotnet-webjobs-sdk-storage-queues-how-to#logs

And in an Azure table the Console.Out and Console.Error logs look like this:

enter image description here

How can WebJob SDK be configured to log to an Azure table like above?

1

1 Answers

1
votes

In short answer: No.

As far as I know, the AzureWebJobsDashboard storage account is primarily used by Azure WebJob SDK to store logs from the WebJobs Dashboard. This connection string is optional and is required only if you are planning to use the dashboard for monitoring WebJobs.

The WebJob runtime creates two containers under this storage account with the names ‘azure-webjobs-dashboard’ and ‘azure-jobs-host-archive’. The azure-webJobs-dashboard container is used by the WebJob dashboard to store host and execution endpoint (function) details. Azure-jobs-host-archive is used as an archive for execution logs.

The webjob SDK doesn't support store the log to the table.

If you still want to log the information in the table, I suggest you could not set the AzureWebJobsDashboard connectionstring and write some codes in your web job function to store the message to the table storage by yourself.


Update:

According to your posted article, if your web app enables the web app diagnostics logs' application logging as below, it will automatic write the webjob logs to the azure storage account.

enter image description here

But application logging to the table storage feature has removed the new portal.

If you want to enable it, you should use powershell.

More details, you could refer to below steps:

1.Create a table to store the log data. I suggest you could use azure storage explorer.

enter image description here

2.Generate the SAS url.

enter image description here

3.After created, you could copy the sas url.

4.Install azure cli.

5.Run below command:

Login-AzureRmAccount

$PropertiesObject = @{applicationLogs=@{azureTableStorage=@{level="Verbose";sasUrl="yourtableSASurl"}}}

Set-AzureRmResource -PropertyObject $PropertiesObject -ResourceGroupName "yourresourcegroupname" -ResourceType Microsoft.Web/sites/config -ResourceName "webappname/logs" -ApiVersion 2015-08-01 -Force

Then you could find your log message in the table.

enter image description here

But, We don't typically recommend using Tables for log data - it can result in the append only pattern which at scale doesn't work effectively for Table Storage.

More details, you could refer to this reply.