4

I’m running a multi-tenant Loki setup and sending logs through Grafana Alloy.

I need Alloy to set the X-Scope-OrgID header dynamically so that each log stream is stored under the correct tenant. Specifically, I want the tenant id to be built from a log label: environment:

So if a log has environment=prod, the tenant should be prod.

I’ve seen that Alloy’s loki.write component has a tenant_id field, but it only accepts a static string. I also came across stage.tenant in loki.process, which looks like it might support assigning the tenant from labels.

Question: How can I configure Alloy so that the tenant id is created dynamically from log label (environment) and sent to Loki as X-Scope-OrgID?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.