serilog-sinks-grafana-loki icon indicating copy to clipboard operation
serilog-sinks-grafana-loki copied to clipboard

Tenant RegExpression is not valid for valid X-Scope-OrgID header values

Open ecuzziol opened this issue 1 year ago • 1 comments

Which version of Serilog.Sinks.Grafana.Loki are you using?

v8.2.0-beta.1

Which version of .NET are you using?

4.8

Describe the bug

the new tenant property is not allowing some valid characters for X-Scope-OrgID like the - character.

The regexp used in the BaseLokiHttpClient is not correct

To Reproduce

set the tenant property with some string like mytest-tenant

Expected behavior

the configuration should be valid and we should not receive System.ArgumentException: 'mytest-tenant' argument does not follow rule for Tenant ID

Log/SelfLog output or exception with stacktrace

No response

Application or code sample, which could be used to reproduce a bug

No response

Additional context

No response

I have read the documentation

ecuzziol avatar Sep 03 '23 00:09 ecuzziol

Hi @ecuzziol!

Thanks for that finding.

I remember, we had a discussion with a contributor about the validation and the next was used:

Tenant IDs can be any alphanumeric string that fits within the Go HTTP header limit (1MB). Described in https://grafana.com/docs/loki/latest/operations/multi-tenancy/

If you know more accurate rules, I would be grateful for the pull request with a validation fix and link to those rules.

Thanks

mishamyte avatar Sep 03 '23 08:09 mishamyte