เพิ่ม middleware ในการเขียน log โดยเขียนไป elasticsearch โดยไม่ใช้ Serilog เพื่อจัด format เอง
This commit is contained in:
parent
71a1c48392
commit
b8fef58b28
6 changed files with 130 additions and 10 deletions
|
|
@ -174,6 +174,7 @@ var app = builder.Build();
|
|||
app.UseStaticFiles();
|
||||
app.MapControllers();
|
||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||
app.UseMiddleware<RequestLoggingMiddleware>();
|
||||
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
|
||||
{
|
||||
Authorization = new[] { new CustomAuthorizeFilter() }
|
||||
|
|
@ -223,7 +224,8 @@ ElasticsearchSinkOptions ConfigureElasticSink(IConfigurationRoot configuration,
|
|||
return new ElasticsearchSinkOptions(new Uri(configuration["ElasticConfiguration:Uri"] ?? ""))
|
||||
{
|
||||
AutoRegisterTemplate = true,
|
||||
IndexFormat = $"{Assembly.GetExecutingAssembly()?.GetName()?.Name?.ToLower().Replace(".", "-")}-{environment?.ToLower().Replace(".", "-")}"
|
||||
IndexFormat = "bma-ehr-log-index",
|
||||
//IndexFormat = $"{Assembly.GetExecutingAssembly()?.GetName()?.Name?.ToLower().Replace(".", "-")}-{environment?.ToLower().Replace(".", "-")}"
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue