fix: log com tenants
All checks were successful
BCards Multi-Tenant Deployment Pipeline / Run Tests (push) Successful in 6s
BCards Multi-Tenant Deployment Pipeline / PR Validation (push) Has been skipped
BCards Multi-Tenant Deployment Pipeline / Build and Push Image (push) Successful in 13m1s
BCards Multi-Tenant Deployment Pipeline / Deploy to Release Swarm (ARM) (push) Has been skipped
BCards Multi-Tenant Deployment Pipeline / Deploy bcards.site (push) Successful in 1m3s
BCards Multi-Tenant Deployment Pipeline / Deploy spicylinks.site (push) Successful in 1m3s
BCards Multi-Tenant Deployment Pipeline / Deploy luslinks.site (push) Successful in 1m3s
BCards Multi-Tenant Deployment Pipeline / Cleanup Old Resources (push) Has been skipped
BCards Multi-Tenant Deployment Pipeline / Deployment Summary (push) Successful in 0s
All checks were successful
BCards Multi-Tenant Deployment Pipeline / Run Tests (push) Successful in 6s
BCards Multi-Tenant Deployment Pipeline / PR Validation (push) Has been skipped
BCards Multi-Tenant Deployment Pipeline / Build and Push Image (push) Successful in 13m1s
BCards Multi-Tenant Deployment Pipeline / Deploy to Release Swarm (ARM) (push) Has been skipped
BCards Multi-Tenant Deployment Pipeline / Deploy bcards.site (push) Successful in 1m3s
BCards Multi-Tenant Deployment Pipeline / Deploy spicylinks.site (push) Successful in 1m3s
BCards Multi-Tenant Deployment Pipeline / Deploy luslinks.site (push) Successful in 1m3s
BCards Multi-Tenant Deployment Pipeline / Cleanup Old Resources (push) Has been skipped
BCards Multi-Tenant Deployment Pipeline / Deployment Summary (push) Successful in 0s
This commit is contained in:
parent
917fef3f71
commit
a9f6c932db
@ -35,13 +35,16 @@ Serilog.Debugging.SelfLog.Enable(msg =>
|
||||
System.Diagnostics.Debug.WriteLine($"[SERILOG SELF] {msg}");
|
||||
});
|
||||
|
||||
var tenantName = builder.Configuration["Tenant:SiteName"] ?? "BCards";
|
||||
|
||||
var loggerConfig = new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(builder.Configuration)
|
||||
.Enrich.FromLogContext()
|
||||
.Enrich.WithEnvironmentName()
|
||||
.Enrich.WithProcessId()
|
||||
.Enrich.WithThreadId()
|
||||
.Enrich.WithProperty("ApplicationName", builder.Configuration["ApplicationName"] ?? "BCards")
|
||||
.Enrich.WithProperty("ApplicationName", tenantName)
|
||||
.Enrich.WithProperty("Tenant", tenantName)
|
||||
.Enrich.WithProperty("Environment", builder.Environment.EnvironmentName)
|
||||
.Enrich.WithProperty("Hostname", hostname);
|
||||
|
||||
@ -68,8 +71,9 @@ if (isDevelopment)
|
||||
var openSearchUrl = builder.Configuration["Serilog:OpenSearchUrl"];
|
||||
if (!string.IsNullOrEmpty(openSearchUrl))
|
||||
{
|
||||
var indexFormat = "b-cards-dev-{0:yyyy-MM}";
|
||||
Console.WriteLine($"[OPENSEARCH DEV] Configurando sink → {openSearchUrl}");
|
||||
var tenantSlug = tenantName.ToLower().Replace("+", "").Replace(" ", "-");
|
||||
var indexFormat = $"{tenantSlug}-dev-{{0:yyyy-MM}}";
|
||||
Console.WriteLine($"[OPENSEARCH DEV] Configurando sink → {openSearchUrl} (index: {indexFormat})");
|
||||
|
||||
// TODO: após confirmar que conecta, restaurar try/catch silencioso (opcional)
|
||||
loggerConfig.WriteTo.Async(a => a.OpenSearch(new OpenSearchSinkOptions(new Uri(openSearchUrl))
|
||||
@ -133,7 +137,8 @@ else
|
||||
_ => environment
|
||||
};
|
||||
|
||||
var indexFormat = $"b-cards-{envMapping}-{{0:yyyy-MM}}";
|
||||
var tenantSlugProd = tenantName.ToLower().Replace("+", "").Replace(" ", "-");
|
||||
var indexFormat = $"{tenantSlugProd}-{envMapping}-{{0:yyyy-MM}}";
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user