Open oliver-unifii opened 8 months ago
Hi,
You define what properties of log entry should be added as labels with propertiesAsLabels
setting.
Other data as you mentioned is serialized as a JSON and relies on JSON parser for querying.
That was the concept over time to avoid the high cardinality
problems, but give the possibility to query the data.
The concept of structured metadata was added later and it's a good extension point IMO.
For now I see the conceptual point to be solved:
It appears this library doesn't actually support structured logging, instead it formats log lines into nested JSON message and then relies on json parser within loki to allow filtering.
As per Loki HTTP documentation to add structured logs one can append them as last item to log line array: https://grafana.com/docs/loki/latest/reference/api/#push-log-entries-to-loki
That will produce structured metadata as per https://grafana.com/docs/loki/latest/get-started/labels/structured-metadata/
Looking through the sourcecode it seems this library only serialises timestamp and message: https://github.com/serilog-contrib/serilog-sinks-grafana-loki/blob/7ce732477a0a8f7dd713fff44b561f15dad4a9a0/src/Serilog.Sinks.Grafana.Loki/Models/LokiStream.cs#L31