Open advapiIT opened 9 months ago
To be honest - for me all these things looks legit, as ElasticSearch/OpenSearch supports arrays without any issues, see: https://www.elastic.co/guide/en/elasticsearch/reference/current/array.html However - maybe the issue is that you have these arrays create in multiple places with the same name, but inside you have different properties?
By looking more closely.. it seems like with a single log message you need only one pair of ProductInventoryId and ExternalProductId, is that right? Because now.. since you are not disposing scope - every log line gets more and more these entries. So one way would be (see added using):
foreach (var productInventoryIdByExternalProductId in filtered)
{
using var scope = _logger.BeginScope(new Dictionary<string, string>()
{
{ "ProductInventoryId", productInventoryIdByExternalProductId.Key.ToString() },
{"ExternalProductId", productInventoryIdByExternalProductId.Value}
});
_logger.LogInformation($"Started processing ProductInventoryId: {productInventoryIdByExternalProductId.Key} .[{count}/{total}]");
Another option:
foreach (var productInventoryIdByExternalProductId in filtered)
{
_logger.LogInformation("Started processing ProductInventoryId = {ProductInventoryId}. ExternalProductId = {ExternalProductId}. [{Count}/{Total}]", productInventoryIdByExternalProductId.Key, productInventoryIdByExternalProductId.Value, count, total);
Hello, I'm using Serilog + Serilog.Sinks.Logz.io to send event to Logzio (europe). I've been contacted by the support since they told me that I've tons of log message that cannot be indexed since I used the Scope.
In particular consider this case![image](https://github.com/serilog-contrib/Serilog.Sinks.Logz.Io/assets/4690086/f1f0b8dd-9c4a-4a73-a442-e09e8b5173f0)
They wrote me :" Im still checking, but it looks to be from the field "properties.Scope_list". The field is getting sent as an array and causing index failures"
My code is thefollowing, since I have those properties that needs to be attached to all the nested logs starting from the using:
What am I doing wrong? Thanks