Search code examples
node.jsazure-functionsazure-blob-storageazure-blob-trigger

Is there a way to only pass the appended blob content to blob trigger Azure Function?


I am trying to make a blob trigger azure function for log files, but the problem is it will pass through the entire blob content when any blob is created or updated.

So I am wondering is there a way to only get the appended blob content?

module.exports = async function main(context, myBlob) {
 // I am using javascript, myblob contains the entire content of single blob.
 // For logs in append blob, it results in duplicated logs, which is not ideal.
};

Solution

  • So I am wondering is there a way to only get the appended blob content?

    No.


    Unless you

    • maintain the byte-index/position per log file where you read last some place (e.g. using a file/DB/any-persistant-storage) or use Durable Function
    • on change notification, you find the last byte-index/position and read starting from that location using appropriate SDK/API. Here is the REST API (for ADLS Gen2, find the right one if you're using Gen1 or Blob) and some description on how to read a byte range out of a file in blobs.