Open symlynk opened 6 months ago
I'm not an expert on Azure Blob Storage, so you will probably find better advice on StackOverflow.com
When troubleshooting NLog then it is always a good idea to enable "throwConfigExceptions": true
. It can also be a good idea to enable NLog InternalLogger to see what NLog Configuration is applied.
Are you by any chance running multiple nodes against the same Azure-Blob, thus having multiple nodes performing 30000 appends, thus exceeding the max total of 50000 writes ?
The internal log shows no errors or any mention of batchSize or taskDelayMilliseconds using "internalLogLevel": "trace"
and "throwConfigExceptions": true
. I can see the target being successfully registered.
There is only a single instance of the application writing to this log which is writing around 2000 lines per second in trace mode.
If you write 2000 lines/per-sec, and using BatchSize=1000, then I guess you are performing 2 appends-per-sec.
And single blob can only handle 50000-appends, and you create single blob-per-day. So 50000 / 24 hours / 60 min = Max 34 appends-per-min.
Maybe change from daily to hourly: "blobName": "${logger}/${date:format=yyyy-MM-dd-HH:universalTime=true}.log"
You probably have to increase taskDelayMilliseconds
to avoid trigger write before having a full batchSize
:
"blob": {
"type": "AzureBlobStorage",
"blobName": "${logger}/${shortdate:universalTime=True}.log",
"connectionString": "${configsetting:ConnectionStrings.Storage}",
"container": "logs",
"batchSize": 10000,
"taskDelayMilliseconds": 5000
}
Again probably easier to change from daily to hourly: "blobName": "${logger}/${date:format=yyyy-MM-dd-HH:universalTime=true}.log"
How would I go about setting the batchSize and taskDelayMilliseconds using appsettings.json? The following doesn't appear to be working as I'm hitting the 50000 block limit with similar number of lines in the log no matter what values I use.