2

I am using the default logging mechanism that Azure web job provides. Type of logger is 'TextWriter'. I have 3 functions in the same web job with extensive logging. A number of logs being generated every minute. As with the default settings of azure web job, all the logs go to the storage account into blobs. I do not want my storage account to just keep on growing with months and months of old logs.

I need a way of cleaning the logs on a periodic basis. Or is there any setting/configuration that can be done so that my logs get cleaned on a periodic basis? Or should I write code to monitor the blob container 'azure-webjobs-hosts' and then the files inside 'output-logs'. Is that the only place where the logs for my application are stored by default by the web job?

I tried searching the web but couldn't find any related posts. Any pointers would be of great help.

  • Also see related question (and answer) here: https://stackoverflow.com/questions/43259345/what-is-the-clean-up-mechanism-for-the-blobs-that-webjobs-sdk-creates-in-the-azu – Sean Oct 22 '18 at 23:54

1 Answers1

0

Based on my experience, we can achieve this purpose by define the azure storage container name. We can define weekly/monthly/daily as container name. Then use a time trigger function to delete the container. For example, if we need delete weekly data, then we set container for this weekly data, then delete it in the next week via time trigger.

Jambor - MSFT
  • 3,175
  • 1
  • 13
  • 16
  • Thanks @Jambor for your suggestion. – Trupti Ranpise Feb 06 '17 at 17:34
  • I was searching for some quick configuration for housekeeping the application logs stored in blobs. But did not find the configuration setting on the new azure portal. Its there in the older version of the azure portal. – Trupti Ranpise Feb 06 '17 at 17:42
  • I changed the logging mechanism of my web job. I configured my web job on the azure portal to enable Application logging. There I saw the option of setting the blob container name. And I created a new web job function (based on a timer trigger) to delete the files in the container whose last modifier date is older than 'n' number of days. And I kept 'n' to be configurable. – Trupti Ranpise Feb 06 '17 at 17:42