0

I currently have a program that a user enters yes or no for certain questions and for each yes the user has to upload a file. If any of the data changes the users are to go back and update the fields, along with the files corresponding with the questions. All the data is being held in a Cosmo DB, and every week an email is sent out of what fields have been changed, along with if the file has been changed. My issue is the CosmosDB Change Feed is not capturing if just the file has been changed. If a yes or no field is changed it will come back in the email, but if it was just the file it won’t. If someone changes to a yes and uploads a file, it will show the status change to a yes and file.

I have tried adding another field, File Date Uploaded, so the audit could compare more data instead of just a couple letters change in the file name, but it did not change anything. Is there something I can do on the audit end for it to pick up my file changes without changing the status from no/yes? Why would it not be picking this up since I can clearly see the change in my Cosmo DB

Thiago Custodio
  • 17,332
  • 6
  • 45
  • 90
Ganzatron
  • 11
  • 6
  • when you say "Azure Audit", are you talking about Change Feed or Control plane logs sent to Azure Monitor? – Thiago Custodio Apr 26 '23 at 13:32
  • @ThiagoCustodio Change Feed – Ganzatron Apr 26 '23 at 13:54
  • where are you storing the file? it's not clear how you're correlating a document in Azure Cosmos Db and the files – Thiago Custodio Apr 26 '23 at 14:42
  • @ThiagoCustodio the file is being stored in a blob storage. However the name of the file and File Date Upload that I added is in the Cosmos DB – Ganzatron Apr 26 '23 at 14:51
  • such change should be available on Change Feed too. – Thiago Custodio Apr 26 '23 at 14:52
  • Assuming you are using Change Feed on Azure Functions, please enable the Trigger logs https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/how-to-configure-cosmos-db-trigger#enabling-trigger-specific-logs - There might be something in the Function logic that is either making it throw an unhandled exception or the logic is not behaving as you expect it to, regardless, the logs will show you if the Function is actually firing and changes are being delivered or not, so you can narrow down where the problem might be. – Matias Quaranta Apr 26 '23 at 16:13

1 Answers1

0

Pick the following document as an example:

{
   "active": "yes",
   "fileName": "text.docx"
}

if you change the values from "yes" to "no", or "text.docx" to "test.docx", those changes will be captured and available in your Azure CosmosDB Changefeed. However, if you're looking for the changes in the document itself, that's not something ChangeFeed will know, as the content of the document in not being stored into CosmosDB.

If you are using Blob Storage in an Azure Storage Account, you can use Event Grid, which will capture changes on blobs and let you consume such events using Azure Functions or Logic Apps for example.

Thiago Custodio
  • 17,332
  • 6
  • 45
  • 90
  • Yes so the example you gave is what I am having an issue with, the changefeed is not picking up the change from "text.docx" to "test.docx". I am not trying to see changes inside the document, just when the file is updated. I thought the Changefeed would pick that up since it is picking up the change from "no" to "yes". I will look into the Event Grid and Azure Functions – Ganzatron Apr 26 '23 at 14:57
  • it's definitely some issue in your code. – Thiago Custodio Apr 26 '23 at 15:03