Flatten JSON alloy to Loki

I am using the OpenTelemetry library in my .NET application to collect logs. These logs are sent to Grafana Alloy, which then forwards them to Grafana Loki.

Currently, the JSON-based logs are not displayed as a single line in Loki, and I want to configure Grafana Alloy to ensure that:

  1. Logs appear as a single line.
  2. All attributes and labels are preserved.

How can I achieve this configuration in Grafana Alloy? Are there any specific examples or settings that I should follow?

Any guidance or examples would be greatly appreciated!

I ran into this and since alloy does not currently have a flatten JSON feature, I decided to do it on the process that sends the JSON logs. In your case maybe flatten the JSON log as one line in your .net code?